Skip to content

Commit 924baea

Browse files
committed
More work on integrating the Kenwood NXDN protocol.
1 parent 45eafe3 commit 924baea

File tree

9 files changed

+130
-68
lines changed

9 files changed

+130
-68
lines changed

Conf.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ m_p25LocalPort(0U),
236236
m_p25NetworkModeHang(3U),
237237
m_p25NetworkDebug(false),
238238
m_nxdnNetworkEnabled(false),
239+
m_nxdnNetworkProtocol("Icom"),
239240
m_nxdnGatewayAddress(),
240241
m_nxdnGatewayPort(0U),
241242
m_nxdnLocalAddress(),
@@ -842,6 +843,8 @@ bool CConf::read()
842843
} else if (section == SECTION_NXDN_NETWORK) {
843844
if (::strcmp(key, "Enable") == 0)
844845
m_nxdnNetworkEnabled = ::atoi(value) == 1;
846+
else if (::strcmp(key, "Protocol") == 0)
847+
m_nxdnNetworkProtocol = value;
845848
else if (::strcmp(key, "LocalAddress") == 0)
846849
m_nxdnLocalAddress = value;
847850
else if (::strcmp(key, "LocalPort") == 0)
@@ -1832,6 +1835,11 @@ bool CConf::getNXDNNetworkEnabled() const
18321835
return m_nxdnNetworkEnabled;
18331836
}
18341837

1838+
std::string CConf::getNXDNNetworkProtocol() const
1839+
{
1840+
return m_nxdnNetworkProtocol;
1841+
}
1842+
18351843
std::string CConf::getNXDNGatewayAddress() const
18361844
{
18371845
return m_nxdnGatewayAddress;

Conf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ class CConf
244244

245245
// The NXDN Network section
246246
bool getNXDNNetworkEnabled() const;
247+
std::string getNXDNNetworkProtocol() const;
247248
std::string getNXDNGatewayAddress() const;
248249
unsigned int getNXDNGatewayPort() const;
249250
std::string getNXDNLocalAddress() const;
@@ -509,6 +510,7 @@ class CConf
509510
bool m_p25NetworkDebug;
510511

511512
bool m_nxdnNetworkEnabled;
513+
std::string m_nxdnNetworkProtocol;
512514
std::string m_nxdnGatewayAddress;
513515
unsigned int m_nxdnGatewayPort;
514516
std::string m_nxdnLocalAddress;

MMDVMHost.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818

1919
#include "MMDVMHost.h"
20+
#include "NXDNKenwoodNetwork.h"
21+
#include "NXDNIcomNetwork.h"
2022
#include "RSSIInterpolator.h"
2123
#include "SerialController.h"
2224
#include "Version.h"
@@ -1472,6 +1474,7 @@ bool CMMDVMHost::createP25Network()
14721474

14731475
bool CMMDVMHost::createNXDNNetwork()
14741476
{
1477+
std::string protocol = m_conf.getNXDNNetworkProtocol();
14751478
std::string gatewayAddress = m_conf.getNXDNGatewayAddress();
14761479
unsigned int gatewayPort = m_conf.getNXDNGatewayPort();
14771480
std::string localAddress = m_conf.getNXDNLocalAddress();
@@ -1480,13 +1483,17 @@ bool CMMDVMHost::createNXDNNetwork()
14801483
bool debug = m_conf.getNXDNNetworkDebug();
14811484

14821485
LogInfo("NXDN Network Parameters");
1486+
LogInfo(" Protocol: %s", protocol.c_str());
14831487
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
14841488
LogInfo(" Gateway Port: %u", gatewayPort);
14851489
LogInfo(" Local Address: %s", localAddress.c_str());
14861490
LogInfo(" Local Port: %u", localPort);
14871491
LogInfo(" Mode Hang: %us", m_nxdnNetModeHang);
14881492

1489-
m_nxdnNetwork = new CNXDNNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
1493+
if (protocol == "Kenwood")
1494+
m_nxdnNetwork = new CNXDNKenwoodNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
1495+
else
1496+
m_nxdnNetwork = new CNXDNIcomNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
14901497

14911498
bool ret = m_nxdnNetwork->open();
14921499
if (!ret) {

NXDNControl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015-2019 Jonathan Naylor, G4KLX
2+
* Copyright (C) 2015-2020 Jonathan Naylor, G4KLX
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ const unsigned char BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04
3939
#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])
4040
#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
4141

42-
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) :
42+
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) :
4343
m_ran(ran),
4444
m_id(id),
4545
m_selfOnly(selfOnly),

NXDNControl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
2+
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
3636

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

4242
bool writeModem(unsigned char* data, unsigned int len);
@@ -53,7 +53,7 @@ class CNXDNControl {
5353
unsigned int m_ran;
5454
unsigned int m_id;
5555
bool m_selfOnly;
56-
CNXDNNetwork* m_network;
56+
INXDNNetwork* m_network;
5757
CDisplay* m_display;
5858
bool m_duplex;
5959
bool m_remoteGateway;

0 commit comments

Comments
 (0)