Add debugging to APRS.

This commit is contained in:
Jonathan Naylor 2020-06-05 09:27:03 +01:00
parent 83d8e290cc
commit 0e41513538
7 changed files with 27 additions and 7 deletions

View file

@ -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);
}