From 30b9bbdb3810a97b8c9ace733541fc0f2d0895d4 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:33:53 +0200 Subject: [PATCH 1/8] Update Conf.h --- YSFGateway/Conf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/YSFGateway/Conf.h b/YSFGateway/Conf.h index 7f07a9c..e050599 100644 --- a/YSFGateway/Conf.h +++ b/YSFGateway/Conf.h @@ -67,6 +67,7 @@ public: // The Network section std::string getNetworkStartup() const; + std::string getNetworkOptions() const; unsigned int getNetworkInactivityTimeout() const; bool getNetworkRevert() const; bool getNetworkDebug() const; @@ -134,6 +135,7 @@ private: std::string m_aprsDescription; std::string m_networkStartup; + std::string m_networkOptions; unsigned int m_networkInactivityTimeout; bool m_networkRevert; bool m_networkDebug; From 9b698b5d8cdcf0286fd06a0033544da6c9940aec Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:37:20 +0200 Subject: [PATCH 2/8] Update Conf.cpp --- YSFGateway/Conf.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/YSFGateway/Conf.cpp b/YSFGateway/Conf.cpp index eb5b2b4..50497b7 100644 --- a/YSFGateway/Conf.cpp +++ b/YSFGateway/Conf.cpp @@ -70,6 +70,7 @@ m_aprsPort(0U), m_aprsSuffix(), m_aprsDescription(), m_networkStartup(), +m_networkOptions(), m_networkInactivityTimeout(0U), m_networkRevert(false), m_networkDebug(false), @@ -214,6 +215,8 @@ bool CConf::read() } else if (section == SECTION_NETWORK) { if (::strcmp(key, "Startup") == 0) m_networkStartup = value; + else if (::strcmp(key, "Options") == 0) + m_networkOptions = value; else if (::strcmp(key, "InactivityTimeout") == 0) m_networkInactivityTimeout = (unsigned int)::atoi(value); else if (::strcmp(key, "Revert") == 0) @@ -417,6 +420,11 @@ std::string CConf::getNetworkStartup() const return m_networkStartup; } +std::string CConf::getNetworkOptions() const +{ + return m_networkOptions; +} + unsigned int CConf::getNetworkInactivityTimeout() const { return m_networkInactivityTimeout; From 07690aa58340e85c7241276e06194a35488aeaa3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:40:04 +0200 Subject: [PATCH 3/8] Update YSFGateway.h Add OPTIONS --- YSFGateway/YSFGateway.h | 1 + 1 file changed, 1 insertion(+) diff --git a/YSFGateway/YSFGateway.h b/YSFGateway/YSFGateway.h index b74db45..c0d75ce 100644 --- a/YSFGateway/YSFGateway.h +++ b/YSFGateway/YSFGateway.h @@ -59,6 +59,7 @@ private: LINK_TYPE m_linkType; std::string m_current; std::string m_startup; + std::string m_options; bool m_exclude; CTimer m_inactivityTimer; CTimer m_lostTimer; From d1c8e34cea5f176dbd99190e524c426fced30bbf Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:45:25 +0200 Subject: [PATCH 4/8] Update YSFGateway.cpp ADD OPTIONS= --- YSFGateway/YSFGateway.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/YSFGateway/YSFGateway.cpp b/YSFGateway/YSFGateway.cpp index 27fd83e..fb23724 100644 --- a/YSFGateway/YSFGateway.cpp +++ b/YSFGateway/YSFGateway.cpp @@ -89,6 +89,7 @@ m_fcsNetwork(NULL), m_linkType(LINK_NONE), m_current(), m_startup(), +m_options(), m_exclude(false), m_inactivityTimer(1000U), m_lostTimer(1000U, 120U), @@ -254,6 +255,7 @@ int CYSFGateway::run() } m_startup = m_conf.getNetworkStartup(); + m_options = m_conf.getNetworkOptions(); bool revert = m_conf.getNetworkRevert(); bool wiresXCommandPassthrough = m_conf.getWiresXCommandPassthrough(); @@ -803,6 +805,8 @@ void CYSFGateway::startupLinking() m_linkType = LINK_NONE; bool ok = m_fcsNetwork->writeLink(m_startup); + m_fcsNetwork->setOptions(m_options); + if (ok) { LogMessage("Automatic (re-)connection to %s", m_startup.c_str()); @@ -823,6 +827,8 @@ void CYSFGateway::startupLinking() if (reflector != NULL) { LogMessage("Automatic (re-)connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str()); + m_ysfNetwork->setOptions(m_options); + m_wiresX->setReflector(reflector); m_ysfNetwork->setDestination(reflector->m_name, reflector->m_address, reflector->m_port); From cb155e104dce6656decffb2bd30f68b3029ca452 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:47:41 +0200 Subject: [PATCH 5/8] Update YSFNetwork.h --- YSFGateway/YSFNetwork.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/YSFGateway/YSFNetwork.h b/YSFGateway/YSFNetwork.h index 30bfb39..2f89b69 100644 --- a/YSFGateway/YSFNetwork.h +++ b/YSFGateway/YSFNetwork.h @@ -41,6 +41,7 @@ public: void write(const unsigned char* data); void writePoll(unsigned int count = 1U); + void setOptions(const std::string& options = NULL); void writeUnlink(unsigned int count = 1U); unsigned int read(unsigned char* data); @@ -55,6 +56,7 @@ private: in_addr m_address; unsigned int m_port; unsigned char* m_poll; + unsigned char* m_options; unsigned char* m_unlink; CRingBuffer m_buffer; CTimer m_pollTimer; From ee224039bec1ff9a2419758b01e83214a8f1d4f5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:51:45 +0200 Subject: [PATCH 6/8] Update YSFNetwork.cpp --- YSFGateway/YSFNetwork.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/YSFGateway/YSFNetwork.cpp b/YSFGateway/YSFNetwork.cpp index 91076d1..dad803e 100644 --- a/YSFGateway/YSFNetwork.cpp +++ b/YSFGateway/YSFNetwork.cpp @@ -33,6 +33,7 @@ m_debug(debug), m_address(), m_port(0U), m_poll(NULL), +m_options(NULL), m_unlink(NULL), m_buffer(1000U, "YSF Network Buffer"), m_pollTimer(1000U, 5U), @@ -45,12 +46,16 @@ m_linked(false) m_unlink = new unsigned char[14U]; ::memcpy(m_unlink + 0U, "YSFU", 4U); + m_options = new unsigned char[50U]; + ::memcpy(m_options + 0U, "YSFO", 4U); + std::string node = callsign; node.resize(YSF_CALLSIGN_LENGTH, ' '); for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) { m_poll[i + 4U] = node.at(i); m_unlink[i + 4U] = node.at(i); + m_options[i + 4U] = node.at(i); } } @@ -60,6 +65,7 @@ m_debug(debug), m_address(), m_port(0U), m_poll(NULL), +m_options(NULL), m_unlink(NULL), m_buffer(1000U, "YSF Network Buffer"), m_pollTimer(1000U, 5U) @@ -70,12 +76,16 @@ m_pollTimer(1000U, 5U) m_unlink = new unsigned char[14U]; ::memcpy(m_unlink + 0U, "YSFU", 4U); + m_options = new unsigned char[50U]; + ::memcpy(m_options + 0U, "YSFO", 4U); + std::string node = callsign; node.resize(YSF_CALLSIGN_LENGTH, ' '); for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) { m_poll[i + 4U] = node.at(i); m_unlink[i + 4U] = node.at(i); + m_options[i + 4U] = node.at(i); } } @@ -130,6 +140,23 @@ void CYSFNetwork::writePoll(unsigned int count) for (unsigned int i = 0U; i < count; i++) m_socket.write(m_poll, 14U, m_address, m_port); + + if (m_options != NULL) + m_socket.write(m_options, 50U, m_address, m_port); +} + +void CYSFNetwork::setOptions(const std::string& options) +{ + std::string opt = options; + + if (opt.size() < 1) + return; + + opt.resize(50, ' '); + + for (unsigned int i = 0U; i < (50 - 4 - YSF_CALLSIGN_LENGTH); i++) { + m_options[i + 4U + YSF_CALLSIGN_LENGTH] = opt.at(i); + } } void CYSFNetwork::writeUnlink(unsigned int count) @@ -172,6 +199,9 @@ void CYSFNetwork::clock(unsigned int ms) LogMessage("Linked to %s", m_name.c_str()); m_linked = true; + + if (m_options != NULL) + m_socket.write(m_options, 50U, m_address, m_port); } if (m_debug) From 611fe176403098cb545eccd9822aa3d210880b44 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 5 Sep 2020 22:55:03 +0200 Subject: [PATCH 7/8] Update YSFGateway.ini --- YSFGateway/YSFGateway.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/YSFGateway/YSFGateway.ini b/YSFGateway/YSFGateway.ini index 104909b..c3376c8 100644 --- a/YSFGateway/YSFGateway.ini +++ b/YSFGateway/YSFGateway.ini @@ -39,6 +39,8 @@ Suffix=Y [Network] # Startup=FCS00120 # Startup=Alabama-Link +# book DG-ID for Reflector +# Options=20;21; InactivityTimeout=10 Revert=0 Debug=0 From 4a4e046763e6736ef9af0afea03afebae2aeffd4 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sat, 5 Sep 2020 22:11:32 +0100 Subject: [PATCH 8/8] Small cleanups. --- YSFGateway/Conf.cpp | 6 +++--- YSFReflector/Conf.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/YSFGateway/Conf.cpp b/YSFGateway/Conf.cpp index 50497b7..784132e 100644 --- a/YSFGateway/Conf.cpp +++ b/YSFGateway/Conf.cpp @@ -382,12 +382,12 @@ unsigned int CConf::getLogFileLevel() const std::string CConf::getLogFilePath() const { - return m_logFilePath; + return m_logFilePath; } std::string CConf::getLogFileRoot() const { - return m_logFileRoot; + return m_logFileRoot; } bool CConf::getAPRSEnabled() const @@ -447,7 +447,7 @@ bool CConf::getYSFNetworkEnabled() const unsigned int CConf::getYSFNetworkPort() const { - return m_ysfNetworkPort; + return m_ysfNetworkPort; } std::string CConf::getYSFNetworkHosts() const diff --git a/YSFReflector/Conf.cpp b/YSFReflector/Conf.cpp index 00fb8df..0ed6f01 100644 --- a/YSFReflector/Conf.cpp +++ b/YSFReflector/Conf.cpp @@ -155,12 +155,12 @@ unsigned int CConf::getLogFileLevel() const std::string CConf::getLogFilePath() const { - return m_logFilePath; + return m_logFilePath; } std::string CConf::getLogFileRoot() const { - return m_logFileRoot; + return m_logFileRoot; } unsigned int CConf::getNetworkPort() const