Fix the port numbers for NXCore Icom compatibility.

This commit is contained in:
Jonathan Naylor 2018-03-01 20:47:39 +00:00
parent 12cfaec1f6
commit 4768e80a37
3 changed files with 13 additions and 13 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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<unsigned char> m_buffer;
};