From c512e2894a2afde1147edcb0e012d185e6b8e260 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Thu, 6 Jan 2022 08:26:38 +0100 Subject: [PATCH] #12 Rename APRSWriterThread -> APRSHandlerThread --- APRSHandler.cpp | 2 +- APRSHandler.h | 4 +-- APRSWriterThread.cpp => APRSHandlerThread.cpp | 26 +++++++++---------- APRSWriterThread.h => APRSHandlerThread.h | 8 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) rename APRSWriterThread.cpp => APRSHandlerThread.cpp (88%) rename APRSWriterThread.h => APRSHandlerThread.h (79%) diff --git a/APRSHandler.cpp b/APRSHandler.cpp index c36e470..9dcc2b3 100644 --- a/APRSHandler.cpp +++ b/APRSHandler.cpp @@ -47,7 +47,7 @@ m_idFrameProvider(nullptr) assert(!gateway.empty()); assert(!password.empty()); - m_thread = new CAPRSWriterThread(gateway, password, address, hostname, port); + m_thread = new CAPRSHandlerThread(gateway, password, address, hostname, port); m_gateway = gateway; m_gateway = m_gateway.substr(0, LONG_CALLSIGN_LENGTH - 1U); diff --git a/APRSHandler.h b/APRSHandler.h index 9cfa671..bd5ff4e 100644 --- a/APRSHandler.h +++ b/APRSHandler.h @@ -26,7 +26,7 @@ #include "APRSEntry.h" -#include "APRSWriterThread.h" +#include "APRSHandlerThread.h" #include "UDPReaderWriter.h" #include "APRSCollector.h" #include "DStarDefines.h" @@ -59,7 +59,7 @@ class CAPRSHandler { void close(); private: - CAPRSWriterThread* m_thread; + CAPRSHandlerThread* m_thread; std::string m_gateway; in_addr m_address; unsigned int m_port; diff --git a/APRSWriterThread.cpp b/APRSHandlerThread.cpp similarity index 88% rename from APRSWriterThread.cpp rename to APRSHandlerThread.cpp index 6b39111..aa1438b 100644 --- a/APRSWriterThread.cpp +++ b/APRSHandlerThread.cpp @@ -21,7 +21,7 @@ #include #include -#include "APRSWriterThread.h" +#include "APRSHandlerThread.h" #include "DStarDefines.h" #include "Utils.h" #include "Defs.h" @@ -34,7 +34,7 @@ const unsigned int APRS_TIMEOUT = 10U; -CAPRSWriterThread::CAPRSWriterThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port) : +CAPRSHandlerThread::CAPRSHandlerThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port) : CThread(), m_username(callsign), m_password(password), @@ -61,7 +61,7 @@ m_clientName(FULL_PRODUCT_NAME) m_ssid = m_ssid.substr(LONG_CALLSIGN_LENGTH - 1U, 1); } -CAPRSWriterThread::CAPRSWriterThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port, const std::string& filter, const std::string& clientName) : +CAPRSHandlerThread::CAPRSHandlerThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port, const std::string& filter, const std::string& clientName) : CThread(), m_username(callsign), m_password(password), @@ -88,7 +88,7 @@ m_clientName(clientName) m_ssid = m_ssid.substr(LONG_CALLSIGN_LENGTH - 1U, 1); } -CAPRSWriterThread::~CAPRSWriterThread() +CAPRSHandlerThread::~CAPRSHandlerThread() { std::vector callBacksCopy; callBacksCopy.assign(m_APRSReadCallbacks.begin(), m_APRSReadCallbacks.end()); @@ -105,7 +105,7 @@ CAPRSWriterThread::~CAPRSWriterThread() m_password.clear(); } -bool CAPRSWriterThread::start() +bool CAPRSHandlerThread::start() { Create(); Run(); @@ -113,7 +113,7 @@ bool CAPRSWriterThread::start() return true; } -void* CAPRSWriterThread::Entry() +void* CAPRSHandlerThread::Entry() { CLog::logInfo("Starting the APRS Writer thread"); @@ -207,13 +207,13 @@ void* CAPRSWriterThread::Entry() return NULL; } -void CAPRSWriterThread::addReadAPRSCallback(CReadAPRSFrameCallback * cb) +void CAPRSHandlerThread::addReadAPRSCallback(CReadAPRSFrameCallback * cb) { assert(cb != nullptr); m_APRSReadCallbacks.push_back(cb); } -void CAPRSWriterThread::write(CAPRSFrame& frame) +void CAPRSHandlerThread::write(CAPRSFrame& frame) { if (!m_connected) return; @@ -228,24 +228,24 @@ void CAPRSWriterThread::write(CAPRSFrame& frame) } } -bool CAPRSWriterThread::isConnected() const +bool CAPRSHandlerThread::isConnected() const { return m_connected; } -void CAPRSWriterThread::stop() +void CAPRSHandlerThread::stop() { m_exit = true; Wait(); } -void CAPRSWriterThread::clock(unsigned int ms) +void CAPRSHandlerThread::clock(unsigned int ms) { m_reconnectTimer.clock(ms); } -bool CAPRSWriterThread::connect() +bool CAPRSHandlerThread::connect() { bool ret = m_socket.open(); if (!ret) @@ -295,7 +295,7 @@ bool CAPRSWriterThread::connect() return true; } -void CAPRSWriterThread::startReconnectionTimer() +void CAPRSHandlerThread::startReconnectionTimer() { // Clamp at a ten minutes reconnect time m_tries++; diff --git a/APRSWriterThread.h b/APRSHandlerThread.h similarity index 79% rename from APRSWriterThread.h rename to APRSHandlerThread.h index e76b20f..a483b41 100644 --- a/APRSWriterThread.h +++ b/APRSHandlerThread.h @@ -29,11 +29,11 @@ #include "APRSFrame.h" -class CAPRSWriterThread : public CThread { +class CAPRSHandlerThread : public CThread { public: - CAPRSWriterThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port); - CAPRSWriterThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port, const std::string& filter, const std::string& clientName); - virtual ~CAPRSWriterThread(); + CAPRSHandlerThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port); + CAPRSHandlerThread(const std::string& callsign, const std::string& password, const std::string& address, const std::string& hostname, unsigned int port, const std::string& filter, const std::string& clientName); + virtual ~CAPRSHandlerThread(); bool start();