From 4768e80a378b73745b6149ee1db03c2a3673f105 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 1 Mar 2018 20:47:39 +0000 Subject: [PATCH] Fix the port numbers for NXCore Icom compatibility. --- NXDNDefines.h | 2 ++ NXDNNetwork.cpp | 13 ++++++------- NXDNNetwork.h | 11 +++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NXDNDefines.h b/NXDNDefines.h index 31291c4..9aaeb8f 100644 --- a/NXDNDefines.h +++ b/NXDNDefines.h @@ -99,4 +99,6 @@ const unsigned char NXDN_DATA_CALL_OPTION_9600 = 0x02U; const unsigned char SACCH_IDLE[] = { NXDN_MESSAGE_TYPE_IDLE, 0x00U, 0x00U }; +const unsigned int NXCORE_ICOM_PORT = 41300U; + #endif diff --git a/NXDNNetwork.cpp b/NXDNNetwork.cpp index 7feeca5..25464cb 100644 --- a/NXDNNetwork.cpp +++ b/NXDNNetwork.cpp @@ -28,15 +28,14 @@ const unsigned int BUFFER_LENGTH = 200U; -CNXDNNetwork::CNXDNNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug) : -m_socket(myAddress, myPort), +CNXDNNetwork::CNXDNNetwork(const std::string& address, bool debug) : +m_socket("", NXCORE_ICOM_PORT), m_address(), -m_port(gatewayPort), m_debug(debug), m_enabled(false), m_buffer(1000U, "NXDN Network") { - m_address = CUDPSocket::lookup(gatewayAddress); + m_address = CUDPSocket::lookup(address); } CNXDNNetwork::~CNXDNNetwork() @@ -78,7 +77,7 @@ bool CNXDNNetwork::write(const unsigned char* data, bool single) if (m_debug) CUtils::dump(1U, "NXDN Network Data Sent", buffer, 102U); - return m_socket.write(buffer, 102U, m_address, m_port); + return m_socket.write(buffer, 102U, m_address, NXCORE_ICOM_PORT); } void CNXDNNetwork::clock(unsigned int ms) @@ -92,8 +91,8 @@ void CNXDNNetwork::clock(unsigned int ms) return; // Check if the data is for us - if (m_address.s_addr != address.s_addr || m_port != port) { - LogMessage("NXDN packet received from an invalid source, %08X != %08X and/or %u != %u", m_address.s_addr, address.s_addr, m_port, port); + if (m_address.s_addr != address.s_addr || port != NXCORE_ICOM_PORT) { + LogMessage("NXDN packet received from an invalid source, %08X != %08X and/or %u != %u", m_address.s_addr, address.s_addr, NXCORE_ICOM_PORT, port); return; } diff --git a/NXDNNetwork.h b/NXDNNetwork.h index 7b2f178..f640e5e 100644 --- a/NXDNNetwork.h +++ b/NXDNNetwork.h @@ -29,7 +29,7 @@ class CNXDNNetwork { public: - CNXDNNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug); + CNXDNNetwork(const std::string& address, bool debug); ~CNXDNNetwork(); bool open(); @@ -47,11 +47,10 @@ public: void clock(unsigned int ms); private: - CUDPSocket m_socket; - in_addr m_address; - unsigned int m_port; - bool m_debug; - bool m_enabled; + CUDPSocket m_socket; + in_addr m_address; + bool m_debug; + bool m_enabled; CRingBuffer m_buffer; };