From 45102eda5b2fddf5a389f3a40f90be144bf7542d Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Wed, 7 Apr 2021 19:40:31 -0400 Subject: [PATCH] Add DMR ID to ini file --- USRP2P25/Conf.cpp | 15 ++++++++++----- USRP2P25/Conf.h | 3 ++- USRP2P25/USRP2P25.cpp | 8 +++++--- USRP2P25/USRP2P25.h | 1 + USRP2P25/USRP2P25.ini | 1 + 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/USRP2P25/Conf.cpp b/USRP2P25/Conf.cpp index 7b28a20..7463b72 100644 --- a/USRP2P25/Conf.cpp +++ b/USRP2P25/Conf.cpp @@ -38,13 +38,13 @@ enum SECTION { CConf::CConf(const std::string& file) : m_file(file), m_callsign(), +m_dmrid(0U), m_daemon(false), m_usrpAddress(), m_usrpDstPort(0U), m_usrpLocalPort(0U), m_usrpGainAdjDb(), m_usrpDebug(false), -m_p25DstId(0U), m_p25DstAddress(), m_p25DstPort(0U), m_p25LocalAddress(), @@ -107,8 +107,8 @@ bool CConf::read() if (section == SECTION_P25_NETWORK) { if (::strcmp(key, "Callsign") == 0) m_callsign = value; - else if (::strcmp(key, "StartupDstId") == 0) - m_p25DstId = (unsigned int)::atoi(value); + else if (::strcmp(key, "DmrId") == 0) + m_dmrid = (unsigned int)::atoi(value); else if (::strcmp(key, "LocalAddress") == 0) m_p25LocalAddress = value; else if (::strcmp(key, "LocalPort") == 0) @@ -154,12 +154,17 @@ std::string CConf::getCallsign() const return m_callsign; } +uint32_t CConf::getDMRId() const +{ + return m_dmrid; +} + std::string CConf::getP25DstAddress() const { return m_p25DstAddress; } -unsigned int CConf::getP25DstPort() const +uint32_t CConf::getP25DstPort() const { return m_p25DstPort; } @@ -169,7 +174,7 @@ std::string CConf::getP25LocalAddress() const return m_p25LocalAddress; } -unsigned int CConf::getP25LocalPort() const +uint32_t CConf::getP25LocalPort() const { return m_p25LocalPort; } diff --git a/USRP2P25/Conf.h b/USRP2P25/Conf.h index bfb4cad..55a3286 100644 --- a/USRP2P25/Conf.h +++ b/USRP2P25/Conf.h @@ -34,6 +34,7 @@ public: // The P25 Network section std::string getCallsign() const; + uint32_t getDMRId() const; bool getDaemon() const; uint32_t getP25DstId() const; std::string getP25DstAddress() const; @@ -59,6 +60,7 @@ public: private: std::string m_file; std::string m_callsign; + uint32_t m_dmrid; bool m_daemon; std::string m_usrpAddress; @@ -67,7 +69,6 @@ private: std::string m_usrpGainAdjDb; bool m_usrpDebug; - uint32_t m_p25DstId; std::string m_p25DstAddress; uint32_t m_p25DstPort; std::string m_p25LocalAddress; diff --git a/USRP2P25/USRP2P25.cpp b/USRP2P25/USRP2P25.cpp index 9e25056..b554603 100644 --- a/USRP2P25/USRP2P25.cpp +++ b/USRP2P25/USRP2P25.cpp @@ -148,6 +148,7 @@ m_conf(configFile), m_usrpNetwork(NULL), m_p25Network(NULL), m_conv(), +m_dmrid(1U), m_p25Src(1U), m_p25Dst(1U), m_p25Frame(NULL), @@ -254,6 +255,7 @@ int CUSRP2P25::run() LogInfo(HEADER4); m_callsign = m_conf.getCallsign(); + m_dmrid = m_conf.getDMRId(); std::string p25_dstAddress = m_conf.getP25DstAddress(); unsigned int p25_dstPort = m_conf.getP25DstPort(); @@ -355,9 +357,9 @@ int CUSRP2P25::run() case 0x04U: ::memcpy(buffer, REC66, 17U); ::memcpy(buffer + 5U, m_p25Frame, 11U); - buffer[1U] = (m_p25Src >> 16) & 0xFFU; - buffer[2U] = (m_p25Src >> 8) & 0xFFU; - buffer[3U] = (m_p25Src >> 0) & 0xFFU; + buffer[1U] = (m_dmrid >> 16) & 0xFFU; + buffer[2U] = (m_dmrid >> 8) & 0xFFU; + buffer[3U] = (m_dmrid >> 0) & 0xFFU; m_p25Network->writeData(buffer, 17U); break; case 0x05U: diff --git a/USRP2P25/USRP2P25.h b/USRP2P25/USRP2P25.h index f5d8979..e3b5a63 100644 --- a/USRP2P25/USRP2P25.h +++ b/USRP2P25/USRP2P25.h @@ -46,6 +46,7 @@ private: CUSRPNetwork* m_usrpNetwork; CP25Network* m_p25Network; CModeConv m_conv; + uint32_t m_dmrid; uint32_t m_p25Src; uint32_t m_p25Dst; uint8_t* m_p25Frame; diff --git a/USRP2P25/USRP2P25.ini b/USRP2P25/USRP2P25.ini index 9ae47bc..2df3a4a 100644 --- a/USRP2P25/USRP2P25.ini +++ b/USRP2P25/USRP2P25.ini @@ -1,5 +1,6 @@ [P25 Network] Callsign=AD8DP +DmrID=1234567 LocalAddress=127.0.0.1 LocalPort=32010 DstAddress=127.0.0.1