#13 rename APRSWriter -> APRSHandler

pull/32/head
Geoffrey Merck 4 years ago
parent 6fae94217b
commit c56c42d283

@ -25,7 +25,7 @@
#include "StringUtils.h" #include "StringUtils.h"
#include "Log.h" #include "Log.h"
#include "APRSWriter.h" #include "APRSHandler.h"
#include "DStarDefines.h" #include "DStarDefines.h"
#include "Defs.h" #include "Defs.h"
#include "Log.h" #include "Log.h"
@ -34,7 +34,7 @@
#include "APRSFormater.h" #include "APRSFormater.h"
#include "APRSUtils.h" #include "APRSUtils.h"
CAPRSWriter::CAPRSWriter(const std::string& hostname, unsigned int port, const std::string& gateway, const std::string& password, const std::string& address) : CAPRSHandler::CAPRSHandler(const std::string& hostname, unsigned int port, const std::string& gateway, const std::string& password, const std::string& address) :
m_thread(NULL), m_thread(NULL),
m_gateway(), m_gateway(),
m_address(), m_address(),
@ -54,7 +54,7 @@ m_idFrameProvider(nullptr)
boost::trim(m_gateway); boost::trim(m_gateway);
} }
CAPRSWriter::~CAPRSWriter() CAPRSHandler::~CAPRSHandler()
{ {
for(auto it = m_array.begin(); it != m_array.end(); it++) { for(auto it = m_array.begin(); it != m_array.end(); it++) {
delete it->second; delete it->second;
@ -63,7 +63,7 @@ CAPRSWriter::~CAPRSWriter()
m_array.clear(); m_array.clear();
} }
void CAPRSWriter::setPort(const std::string& callsign, const std::string& band, double frequency, double offset, double range, double latitude, double longitude, double agl) void CAPRSHandler::setPort(const std::string& callsign, const std::string& band, double frequency, double offset, double range, double latitude, double longitude, double agl)
{ {
std::string temp = callsign; std::string temp = callsign;
temp.resize(LONG_CALLSIGN_LENGTH - 1U, ' '); temp.resize(LONG_CALLSIGN_LENGTH - 1U, ' ');
@ -72,12 +72,12 @@ void CAPRSWriter::setPort(const std::string& callsign, const std::string& band,
m_array[temp] = new CAPRSEntry(callsign, band, frequency, offset, range, latitude, longitude, agl); m_array[temp] = new CAPRSEntry(callsign, band, frequency, offset, range, latitude, longitude, agl);
} }
bool CAPRSWriter::open() bool CAPRSHandler::open()
{ {
return m_thread->start(); return m_thread->start();
} }
void CAPRSWriter::writeHeader(const std::string& callsign, const CHeaderData& header) void CAPRSHandler::writeHeader(const std::string& callsign, const CHeaderData& header)
{ {
CAPRSEntry* entry = m_array[callsign]; CAPRSEntry* entry = m_array[callsign];
if (entry == NULL) { if (entry == NULL) {
@ -92,7 +92,7 @@ void CAPRSWriter::writeHeader(const std::string& callsign, const CHeaderData& he
collector->writeHeader(header.getMyCall1()); collector->writeHeader(header.getMyCall1());
} }
void CAPRSWriter::writeData(const std::string& callsign, const CAMBEData& data) void CAPRSHandler::writeData(const std::string& callsign, const CAMBEData& data)
{ {
if (data.isEnd()) if (data.isEnd())
return; return;
@ -156,7 +156,7 @@ void CAPRSWriter::writeData(const std::string& callsign, const CAMBEData& data)
collector->reset(); collector->reset();
} }
void CAPRSWriter::writeStatus(const std::string& callsign, const std::string status) void CAPRSHandler::writeStatus(const std::string& callsign, const std::string status)
{ {
CAPRSEntry* entry = m_array[callsign]; CAPRSEntry* entry = m_array[callsign];
if (entry == NULL) { if (entry == NULL) {
@ -167,7 +167,7 @@ void CAPRSWriter::writeStatus(const std::string& callsign, const std::string sta
entry->getStatus().setStatus(status); entry->getStatus().setStatus(status);
} }
void CAPRSWriter::clock(unsigned int ms) void CAPRSHandler::clock(unsigned int ms)
{ {
m_thread->clock(ms); m_thread->clock(ms);
@ -187,7 +187,7 @@ void CAPRSWriter::clock(unsigned int ms)
} }
} }
void CAPRSWriter::sendStatusFrame(CAPRSEntry * entry) void CAPRSHandler::sendStatusFrame(CAPRSEntry * entry)
{ {
assert(entry != nullptr); assert(entry != nullptr);
@ -213,7 +213,7 @@ void CAPRSWriter::sendStatusFrame(CAPRSEntry * entry)
} }
void CAPRSWriter::sendIdFrames() void CAPRSHandler::sendIdFrames()
{ {
if(m_thread->isConnected()) if(m_thread->isConnected())
{ {
@ -229,12 +229,12 @@ void CAPRSWriter::sendIdFrames()
} }
} }
bool CAPRSWriter::isConnected() const bool CAPRSHandler::isConnected() const
{ {
return m_thread->isConnected(); return m_thread->isConnected();
} }
void CAPRSWriter::close() void CAPRSHandler::close()
{ {
if(m_idFrameProvider != nullptr) { if(m_idFrameProvider != nullptr) {
m_idFrameProvider->close(); m_idFrameProvider->close();

@ -17,8 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef APRSWriter_H #pragma once
#define APRSWriter_H
#include "Defs.h" #include "Defs.h"
@ -36,10 +35,10 @@
#include "Timer.h" #include "Timer.h"
#include "APRSIdFrameProvider.h" #include "APRSIdFrameProvider.h"
class CAPRSWriter { class CAPRSHandler {
public: public:
CAPRSWriter(const std::string& hostname, unsigned int port, const std::string& gateway, const std::string& password, const std::string& address); CAPRSHandler(const std::string& hostname, unsigned int port, const std::string& gateway, const std::string& password, const std::string& address);
~CAPRSWriter(); ~CAPRSHandler();
bool open(); bool open();
@ -71,5 +70,3 @@ private:
void sendStatusFrame(CAPRSEntry * entrry); void sendStatusFrame(CAPRSEntry * entrry);
}; };
#endif

@ -133,9 +133,9 @@ bool CDStarGatewayApp::createThread()
// Setup APRS // Setup APRS
TAPRS aprsConfig; TAPRS aprsConfig;
config.getAPRS(aprsConfig); config.getAPRS(aprsConfig);
CAPRSWriter * aprsWriter = NULL; CAPRSHandler * aprsWriter = NULL;
if(aprsConfig.enabled && !aprsConfig.password.empty()) { if(aprsConfig.enabled && !aprsConfig.password.empty()) {
aprsWriter = new CAPRSWriter(aprsConfig.hostname, aprsConfig.port, gatewayConfig.callsign, aprsConfig.password, gatewayConfig.address); aprsWriter = new CAPRSHandler(aprsConfig.hostname, aprsConfig.port, gatewayConfig.callsign, aprsConfig.password, gatewayConfig.address);
if(aprsWriter->open()) { if(aprsWriter->open()) {
#ifdef USE_GPSD #ifdef USE_GPSD
CAPRSIdFrameProvider * idFrameProvider = aprsConfig.m_positionSource == POSSRC_GPSD ? (CAPRSIdFrameProvider *)new CAPRSGPSDIdFrameProvider(gpsdConfig.m_address, gpsdConfig.m_port) CAPRSIdFrameProvider * idFrameProvider = aprsConfig.m_positionSource == POSSRC_GPSD ? (CAPRSIdFrameProvider *)new CAPRSGPSDIdFrameProvider(gpsdConfig.m_address, gpsdConfig.m_port)

@ -638,7 +638,7 @@ void CDStarGatewayThread::setLog(bool enabled)
m_logEnabled = enabled; m_logEnabled = enabled;
} }
void CDStarGatewayThread::setAPRSWriter(CAPRSWriter* writer) void CDStarGatewayThread::setAPRSWriter(CAPRSHandler* writer)
{ {
m_aprsWriter = writer; m_aprsWriter = writer;
} }

@ -32,7 +32,7 @@
#include "RemoteHandler.h" #include "RemoteHandler.h"
#include "CacheManager.h" #include "CacheManager.h"
#include "CallsignList.h" #include "CallsignList.h"
#include "APRSWriter.h" #include "APRSHandler.h"
#include "IRCDDB.h" #include "IRCDDB.h"
#include "Timer.h" #include "Timer.h"
#include "Defs.h" #include "Defs.h"
@ -72,7 +72,7 @@ virtual void addRepeater(const std::string& callsign, const std::string& band, c
virtual void setCCS(bool enabled, const std::string& host); virtual void setCCS(bool enabled, const std::string& host);
#endif #endif
virtual void setLog(bool enabled); virtual void setLog(bool enabled);
virtual void setAPRSWriter(CAPRSWriter* writer); virtual void setAPRSWriter(CAPRSHandler* writer);
virtual void setInfoEnabled(bool enabled); virtual void setInfoEnabled(bool enabled);
virtual void setEchoEnabled(bool enabled); virtual void setEchoEnabled(bool enabled);
virtual void setDTMFEnabled(bool enabled); virtual void setDTMFEnabled(bool enabled);
@ -109,7 +109,7 @@ private:
#if defined(ENABLE_NAT_TRAVERSAL) #if defined(ENABLE_NAT_TRAVERSAL)
CNatTraversalHandler* m_natTraversal; CNatTraversalHandler* m_natTraversal;
#endif #endif
CAPRSWriter* m_aprsWriter; CAPRSHandler* m_aprsWriter;
CIRCDDB* m_irc; CIRCDDB* m_irc;
CCacheManager m_cache; CCacheManager m_cache;
TEXT_LANG m_language; TEXT_LANG m_language;

@ -59,7 +59,7 @@ bool CRepeaterHandler::m_dtmfEnabled = true;
CHeaderLogger* CRepeaterHandler::m_headerLogger = NULL; CHeaderLogger* CRepeaterHandler::m_headerLogger = NULL;
CAPRSWriter* CRepeaterHandler::m_aprsWriter = NULL; CAPRSHandler* CRepeaterHandler::m_aprsWriter = NULL;
CCallsignList* CRepeaterHandler::m_restrictList = NULL; CCallsignList* CRepeaterHandler::m_restrictList = NULL;
@ -366,7 +366,7 @@ void CRepeaterHandler::setHeaderLogger(CHeaderLogger* logger)
m_headerLogger = logger; m_headerLogger = logger;
} }
void CRepeaterHandler::setAPRSWriter(CAPRSWriter* writer) void CRepeaterHandler::setAPRSWriter(CAPRSHandler* writer)
{ {
m_aprsWriter = writer; m_aprsWriter = writer;
} }

@ -48,7 +48,7 @@
#include "CCSHandler.h" #include "CCSHandler.h"
#endif #endif
#include "StatusData.h" #include "StatusData.h"
#include "APRSWriter.h" #include "APRSHandler.h"
#include "HeardData.h" #include "HeardData.h"
#include "AudioUnit.h" #include "AudioUnit.h"
#include "EchoUnit.h" #include "EchoUnit.h"
@ -82,7 +82,7 @@ public:
static void setDPlusEnabled(bool enabled); static void setDPlusEnabled(bool enabled);
static void setDCSEnabled(bool enabled); static void setDCSEnabled(bool enabled);
static void setHeaderLogger(CHeaderLogger* logger); static void setHeaderLogger(CHeaderLogger* logger);
static void setAPRSWriter(CAPRSWriter* writer); static void setAPRSWriter(CAPRSHandler* writer);
static void setInfoEnabled(bool enabled); static void setInfoEnabled(bool enabled);
static void setEchoEnabled(bool enabled); static void setEchoEnabled(bool enabled);
static void setDTMFEnabled(bool enabled); static void setDTMFEnabled(bool enabled);
@ -178,7 +178,7 @@ private:
static CHeaderLogger* m_headerLogger; static CHeaderLogger* m_headerLogger;
static CAPRSWriter* m_aprsWriter; static CAPRSHandler* m_aprsWriter;
static CCallsignList* m_whiteList; static CCallsignList* m_whiteList;
static CCallsignList* m_blackList; static CCallsignList* m_blackList;

Loading…
Cancel
Save

Powered by TurnKey Linux.