diff --git a/NXDNGateway/APRSWriter.cpp b/NXDNGateway/APRSWriter.cpp index 6955487..695fa6b 100644 --- a/NXDNGateway/APRSWriter.cpp +++ b/NXDNGateway/APRSWriter.cpp @@ -34,6 +34,7 @@ m_latitude(0.0F), m_longitude(0.0F), m_height(0), m_desc(), +m_symbol(), m_aprsAddr(), m_aprsAddrLen(0U), m_aprsSocket() @@ -61,11 +62,12 @@ CAPRSWriter::~CAPRSWriter() { } -void CAPRSWriter::setInfo(unsigned int txFrequency, unsigned int rxFrequency, const std::string& desc) +void CAPRSWriter::setInfo(unsigned int txFrequency, unsigned int rxFrequency, const std::string& desc, const std::string& symbol) { m_txFrequency = txFrequency; m_rxFrequency = rxFrequency; m_desc = desc; + m_symbol = symbol; } void CAPRSWriter::setStaticLocation(float latitude, float longitude, int height) @@ -209,17 +211,21 @@ void CAPRSWriter::sendIdFrameFixed() ::sprintf(lon, "%08.2lf", longitude); std::string server = m_callsign; + std::string symbol = m_symbol; size_t pos = server.find_first_of('-'); if (pos == std::string::npos) server.append("-S"); else server.append("S"); + if (symbol.empty()) + symbol.append("D&"); + char output[500U]; - ::sprintf(output, "%s>APDG04,TCPIP*,qAC,%s:!%s%cD%s%c&/A=%06.0f%s %s\r\n", + ::sprintf(output, "%s>APDG04,TCPIP*,qAC,%s:!%s%c%c%s%c%c/A=%06.0f%s %s\r\n", m_callsign.c_str(), server.c_str(), - lat, (m_latitude < 0.0F) ? 'S' : 'N', - lon, (m_longitude < 0.0F) ? 'W' : 'E', + lat, (m_latitude < 0.0F) ? 'S' : 'N', symbol[0], + lon, (m_longitude < 0.0F) ? 'W' : 'E', symbol[1], float(m_height) * 3.28F, band, desc); if (m_debug) diff --git a/NXDNGateway/APRSWriter.h b/NXDNGateway/APRSWriter.h index 8dab91f..df1e564 100644 --- a/NXDNGateway/APRSWriter.h +++ b/NXDNGateway/APRSWriter.h @@ -47,7 +47,7 @@ public: bool open(); - void setInfo(unsigned int txFrequency, unsigned int rxFrequency, const std::string& desc); + void setInfo(unsigned int txFrequency, unsigned int rxFrequency, const std::string& desc, const std::string& symbol); void setStaticLocation(float latitude, float longitude, int height); @@ -69,6 +69,7 @@ private: float m_longitude; int m_height; std::string m_desc; + std::string m_symbol; sockaddr_storage m_aprsAddr; unsigned int m_aprsAddrLen; CUDPSocket m_aprsSocket; diff --git a/NXDNGateway/Conf.cpp b/NXDNGateway/Conf.cpp index fd36aa7..478dd2b 100644 --- a/NXDNGateway/Conf.cpp +++ b/NXDNGateway/Conf.cpp @@ -72,6 +72,7 @@ m_aprsAddress("127.0.0.1"), m_aprsPort(8673U), m_aprsSuffix(), m_aprsDescription(), +m_aprsSymbol(), m_networkPort(0U), m_networkHosts1(), m_networkHosts2(), @@ -235,6 +236,8 @@ bool CConf::read() m_aprsSuffix = value; else if (::strcmp(key, "Description") == 0) m_aprsDescription = value; + else if (::strcmp(key, "Symbol") == 0) + m_aprsSymbol = value; } else if (section == SECTION_NETWORK) { if (::strcmp(key, "Port") == 0) m_networkPort = (unsigned short)::atoi(value); @@ -415,6 +418,11 @@ std::string CConf::getAPRSDescription() const return m_aprsDescription; } +std::string CConf::getAPRSSymbol() const +{ + return m_aprsSymbol; +} + unsigned int CConf::getLogDisplayLevel() const { return m_logDisplayLevel; diff --git a/NXDNGateway/Conf.h b/NXDNGateway/Conf.h index 1e272f6..725df17 100644 --- a/NXDNGateway/Conf.h +++ b/NXDNGateway/Conf.h @@ -65,6 +65,7 @@ public: unsigned short getAPRSPort() const; std::string getAPRSSuffix() const; std::string getAPRSDescription() const; + std::string getAPRSSymbol() const; // The Log section unsigned int getLogDisplayLevel() const; @@ -134,6 +135,7 @@ private: unsigned short m_aprsPort; std::string m_aprsSuffix; std::string m_aprsDescription; + std::string m_aprsSymbol; unsigned short m_networkPort; std::string m_networkHosts1; diff --git a/NXDNGateway/NXDNGateway.cpp b/NXDNGateway/NXDNGateway.cpp index 3b1dbbe..65eedf1 100644 --- a/NXDNGateway/NXDNGateway.cpp +++ b/NXDNGateway/NXDNGateway.cpp @@ -655,8 +655,9 @@ void CNXDNGateway::createGPS() unsigned int txFrequency = m_conf.getTxFrequency(); unsigned int rxFrequency = m_conf.getRxFrequency(); std::string desc = m_conf.getAPRSDescription(); + std::string symbol = m_conf.getAPRSSymbol(); - m_writer->setInfo(txFrequency, rxFrequency, desc); + m_writer->setInfo(txFrequency, rxFrequency, desc, symbol); bool enabled = m_conf.getGPSDEnabled(); if (enabled) { diff --git a/NXDNGateway/NXDNGateway.ini b/NXDNGateway/NXDNGateway.ini index 9480fa4..bcb4a3e 100644 --- a/NXDNGateway/NXDNGateway.ini +++ b/NXDNGateway/NXDNGateway.ini @@ -40,6 +40,7 @@ Address=127.0.0.1 Port=8673 Suffix=N Description=APRS Description +# Symbol=/r [Id Lookup] Name=NXDN.csv diff --git a/NXDNGateway/Version.h b/NXDNGateway/Version.h index 6435ed0..2d357b3 100644 --- a/NXDNGateway/Version.h +++ b/NXDNGateway/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20201105"; +const char* VERSION = "20230212"; #endif