mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2024-11-22 15:28:36 -05:00
Allow a user definable callsign suffix.
This commit is contained in:
parent
1e117587eb
commit
18dc3f5e5c
@ -65,6 +65,7 @@ m_aprsEnabled(false),
|
||||
m_aprsServer(),
|
||||
m_aprsPort(0U),
|
||||
m_aprsPassword(),
|
||||
m_aprsSuffix(),
|
||||
m_aprsDescription(),
|
||||
m_networkPort(0U),
|
||||
m_networkHosts(),
|
||||
@ -188,6 +189,8 @@ bool CConf::read()
|
||||
m_aprsPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_aprsPassword = value;
|
||||
else if (::strcmp(key, "Suffix") == 0)
|
||||
m_aprsSuffix = value;
|
||||
else if (::strcmp(key, "Description") == 0)
|
||||
m_aprsDescription = value;
|
||||
} else if (section == SECTION_NETWORK) {
|
||||
@ -344,6 +347,11 @@ std::string CConf::getAPRSPassword() const
|
||||
return m_aprsPassword;
|
||||
}
|
||||
|
||||
std::string CConf::getAPRSSuffix() const
|
||||
{
|
||||
return m_aprsSuffix;
|
||||
}
|
||||
|
||||
std::string CConf::getAPRSDescription() const
|
||||
{
|
||||
return m_aprsDescription;
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
std::string getAPRSServer() const;
|
||||
unsigned int getAPRSPort() const;
|
||||
std::string getAPRSPassword() const;
|
||||
std::string getAPRSSuffix() const;
|
||||
std::string getAPRSDescription() const;
|
||||
|
||||
// The Log section
|
||||
@ -114,6 +115,7 @@ private:
|
||||
std::string m_aprsServer;
|
||||
unsigned int m_aprsPort;
|
||||
std::string m_aprsPassword;
|
||||
std::string m_aprsSuffix;
|
||||
std::string m_aprsDescription;
|
||||
|
||||
unsigned int m_networkPort;
|
||||
|
@ -29,12 +29,13 @@ const unsigned char NXDN_DATA_TYPE_GPS = 0x06U;
|
||||
const unsigned int NXDN_DATA_LENGTH = 20U;
|
||||
const unsigned int NXDN_DATA_MAX_LENGTH = 16U * NXDN_DATA_LENGTH;
|
||||
|
||||
CGPSHandler::CGPSHandler(const std::string& callsign, const std::string& suffix, const std::string& password, const std::string& address, unsigned int port) :
|
||||
CGPSHandler::CGPSHandler(const std::string& callsign, const std::string& rptSuffix, const std::string& password, const std::string& address, unsigned int port, const std::string& suffix) :
|
||||
m_callsign(callsign),
|
||||
m_writer(callsign, suffix, password, address, port),
|
||||
m_writer(callsign, rptSuffix, password, address, port),
|
||||
m_data(NULL),
|
||||
m_length(0U),
|
||||
m_source()
|
||||
m_source(),
|
||||
m_suffix(suffix)
|
||||
{
|
||||
assert(!callsign.empty());
|
||||
assert(!password.empty());
|
||||
@ -144,16 +145,22 @@ void CGPSHandler::processNMEA()
|
||||
double latitude = ::atof(pRMC[3U]);
|
||||
double longitude = ::atof(pRMC[5U]);
|
||||
|
||||
std::string source = m_source;
|
||||
if (!m_suffix.empty()) {
|
||||
source.append("-");
|
||||
source.append(m_suffix.substr(0U, 1U));
|
||||
}
|
||||
|
||||
char output[300U];
|
||||
if (pRMC[7U] != NULL && pRMC[8U] != NULL && ::strlen(pRMC[7U]) > 0U && ::strlen(pRMC[8U]) > 0U) {
|
||||
int bearing = ::atoi(pRMC[8U]);
|
||||
int speed = ::atoi(pRMC[7U]);
|
||||
|
||||
::sprintf(output, "%s-N>APDPRS,NXDN*,qAR,%s:!%07.2lf%s/%08.2lf%sr%03d/%03d via MMDVM",
|
||||
m_source.c_str(), m_callsign.c_str(), latitude, pRMC[4U], longitude, pRMC[6U], bearing, speed);
|
||||
::sprintf(output, "%s>APDPRS,NXDN*,qAR,%s:!%07.2lf%s/%08.2lf%sr%03d/%03d via MMDVM",
|
||||
source.c_str(), m_callsign.c_str(), latitude, pRMC[4U], longitude, pRMC[6U], bearing, speed);
|
||||
} else {
|
||||
::sprintf(output, "%s-N>APDPRS,NXDN*,qAR,%s:!%07.2lf%s/%08.2lf%sr via MMDVM",
|
||||
m_source.c_str(), m_callsign.c_str(), latitude, pRMC[4U], longitude, pRMC[6U]);
|
||||
::sprintf(output, "%s>APDPRS,NXDN*,qAR,%s:!%07.2lf%s/%08.2lf%sr via MMDVM",
|
||||
source.c_str(), m_callsign.c_str(), latitude, pRMC[4U], longitude, pRMC[6U]);
|
||||
}
|
||||
|
||||
m_writer.write(output);
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
class CGPSHandler {
|
||||
public:
|
||||
CGPSHandler(const std::string& callsign, const std::string& suffix, const std::string& password, const std::string& address, unsigned int port);
|
||||
CGPSHandler(const std::string& callsign, const std::string& rptSuffix, const std::string& password, const std::string& address, unsigned int port, const std::string& suffix);
|
||||
~CGPSHandler();
|
||||
|
||||
bool open();
|
||||
@ -48,6 +48,7 @@ private:
|
||||
unsigned char* m_data;
|
||||
unsigned int m_length;
|
||||
std::string m_source;
|
||||
std::string m_suffix;
|
||||
|
||||
void processNMEA();
|
||||
bool checkXOR() const;
|
||||
|
@ -482,14 +482,15 @@ void CNXDNGateway::createGPS()
|
||||
if (!m_conf.getAPRSEnabled())
|
||||
return;
|
||||
|
||||
std::string callsign = m_conf.getCallsign();
|
||||
std::string suffix = m_conf.getSuffix();
|
||||
std::string hostname = m_conf.getAPRSServer();
|
||||
unsigned int port = m_conf.getAPRSPort();
|
||||
std::string password = m_conf.getAPRSPassword();
|
||||
std::string desc = m_conf.getAPRSDescription();
|
||||
std::string callsign = m_conf.getCallsign();
|
||||
std::string rptSuffix = m_conf.getSuffix();
|
||||
std::string hostname = m_conf.getAPRSServer();
|
||||
unsigned int port = m_conf.getAPRSPort();
|
||||
std::string password = m_conf.getAPRSPassword();
|
||||
std::string desc = m_conf.getAPRSDescription();
|
||||
std::string suffix = m_conf.getAPRSSuffix();
|
||||
|
||||
m_gps = new CGPSHandler(callsign, suffix, password, hostname, port);
|
||||
m_gps = new CGPSHandler(callsign, rptSuffix, password, hostname, port, suffix);
|
||||
|
||||
unsigned int txFrequency = m_conf.getTxFrequency();
|
||||
unsigned int rxFrequency = m_conf.getRxFrequency();
|
||||
|
@ -1,6 +1,6 @@
|
||||
[General]
|
||||
Callsign=G4KLX
|
||||
Suffix=N
|
||||
Suffix=NXDN
|
||||
RptAddress=127.0.0.1
|
||||
RptPort=14021
|
||||
LocalPort=14020
|
||||
@ -29,6 +29,7 @@ Server=euro.aprs2.net
|
||||
Port=14580
|
||||
Password=9999
|
||||
Description=APRS Description
|
||||
Suffix=N
|
||||
|
||||
[Id Lookup]
|
||||
Name=NXDN.csv
|
||||
|
Loading…
Reference in New Issue
Block a user