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 <cstring>
#include <cmath> #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_idTimer(1000U),
m_callsign(callsign), m_callsign(callsign),
m_debug(debug),
m_txFrequency(0U), m_txFrequency(0U),
m_rxFrequency(0U), m_rxFrequency(0U),
m_latitude(0.0F), 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', lon, (fLongitude < 0.0F) ? 'W' : 'E',
symbol, type); symbol, type);
if (m_debug)
LogDebug("APRS ==> %s", output);
m_aprsSocket.write((unsigned char*)output, (unsigned int)::strlen(output), m_aprsAddress, m_aprsPort); 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', lon, (m_longitude < 0.0F) ? 'W' : 'E',
float(m_height) * 3.28F, band, desc); 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); m_aprsSocket.write((unsigned char*)output, (unsigned int)::strlen(output), m_aprsAddress, m_aprsPort);
} }
void CAPRSWriter::sendIdFrameMobile() void CAPRSWriter::sendIdFrameMobile()
{ {
if (!m_gpsdEnabled)
return;
if (!::gps_waiting(&m_gpsdData, 0)) if (!::gps_waiting(&m_gpsdData, 0))
return; return;
@ -363,6 +367,9 @@ void CAPRSWriter::sendIdFrameMobile()
::sprintf(output + ::strlen(output), "%s %s\r\n", band, desc); ::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); m_aprsSocket.write((unsigned char*)output, (unsigned int)::strlen(output), m_aprsAddress, m_aprsPort);
} }

@ -40,7 +40,7 @@
class CAPRSWriter { class CAPRSWriter {
public: 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(); ~CAPRSWriter();
bool open(); bool open();
@ -60,6 +60,7 @@ public:
private: private:
CTimer m_idTimer; CTimer m_idTimer;
std::string m_callsign; std::string m_callsign;
bool m_debug;
unsigned int m_txFrequency; unsigned int m_txFrequency;
unsigned int m_rxFrequency; unsigned int m_rxFrequency;
float m_latitude; float m_latitude;

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

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

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

@ -457,8 +457,9 @@ void CYSFGateway::createGPS()
std::string address = m_conf.getAPRSAddress(); std::string address = m_conf.getAPRSAddress();
unsigned int port = m_conf.getAPRSPort(); unsigned int port = m_conf.getAPRSPort();
std::string suffix = m_conf.getAPRSSuffix(); 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 txFrequency = m_conf.getTxFrequency();
unsigned int rxFrequency = m_conf.getRxFrequency(); unsigned int rxFrequency = m_conf.getRxFrequency();

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

Loading…
Cancel
Save