Skip to content

Commit

Permalink
#12 Rename APRSWriterThread -> APRSHandlerThread
Browse files Browse the repository at this point in the history
  • Loading branch information
F4FXL committed Jan 6, 2022
1 parent a969590 commit c512e28
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion APRSHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions APRSHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


#include "APRSEntry.h"
#include "APRSWriterThread.h"
#include "APRSHandlerThread.h"
#include "UDPReaderWriter.h"
#include "APRSCollector.h"
#include "DStarDefines.h"
Expand Down Expand Up @@ -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;
Expand Down
26 changes: 13 additions & 13 deletions APRSWriterThread.cpp → APRSHandlerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <iostream>
#include <boost/algorithm/string.hpp>

#include "APRSWriterThread.h"
#include "APRSHandlerThread.h"
#include "DStarDefines.h"
#include "Utils.h"
#include "Defs.h"
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -88,7 +88,7 @@ m_clientName(clientName)
m_ssid = m_ssid.substr(LONG_CALLSIGN_LENGTH - 1U, 1);
}

CAPRSWriterThread::~CAPRSWriterThread()
CAPRSHandlerThread::~CAPRSHandlerThread()
{
std::vector<CReadAPRSFrameCallback *> callBacksCopy;
callBacksCopy.assign(m_APRSReadCallbacks.begin(), m_APRSReadCallbacks.end());
Expand All @@ -105,15 +105,15 @@ CAPRSWriterThread::~CAPRSWriterThread()
m_password.clear();
}

bool CAPRSWriterThread::start()
bool CAPRSHandlerThread::start()
{
Create();
Run();

return true;
}

void* CAPRSWriterThread::Entry()
void* CAPRSHandlerThread::Entry()
{
CLog::logInfo("Starting the APRS Writer thread");

Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -295,7 +295,7 @@ bool CAPRSWriterThread::connect()
return true;
}

void CAPRSWriterThread::startReconnectionTimer()
void CAPRSHandlerThread::startReconnectionTimer()
{
// Clamp at a ten minutes reconnect time
m_tries++;
Expand Down
8 changes: 4 additions & 4 deletions APRSWriterThread.h → APRSHandlerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit c512e28

Please sign in to comment.