1
0
Fork 0

Add debugging to APRS.

ycs232-kbc
Jonathan Naylor 4 years ago
parent 83d8e290cc
commit 0e41513538

@ -25,9 +25,10 @@
#include <cstring>
#include <cmath>
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& rptSuffix, const std::string& address, unsigned int port, const std::string& suffix) :
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& rptSuffix, const std::string& address, unsigned int port, const std::string& suffix, bool debug) :
m_idTimer(1000U),
m_callsign(callsign),
m_debug(debug),
m_txFrequency(0U),
m_rxFrequency(0U),
m_latitude(0.0F),
@ -178,6 +179,9 @@ void CAPRSWriter::write(const unsigned char* source, const char* type, unsigned
lon, (fLongitude < 0.0F) ? 'W' : 'E',
symbol, type);
if (m_debug)
LogDebug("APRS ==> %s", output);
m_aprsSocket.write((unsigned char*)output, (unsigned int)::strlen(output), m_aprsAddress, m_aprsPort);
}
@ -273,14 +277,14 @@ void CAPRSWriter::sendIdFrameFixed()
lon, (m_longitude < 0.0F) ? 'W' : 'E',
float(m_height) * 3.28F, band, desc);
if (m_debug)
LogDebug("APRS ==> %s", output);
m_aprsSocket.write((unsigned char*)output, (unsigned int)::strlen(output), m_aprsAddress, m_aprsPort);
}
void CAPRSWriter::sendIdFrameMobile()
{
if (!m_gpsdEnabled)
return;
if (!::gps_waiting(&m_gpsdData, 0))
return;
@ -363,6 +367,9 @@ void CAPRSWriter::sendIdFrameMobile()
::sprintf(output + ::strlen(output), "%s %s\r\n", band, desc);
if (m_debug)
LogDebug("APRS ==> %s", output);
m_aprsSocket.write((unsigned char*)output, (unsigned int)::strlen(output), m_aprsAddress, m_aprsPort);
}

@ -40,7 +40,7 @@
class CAPRSWriter {
public:
CAPRSWriter(const std::string& callsign, const std::string& rptSuffix, const std::string& address, unsigned int port, const std::string& suffix);
CAPRSWriter(const std::string& callsign, const std::string& rptSuffix, const std::string& address, unsigned int port, const std::string& suffix, bool debug);
~CAPRSWriter();
bool open();
@ -60,6 +60,7 @@ public:
private:
CTimer m_idTimer;
std::string m_callsign;
bool m_debug;
unsigned int m_txFrequency;
unsigned int m_rxFrequency;
float m_latitude;

@ -50,6 +50,7 @@ m_myAddress(),
m_myPort(0U),
m_wiresXMakeUpper(true),
m_wiresXCommandPassthrough(false),
m_debug(false),
m_daemon(false),
m_rxFrequency(0U),
m_txFrequency(0U),
@ -169,6 +170,8 @@ bool CConf::read()
m_wiresXMakeUpper = ::atoi(value) == 1;
else if (::strcmp(key, "WiresXCommandPassthrough") == 0)
m_wiresXCommandPassthrough = ::atoi(value) == 1;
else if (::strcmp(key, "Debug") == 0)
m_debug = ::atoi(value) == 1;
else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1;
} else if (section == SECTION_INFO) {
@ -314,6 +317,11 @@ bool CConf::getWiresXCommandPassthrough() const
return m_wiresXCommandPassthrough;
}
bool CConf::getDebug() const
{
return m_debug;
}
bool CConf::getDaemon() const
{
return m_daemon;

@ -39,6 +39,7 @@ public:
unsigned int getMyPort() const;
bool getWiresXMakeUpper() const;
bool getWiresXCommandPassthrough() const;
bool getDebug() const;
bool getDaemon() const;
// The Info section
@ -109,6 +110,7 @@ private:
unsigned int m_myPort;
bool m_wiresXMakeUpper;
bool m_wiresXCommandPassthrough;
bool m_debug;
bool m_daemon;
unsigned int m_rxFrequency;

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200604";
const char* VERSION = "20200605";
#endif

@ -457,8 +457,9 @@ void CYSFGateway::createGPS()
std::string address = m_conf.getAPRSAddress();
unsigned int port = m_conf.getAPRSPort();
std::string suffix = m_conf.getAPRSSuffix();
bool debug = m_conf.getDebug();
m_writer = new CAPRSWriter(m_callsign, m_suffix, address, port, suffix);
m_writer = new CAPRSWriter(m_callsign, m_suffix, address, port, suffix, debug);
unsigned int txFrequency = m_conf.getTxFrequency();
unsigned int rxFrequency = m_conf.getRxFrequency();

@ -9,6 +9,7 @@ LocalAddress=127.0.0.1
LocalPort=4200
WiresXMakeUpper=1
WiresXCommandPassthrough=0
Debug=0
Daemon=0
[Info]

Loading…
Cancel
Save