mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2025-08-08 07:12:26 -04:00
Add debugging to the APRS section.
This commit is contained in:
parent
332ca17f26
commit
c186d35695
@ -24,10 +24,10 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port) :
|
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port, bool debug) :
|
||||||
m_enabled(false),
|
|
||||||
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),
|
||||||
@ -123,6 +123,9 @@ void CAPRSWriter::write(const char* data)
|
|||||||
{
|
{
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
|
|
||||||
|
if (m_debug)
|
||||||
|
LogDebug("APRS ==> %s", data);
|
||||||
|
|
||||||
m_aprsSocket.write((unsigned char*)data, (unsigned int)::strlen(data), m_aprsAddress, m_aprsPort);
|
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',
|
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);
|
||||||
|
|
||||||
write(output);
|
write(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAPRSWriter::sendIdFrameMobile()
|
void CAPRSWriter::sendIdFrameMobile()
|
||||||
{
|
{
|
||||||
if (!m_gpsdEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!::gps_waiting(&m_gpsdData, 0))
|
if (!::gps_waiting(&m_gpsdData, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -308,6 +311,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);
|
||||||
|
|
||||||
write(output);
|
write(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
class CAPRSWriter {
|
class CAPRSWriter {
|
||||||
public:
|
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();
|
~CAPRSWriter();
|
||||||
|
|
||||||
bool open();
|
bool open();
|
||||||
@ -58,9 +58,9 @@ public:
|
|||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_enabled;
|
|
||||||
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;
|
||||||
|
@ -47,7 +47,7 @@ m_rptProtocol("Icom"),
|
|||||||
m_rptAddress(),
|
m_rptAddress(),
|
||||||
m_rptPort(0U),
|
m_rptPort(0U),
|
||||||
m_myPort(0U),
|
m_myPort(0U),
|
||||||
m_rptDebug(false),
|
m_debug(false),
|
||||||
m_daemon(false),
|
m_daemon(false),
|
||||||
m_rxFrequency(0U),
|
m_rxFrequency(0U),
|
||||||
m_txFrequency(0U),
|
m_txFrequency(0U),
|
||||||
@ -157,7 +157,7 @@ bool CConf::read()
|
|||||||
else if (::strcmp(key, "LocalPort") == 0)
|
else if (::strcmp(key, "LocalPort") == 0)
|
||||||
m_myPort = (unsigned int)::atoi(value);
|
m_myPort = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
else if (::strcmp(key, "Debug") == 0)
|
||||||
m_rptDebug = ::atoi(value) == 1;
|
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) {
|
||||||
@ -278,9 +278,9 @@ unsigned int CConf::getMyPort() const
|
|||||||
return m_myPort;
|
return m_myPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getRptDebug() const
|
bool CConf::getDebug() const
|
||||||
{
|
{
|
||||||
return m_rptDebug;
|
return m_debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getDaemon() const
|
bool CConf::getDaemon() const
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
std::string getRptAddress() const;
|
std::string getRptAddress() const;
|
||||||
unsigned int getRptPort() const;
|
unsigned int getRptPort() const;
|
||||||
unsigned int getMyPort() const;
|
unsigned int getMyPort() const;
|
||||||
bool getRptDebug() const;
|
bool getDebug() const;
|
||||||
bool getDaemon() const;
|
bool getDaemon() const;
|
||||||
|
|
||||||
// The Info section
|
// The Info section
|
||||||
@ -100,7 +100,7 @@ private:
|
|||||||
std::string m_rptAddress;
|
std::string m_rptAddress;
|
||||||
unsigned int m_rptPort;
|
unsigned int m_rptPort;
|
||||||
unsigned int m_myPort;
|
unsigned int m_myPort;
|
||||||
bool m_rptDebug;
|
bool m_debug;
|
||||||
bool m_daemon;
|
bool m_daemon;
|
||||||
|
|
||||||
unsigned int m_rxFrequency;
|
unsigned int m_rxFrequency;
|
||||||
|
@ -184,9 +184,9 @@ void CNXDNGateway::run()
|
|||||||
std::string protocol = m_conf.getRptProtocol();
|
std::string protocol = m_conf.getRptProtocol();
|
||||||
|
|
||||||
if (protocol == "Kenwood")
|
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
|
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();
|
ret = localNetwork->open();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
@ -594,8 +594,9 @@ void CNXDNGateway::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(callsign, rptSuffix, address, port);
|
m_writer = new CAPRSWriter(callsign, rptSuffix, address, port, 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();
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user