mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2025-02-03 09:44:25 -05:00
Add debugging to the APRS section.
This commit is contained in:
parent
332ca17f26
commit
c186d35695
@ -24,10 +24,10 @@
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port) :
|
||||
m_enabled(false),
|
||||
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port, bool debug) :
|
||||
m_idTimer(1000U),
|
||||
m_callsign(callsign),
|
||||
m_debug(debug),
|
||||
m_txFrequency(0U),
|
||||
m_rxFrequency(0U),
|
||||
m_latitude(0.0F),
|
||||
@ -123,6 +123,9 @@ void CAPRSWriter::write(const char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
if (m_debug)
|
||||
LogDebug("APRS ==> %s", data);
|
||||
|
||||
m_aprsSocket.write((unsigned char*)data, (unsigned int)::strlen(data), m_aprsAddress, m_aprsPort);
|
||||
}
|
||||
|
||||
@ -218,14 +221,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);
|
||||
|
||||
write(output);
|
||||
}
|
||||
|
||||
void CAPRSWriter::sendIdFrameMobile()
|
||||
{
|
||||
if (!m_gpsdEnabled)
|
||||
return;
|
||||
|
||||
if (!::gps_waiting(&m_gpsdData, 0))
|
||||
return;
|
||||
|
||||
@ -308,6 +311,9 @@ void CAPRSWriter::sendIdFrameMobile()
|
||||
|
||||
::sprintf(output + ::strlen(output), "%s %s\r\n", band, desc);
|
||||
|
||||
if (m_debug)
|
||||
LogDebug("APRS ==> %s", output);
|
||||
|
||||
write(output);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
class CAPRSWriter {
|
||||
public:
|
||||
CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port);
|
||||
CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port, bool debug);
|
||||
~CAPRSWriter();
|
||||
|
||||
bool open();
|
||||
@ -58,9 +58,9 @@ public:
|
||||
void close();
|
||||
|
||||
private:
|
||||
bool m_enabled;
|
||||
CTimer m_idTimer;
|
||||
std::string m_callsign;
|
||||
bool m_debug;
|
||||
unsigned int m_txFrequency;
|
||||
unsigned int m_rxFrequency;
|
||||
float m_latitude;
|
||||
|
@ -47,7 +47,7 @@ m_rptProtocol("Icom"),
|
||||
m_rptAddress(),
|
||||
m_rptPort(0U),
|
||||
m_myPort(0U),
|
||||
m_rptDebug(false),
|
||||
m_debug(false),
|
||||
m_daemon(false),
|
||||
m_rxFrequency(0U),
|
||||
m_txFrequency(0U),
|
||||
@ -157,7 +157,7 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "LocalPort") == 0)
|
||||
m_myPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Debug") == 0)
|
||||
m_rptDebug = ::atoi(value) == 1;
|
||||
m_debug = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Daemon") == 0)
|
||||
m_daemon = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_INFO) {
|
||||
@ -278,9 +278,9 @@ unsigned int CConf::getMyPort() const
|
||||
return m_myPort;
|
||||
}
|
||||
|
||||
bool CConf::getRptDebug() const
|
||||
bool CConf::getDebug() const
|
||||
{
|
||||
return m_rptDebug;
|
||||
return m_debug;
|
||||
}
|
||||
|
||||
bool CConf::getDaemon() const
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
std::string getRptAddress() const;
|
||||
unsigned int getRptPort() const;
|
||||
unsigned int getMyPort() const;
|
||||
bool getRptDebug() const;
|
||||
bool getDebug() const;
|
||||
bool getDaemon() const;
|
||||
|
||||
// The Info section
|
||||
@ -100,7 +100,7 @@ private:
|
||||
std::string m_rptAddress;
|
||||
unsigned int m_rptPort;
|
||||
unsigned int m_myPort;
|
||||
bool m_rptDebug;
|
||||
bool m_debug;
|
||||
bool m_daemon;
|
||||
|
||||
unsigned int m_rxFrequency;
|
||||
|
@ -184,9 +184,9 @@ void CNXDNGateway::run()
|
||||
std::string protocol = m_conf.getRptProtocol();
|
||||
|
||||
if (protocol == "Kenwood")
|
||||
localNetwork = new CKenwoodNetwork(m_conf.getMyPort(), m_conf.getRptAddress(), m_conf.getRptPort(), m_conf.getRptDebug());
|
||||
localNetwork = new CKenwoodNetwork(m_conf.getMyPort(), m_conf.getRptAddress(), m_conf.getRptPort(), m_conf.getDebug());
|
||||
else
|
||||
localNetwork = new CIcomNetwork(m_conf.getMyPort(), m_conf.getRptAddress(), m_conf.getRptPort(), m_conf.getRptDebug());
|
||||
localNetwork = new CIcomNetwork(m_conf.getMyPort(), m_conf.getRptAddress(), m_conf.getRptPort(), m_conf.getDebug());
|
||||
|
||||
ret = localNetwork->open();
|
||||
if (!ret) {
|
||||
@ -594,8 +594,9 @@ void CNXDNGateway::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(callsign, rptSuffix, address, port);
|
||||
m_writer = new CAPRSWriter(callsign, rptSuffix, address, port, debug);
|
||||
|
||||
unsigned int txFrequency = m_conf.getTxFrequency();
|
||||
unsigned int rxFrequency = m_conf.getRxFrequency();
|
||||
|
@ -19,6 +19,6 @@
|
||||
#if !defined(VERSION_H)
|
||||
#define VERSION_H
|
||||
|
||||
const char* VERSION = "20200604";
|
||||
const char* VERSION = "20200605";
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user