From 0d29254024457dd7e1ec4c08af29a87cbbc236ed Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Thu, 9 Feb 2023 13:56:08 -0500 Subject: [PATCH] Add Callsign to USRPClients file, fix NXDN ID bug, update version for xlxapi compat --- README.md | 6 +++--- reflector/Callsign.cpp | 2 +- reflector/Main.h | 11 +++++------ reflector/Reflector.cpp | 2 +- reflector/USRPProtocol.cpp | 25 ++++++++++++------------- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3957bbb..7febdd7 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ Optional software vocoding of AMBE+2(DMR/YSF/NXDN) can be done using md380_vocod Numerous fixes like late entry recognition from modes like YSF that are otherwise ignored by the original reflector when no header has been received. -The USRP Clients are read from a file defined in Main.h. The format of this file is ipaddr;port; one host per line, ex: +The USRP Clients are read from a file defined in Main.h. The format of this file is ipaddr;port;callsign; one host per line, ex: ```bash -192.168.1.100;32000; -192.168.1.101;32001; +192.168.1.100;32000;CALLSIGN1; +192.168.1.101;32001;CALLSIGN2; ``` The rest of this README is unchanged from the original. diff --git a/reflector/Callsign.cpp b/reflector/Callsign.cpp index a1b256b..813ba15 100644 --- a/reflector/Callsign.cpp +++ b/reflector/Callsign.cpp @@ -277,7 +277,7 @@ void CCallsign::SetNXDNid(uint16_t nxdnid, bool UpdateCallsign) m_uiNXDNid = nxdnid; if ( UpdateCallsign ) { - g_DmridDir.Lock(); + g_NXDNidDir.Lock(); { const CCallsign *callsign = g_NXDNidDir.FindCallsign(nxdnid); if ( callsign != nullptr ) diff --git a/reflector/Main.h b/reflector/Main.h index 0392c5a..bc1bdd3 100644 --- a/reflector/Main.h +++ b/reflector/Main.h @@ -67,9 +67,9 @@ // version ----------------------------------------------------- -#define VERSION_MAJOR 0 -#define VERSION_MINOR 0 -#define VERSION_REVISION 7 +#define VERSION_MAJOR 2 +#define VERSION_MINOR 6 +#define VERSION_REVISION 0 // global ------------------------------------------------------ @@ -171,10 +171,9 @@ enum class EProtocol { any, none, dextra, dplus, dcs, bm, urf, dmrplus, dmrmmdvm #define USRP_PORT 34001 // UDP port #define USRP_KEEPALIVE_PERIOD 1 // in seconds #define USRP_KEEPALIVE_TIMEOUT (USRP_KEEPALIVE_PERIOD*10) // in seconds -#define USRP_AUTOLINK_ENABLE 1 // 1 = enable, 0 = disable auto-link -#define USRP_AUTOLINK_MODULE 'A' // module for client to auto-link to #define USRP_DEFAULT_CALLSIGN "ALLSTAR" -#define USRPCLIENTS_PATH "/home/pi/USRPClients.txt" // format ip;port; per line for each ALLSTAR/USRP node +#define USRP_CLIENTS_PATH "/home/pi/USRPClients.txt" // format ip;port;callsign; per line for each ALLSTAR/USRP node +#define USRP_AUTOLINK_MODULE 'A' #ifndef NO_G3 // G3 Terminal diff --git a/reflector/Reflector.cpp b/reflector/Reflector.cpp index fdfa792..1071275 100644 --- a/reflector/Reflector.cpp +++ b/reflector/Reflector.cpp @@ -81,7 +81,7 @@ bool CReflector::Start(void) // init dmrid directory. No need to check the return value. g_DmridDir.Init(); - // init dmrid directory. No need to check the return value. + // init nxdnid directory. No need to check the return value. g_NXDNidDir.Init(); // init wiresx node directory. Likewise with the return vale. diff --git a/reflector/USRPProtocol.cpp b/reflector/USRPProtocol.cpp index 75ebdbf..93dc816 100644 --- a/reflector/USRPProtocol.cpp +++ b/reflector/USRPProtocol.cpp @@ -40,7 +40,6 @@ bool CUSRPProtocol::Initialize(const char *type, const EProtocol ptype, const ui { CBuffer buffer; m_uiStreamId = 0; - CCallsign cs(USRP_DEFAULT_CALLSIGN); CClients *clients = g_Reflector.GetClients(); std::ifstream file; std::streampos size; @@ -49,7 +48,7 @@ bool CUSRPProtocol::Initialize(const char *type, const EProtocol ptype, const ui if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6)) return false; - file.open(USRPCLIENTS_PATH, std::ios::in | std::ios::binary | std::ios::ate); + file.open(USRP_CLIENTS_PATH, std::ios::in | std::ios::binary | std::ios::ate); if ( file.is_open() ) { // read file @@ -76,18 +75,18 @@ bool CUSRPProtocol::Initialize(const char *type, const EProtocol ptype, const ui *ptr2 = 0; char *ip; char *port; - if ((ip = ::strtok(ptr1, ";")) != nullptr) + char *clientcs; + + if ( ((ip = ::strtok(ptr1, ";")) != nullptr) && + ((port = ::strtok(nullptr, ";")) != nullptr) && + ((clientcs = ::strtok(nullptr, ";")) != nullptr) ) { - if ( ((port = ::strtok(nullptr, ";")) != nullptr) ) - { - uint32_t ui = atoi(port); - CIp Ip(AF_INET, ui, ip); - auto newclient = std::make_shared(cs, Ip); -#if USRP_AUTOLINK_ENABLE - newclient->SetReflectorModule(USRP_AUTOLINK_MODULE); -#endif - clients->AddClient(newclient); - } + uint32_t ui = atoi(port); + CIp Ip(AF_INET, ui, ip); + CCallsign cs(clientcs); + auto newclient = std::make_shared(cs, Ip); + newclient->SetReflectorModule(USRP_AUTOLINK_MODULE); + clients->AddClient(newclient); } ptr1 = ptr2+1; }