From a69af8ad79adc4e61b5bdcdf267d7341e08318ce Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Tue, 25 Jan 2022 03:43:08 +0000 Subject: [PATCH 1/2] Fix Static on startup. If a static talkgroup is set in the configuration file is set, some 3 poll frames are sent, but replies are ignored, hence the connection status stays disconnected, and localnetwork won't get any data also. --- NXDNGateway/NXDNGateway.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/NXDNGateway/NXDNGateway.cpp b/NXDNGateway/NXDNGateway.cpp index 775268a..4d224f9 100644 --- a/NXDNGateway/NXDNGateway.cpp +++ b/NXDNGateway/NXDNGateway.cpp @@ -313,9 +313,11 @@ void CNXDNGateway::run() hangTimer.start(); } } else if (currentTG == 0U) { - // Don't pass reflector control data through to the MMDVM - if (::memcmp(buffer, "NXDND", 5U) == 0) { - // Find the static TG that this audio data belongs to + bool poll = false; + + // We weren't really connected yet, but we got a reply from a poll, or some data + if ((::memcmp(buffer, "NXDND", 5U) == 0) || (poll = (::memcmp(buffer, "NXDNP", 5U) == 0))) { + // Find the static TG that this audio data/poll belongs to for (std::vector::const_iterator it = staticTGs.cbegin(); it != staticTGs.cend(); ++it) { if (CUDPSocket::match(addr, (*it).m_addr)) { currentTG = (*it).m_tg; @@ -334,7 +336,7 @@ void CNXDNGateway::run() bool grp = (buffer[9U] & 0x01U) == 0x01U; - if (grp && currentTG == dstTG) + if (grp && currentTG == dstTG && (poll == false)) localNetwork->write(buffer + 10U, len - 10U); LogMessage("Switched to reflector %u due to network activity", currentTG); From 4f3bc665442e20adaffe93ff45816dd939c90a15 Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Tue, 25 Jan 2022 18:46:33 +0000 Subject: [PATCH 2/2] Change negation checking coding style. --- NXDNGateway/NXDNGateway.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NXDNGateway/NXDNGateway.cpp b/NXDNGateway/NXDNGateway.cpp index 4d224f9..3b1dbbe 100644 --- a/NXDNGateway/NXDNGateway.cpp +++ b/NXDNGateway/NXDNGateway.cpp @@ -336,7 +336,7 @@ void CNXDNGateway::run() bool grp = (buffer[9U] & 0x01U) == 0x01U; - if (grp && currentTG == dstTG && (poll == false)) + if (grp && currentTG == dstTG && !poll) localNetwork->write(buffer + 10U, len - 10U); LogMessage("Switched to reflector %u due to network activity", currentTG);