From 5818e8ad6a293adc169fefdc35d396e80b9da64d Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 13 Jun 2016 23:45:08 +0100 Subject: [PATCH] Fix more APRS bugs. --- YSFGateway/APRSWriterThread.cpp | 8 +------- YSFGateway/APRSWriterThread.h | 1 - YSFGateway/Conf.cpp | 10 +++++----- YSFGateway/Conf.h | 4 ++-- YSFGateway/YSFGateway.cpp | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/YSFGateway/APRSWriterThread.cpp b/YSFGateway/APRSWriterThread.cpp index 46e904a..b028a6f 100644 --- a/YSFGateway/APRSWriterThread.cpp +++ b/YSFGateway/APRSWriterThread.cpp @@ -37,7 +37,6 @@ CAPRSWriterThread::CAPRSWriterThread(const std::string& callsign, const std::str CThread(), m_username(callsign), m_password(password), -m_ssid(callsign), m_socket(address, port), m_queue(20U, "APRS Queue"), m_exit(false), @@ -54,15 +53,12 @@ m_clientName("YSFGateway") m_username.resize(CALLSIGN_LENGTH, ' '); m_username.erase(std::find_if(m_username.rbegin(), m_username.rend(), std::not1(std::ptr_fun(std::isspace))).base(), m_username.end()); std::transform(m_username.begin(), m_username.end(), m_username.begin(), ::toupper); - - m_ssid = m_ssid.substr(CALLSIGN_LENGTH - 1U, 1); } CAPRSWriterThread::CAPRSWriterThread(const std::string& callsign, const std::string& password, const std::string& address, unsigned int port, const std::string& filter, const std::string& clientName) : CThread(), m_username(callsign), m_password(password), -m_ssid(callsign), m_socket(address, port), m_queue(20U, "APRS Queue"), m_exit(false), @@ -79,8 +75,6 @@ m_clientName(clientName) m_username.resize(CALLSIGN_LENGTH, ' '); m_username.erase(std::find_if(m_username.rbegin(), m_username.rend(), std::not1(std::ptr_fun(std::isspace))).base(), m_username.end()); std::transform(m_username.begin(), m_username.end(), m_username.begin(), ::toupper); - - m_ssid = m_ssid.substr(CALLSIGN_LENGTH - 1U, 1); } CAPRSWriterThread::~CAPRSWriterThread() @@ -225,7 +219,7 @@ bool CAPRSWriterThread::connect() filter.insert(0U, " filter "); char connectString[200U]; - ::sprintf(connectString, "user %s-%s pass %s vers %s%s\n", m_username.c_str(), m_ssid.c_str(), m_password.c_str(), (m_clientName.length() ? m_clientName : "YSFGateway").c_str(), filter.c_str()); + ::sprintf(connectString, "user %s pass %s vers %s%s\n", m_username.c_str(), m_password.c_str(), (m_clientName.length() ? m_clientName : "YSFGateway").c_str(), filter.c_str()); ret = m_socket.writeLine(std::string(connectString)); if (!ret) { diff --git a/YSFGateway/APRSWriterThread.h b/YSFGateway/APRSWriterThread.h index a064ecc..42bfd67 100644 --- a/YSFGateway/APRSWriterThread.h +++ b/YSFGateway/APRSWriterThread.h @@ -48,7 +48,6 @@ public: private: std::string m_username; std::string m_password; - std::string m_ssid; CTCPSocket m_socket; CRingBuffer m_queue; bool m_exit; diff --git a/YSFGateway/Conf.cpp b/YSFGateway/Conf.cpp index e148706..d94a195 100644 --- a/YSFGateway/Conf.cpp +++ b/YSFGateway/Conf.cpp @@ -57,7 +57,7 @@ m_logFileLevel(0U), m_logFilePath(), m_logFileRoot(), m_aprsEnabled(false), -m_aprsHostname(), +m_aprsServer(), m_aprsPort(0U), m_aprsPassword(), m_networkEnabled(false), @@ -159,8 +159,8 @@ bool CConf::read() } else if (section == SECTION_APRS_FI) { if (::strcmp(key, "Enable") == 0) m_aprsEnabled = ::atoi(value) == 1; - else if (::strcmp(key, "Hostname") == 0) - m_aprsHostname = value; + else if (::strcmp(key, "Server") == 0) + m_aprsServer = value; else if (::strcmp(key, "Port") == 0) m_aprsPort = (unsigned int)::atoi(value); else if (::strcmp(key, "Password") == 0) @@ -284,9 +284,9 @@ bool CConf::getAPRSEnabled() const return m_aprsEnabled; } -std::string CConf::getAPRSHostname() const +std::string CConf::getAPRSServer() const { - return m_aprsHostname; + return m_aprsServer; } unsigned int CConf::getAPRSPort() const diff --git a/YSFGateway/Conf.h b/YSFGateway/Conf.h index 7dc0963..9457aa9 100644 --- a/YSFGateway/Conf.h +++ b/YSFGateway/Conf.h @@ -57,7 +57,7 @@ public: // The aprs.fi section bool getAPRSEnabled() const; - std::string getAPRSHostname() const; + std::string getAPRSServer() const; unsigned int getAPRSPort() const; std::string getAPRSPassword() const; @@ -93,7 +93,7 @@ private: std::string m_logFileRoot; bool m_aprsEnabled; - std::string m_aprsHostname; + std::string m_aprsServer; unsigned int m_aprsPort; std::string m_aprsPassword; diff --git a/YSFGateway/YSFGateway.cpp b/YSFGateway/YSFGateway.cpp index 311a752..d9f625c 100644 --- a/YSFGateway/YSFGateway.cpp +++ b/YSFGateway/YSFGateway.cpp @@ -314,7 +314,7 @@ void CYSFGateway::createGPS() if (!m_conf.getAPRSEnabled()) return; - std::string hostname = m_conf.getAPRSHostname(); + std::string hostname = m_conf.getAPRSServer(); unsigned int port = m_conf.getAPRSPort(); std::string password = m_conf.getAPRSPassword();