Skip to content

Commit

Permalink
More work on integrating the Kenwood NXDN protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed May 27, 2020
1 parent 45eafe3 commit 924baea
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 68 deletions.
8 changes: 8 additions & 0 deletions Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ m_p25LocalPort(0U),
m_p25NetworkModeHang(3U),
m_p25NetworkDebug(false),
m_nxdnNetworkEnabled(false),
m_nxdnNetworkProtocol("Icom"),
m_nxdnGatewayAddress(),
m_nxdnGatewayPort(0U),
m_nxdnLocalAddress(),
Expand Down Expand Up @@ -842,6 +843,8 @@ bool CConf::read()
} else if (section == SECTION_NXDN_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_nxdnNetworkEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Protocol") == 0)
m_nxdnNetworkProtocol = value;
else if (::strcmp(key, "LocalAddress") == 0)
m_nxdnLocalAddress = value;
else if (::strcmp(key, "LocalPort") == 0)
Expand Down Expand Up @@ -1832,6 +1835,11 @@ bool CConf::getNXDNNetworkEnabled() const
return m_nxdnNetworkEnabled;
}

std::string CConf::getNXDNNetworkProtocol() const
{
return m_nxdnNetworkProtocol;
}

std::string CConf::getNXDNGatewayAddress() const
{
return m_nxdnGatewayAddress;
Expand Down
2 changes: 2 additions & 0 deletions Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class CConf

// The NXDN Network section
bool getNXDNNetworkEnabled() const;
std::string getNXDNNetworkProtocol() const;
std::string getNXDNGatewayAddress() const;
unsigned int getNXDNGatewayPort() const;
std::string getNXDNLocalAddress() const;
Expand Down Expand Up @@ -509,6 +510,7 @@ class CConf
bool m_p25NetworkDebug;

bool m_nxdnNetworkEnabled;
std::string m_nxdnNetworkProtocol;
std::string m_nxdnGatewayAddress;
unsigned int m_nxdnGatewayPort;
std::string m_nxdnLocalAddress;
Expand Down
9 changes: 8 additions & 1 deletion MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/

#include "MMDVMHost.h"
#include "NXDNKenwoodNetwork.h"
#include "NXDNIcomNetwork.h"
#include "RSSIInterpolator.h"
#include "SerialController.h"
#include "Version.h"
Expand Down Expand Up @@ -1472,6 +1474,7 @@ bool CMMDVMHost::createP25Network()

bool CMMDVMHost::createNXDNNetwork()
{
std::string protocol = m_conf.getNXDNNetworkProtocol();
std::string gatewayAddress = m_conf.getNXDNGatewayAddress();
unsigned int gatewayPort = m_conf.getNXDNGatewayPort();
std::string localAddress = m_conf.getNXDNLocalAddress();
Expand All @@ -1480,13 +1483,17 @@ bool CMMDVMHost::createNXDNNetwork()
bool debug = m_conf.getNXDNNetworkDebug();

LogInfo("NXDN Network Parameters");
LogInfo(" Protocol: %s", protocol.c_str());
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
LogInfo(" Gateway Port: %u", gatewayPort);
LogInfo(" Local Address: %s", localAddress.c_str());
LogInfo(" Local Port: %u", localPort);
LogInfo(" Mode Hang: %us", m_nxdnNetModeHang);

m_nxdnNetwork = new CNXDNNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
if (protocol == "Kenwood")
m_nxdnNetwork = new CNXDNKenwoodNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
else
m_nxdnNetwork = new CNXDNIcomNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);

bool ret = m_nxdnNetwork->open();
if (!ret) {
Expand Down
4 changes: 2 additions & 2 deletions NXDNControl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 Jonathan Naylor, G4KLX
* Copyright (C) 2015-2020 Jonathan Naylor, G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -39,7 +39,7 @@ const unsigned char BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])

CNXDNControl::CNXDNControl(unsigned int ran, unsigned int id, bool selfOnly, CNXDNNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CNXDNLookup* lookup, CRSSIInterpolator* rssiMapper) :
CNXDNControl::CNXDNControl(unsigned int ran, unsigned int id, bool selfOnly, INXDNNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CNXDNLookup* lookup, CRSSIInterpolator* rssiMapper) :
m_ran(ran),
m_id(id),
m_selfOnly(selfOnly),
Expand Down
6 changes: 3 additions & 3 deletions NXDNControl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,7 +36,7 @@

class CNXDNControl {
public:
CNXDNControl(unsigned int ran, unsigned int id, bool selfOnly, CNXDNNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CNXDNLookup* lookup, CRSSIInterpolator* rssiMapper);
CNXDNControl(unsigned int ran, unsigned int id, bool selfOnly, INXDNNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CNXDNLookup* lookup, CRSSIInterpolator* rssiMapper);
~CNXDNControl();

bool writeModem(unsigned char* data, unsigned int len);
Expand All @@ -53,7 +53,7 @@ class CNXDNControl {
unsigned int m_ran;
unsigned int m_id;
bool m_selfOnly;
CNXDNNetwork* m_network;
INXDNNetwork* m_network;
CDisplay* m_display;
bool m_duplex;
bool m_remoteGateway;
Expand Down
Loading

0 comments on commit 924baea

Please sign in to comment.