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