From ee9f3e181613ffed5aa5e6cd57a33f8785981a6e Mon Sep 17 00:00:00 2001 From: Geoffrey Merck F4FXL - KC3FRA Date: Sun, 18 Nov 2018 18:41:13 +0100 Subject: [PATCH] Make repeaterhandler aware of cached G2 Port --- Common/CacheManager.cpp | 2 +- Common/CacheManager.h | 11 +++++++++-- Common/GatewayCache.h | 2 +- Common/RepeaterHandler.cpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Common/CacheManager.cpp b/Common/CacheManager.cpp index fd12a47..a9dbe1b 100644 --- a/Common/CacheManager.cpp +++ b/Common/CacheManager.cpp @@ -54,7 +54,7 @@ CUserData* CCacheManager::findUser(const wxString& user) if (gr == NULL) return NULL; - return new CUserData(user, ur->getRepeater(), gr->getGateway(), gr->getAddress()); + return new CUserData(user, ur->getRepeater(), gr->getGateway(), gr->getAddress(), gr->getG2Port()); } CGatewayData* CCacheManager::findGateway(const wxString& gateway) diff --git a/Common/CacheManager.h b/Common/CacheManager.h index c014ce7..2226aee 100644 --- a/Common/CacheManager.h +++ b/Common/CacheManager.h @@ -33,11 +33,12 @@ class CUserData { public: - CUserData(const wxString& user, const wxString& repeater, const wxString& gateway, in_addr address) : + CUserData(const wxString& user, const wxString& repeater, const wxString& gateway, in_addr address, unsigned int g2Port) : m_user(user), m_repeater(repeater), m_gateway(gateway), - m_address(address) + m_address(address), + m_g2Port(g2Port) { } @@ -61,11 +62,17 @@ public: return m_address; } + unsigned int getG2Port() const + { + return m_g2Port; + } + private: wxString m_user; wxString m_repeater; wxString m_gateway; in_addr m_address; + unsigned int m_g2Port; }; class CRepeaterData { diff --git a/Common/GatewayCache.h b/Common/GatewayCache.h index 7729241..dc963b9 100644 --- a/Common/GatewayCache.h +++ b/Common/GatewayCache.h @@ -69,7 +69,7 @@ public: return m_protocol; } - unsigned int g2Port() const + unsigned int getG2Port() const { return m_g2Port; } diff --git a/Common/RepeaterHandler.cpp b/Common/RepeaterHandler.cpp index 1a25db0..0209ecb 100644 --- a/Common/RepeaterHandler.cpp +++ b/Common/RepeaterHandler.cpp @@ -2025,7 +2025,7 @@ void CRepeaterHandler::g2CommandHandler(const wxString& callsign, const wxString m_g2Address = data->getAddress(); m_g2Repeater = data->getRepeater(); m_g2Gateway = data->getGateway(); - header.setDestination(m_g2Address, G2_DV_PORT); + header.setDestination(m_g2Address, data->getG2Port()); header.setRepeaters(m_g2Gateway, m_g2Repeater); m_g2Handler->writeHeader(header);