Add DMR ID to ini file

This commit is contained in:
Doug McLain 2021-04-07 19:40:31 -04:00
parent 5c117c841f
commit 45102eda5b
5 changed files with 19 additions and 9 deletions

View File

@ -38,13 +38,13 @@ enum SECTION {
CConf::CConf(const std::string& file) : CConf::CConf(const std::string& file) :
m_file(file), m_file(file),
m_callsign(), m_callsign(),
m_dmrid(0U),
m_daemon(false), m_daemon(false),
m_usrpAddress(), m_usrpAddress(),
m_usrpDstPort(0U), m_usrpDstPort(0U),
m_usrpLocalPort(0U), m_usrpLocalPort(0U),
m_usrpGainAdjDb(), m_usrpGainAdjDb(),
m_usrpDebug(false), m_usrpDebug(false),
m_p25DstId(0U),
m_p25DstAddress(), m_p25DstAddress(),
m_p25DstPort(0U), m_p25DstPort(0U),
m_p25LocalAddress(), m_p25LocalAddress(),
@ -107,8 +107,8 @@ bool CConf::read()
if (section == SECTION_P25_NETWORK) { if (section == SECTION_P25_NETWORK) {
if (::strcmp(key, "Callsign") == 0) if (::strcmp(key, "Callsign") == 0)
m_callsign = value; m_callsign = value;
else if (::strcmp(key, "StartupDstId") == 0) else if (::strcmp(key, "DmrId") == 0)
m_p25DstId = (unsigned int)::atoi(value); m_dmrid = (unsigned int)::atoi(value);
else if (::strcmp(key, "LocalAddress") == 0) else if (::strcmp(key, "LocalAddress") == 0)
m_p25LocalAddress = value; m_p25LocalAddress = value;
else if (::strcmp(key, "LocalPort") == 0) else if (::strcmp(key, "LocalPort") == 0)
@ -154,12 +154,17 @@ std::string CConf::getCallsign() const
return m_callsign; return m_callsign;
} }
uint32_t CConf::getDMRId() const
{
return m_dmrid;
}
std::string CConf::getP25DstAddress() const std::string CConf::getP25DstAddress() const
{ {
return m_p25DstAddress; return m_p25DstAddress;
} }
unsigned int CConf::getP25DstPort() const uint32_t CConf::getP25DstPort() const
{ {
return m_p25DstPort; return m_p25DstPort;
} }
@ -169,7 +174,7 @@ std::string CConf::getP25LocalAddress() const
return m_p25LocalAddress; return m_p25LocalAddress;
} }
unsigned int CConf::getP25LocalPort() const uint32_t CConf::getP25LocalPort() const
{ {
return m_p25LocalPort; return m_p25LocalPort;
} }

View File

@ -34,6 +34,7 @@ public:
// The P25 Network section // The P25 Network section
std::string getCallsign() const; std::string getCallsign() const;
uint32_t getDMRId() const;
bool getDaemon() const; bool getDaemon() const;
uint32_t getP25DstId() const; uint32_t getP25DstId() const;
std::string getP25DstAddress() const; std::string getP25DstAddress() const;
@ -59,6 +60,7 @@ public:
private: private:
std::string m_file; std::string m_file;
std::string m_callsign; std::string m_callsign;
uint32_t m_dmrid;
bool m_daemon; bool m_daemon;
std::string m_usrpAddress; std::string m_usrpAddress;
@ -67,7 +69,6 @@ private:
std::string m_usrpGainAdjDb; std::string m_usrpGainAdjDb;
bool m_usrpDebug; bool m_usrpDebug;
uint32_t m_p25DstId;
std::string m_p25DstAddress; std::string m_p25DstAddress;
uint32_t m_p25DstPort; uint32_t m_p25DstPort;
std::string m_p25LocalAddress; std::string m_p25LocalAddress;

View File

@ -148,6 +148,7 @@ m_conf(configFile),
m_usrpNetwork(NULL), m_usrpNetwork(NULL),
m_p25Network(NULL), m_p25Network(NULL),
m_conv(), m_conv(),
m_dmrid(1U),
m_p25Src(1U), m_p25Src(1U),
m_p25Dst(1U), m_p25Dst(1U),
m_p25Frame(NULL), m_p25Frame(NULL),
@ -254,6 +255,7 @@ int CUSRP2P25::run()
LogInfo(HEADER4); LogInfo(HEADER4);
m_callsign = m_conf.getCallsign(); m_callsign = m_conf.getCallsign();
m_dmrid = m_conf.getDMRId();
std::string p25_dstAddress = m_conf.getP25DstAddress(); std::string p25_dstAddress = m_conf.getP25DstAddress();
unsigned int p25_dstPort = m_conf.getP25DstPort(); unsigned int p25_dstPort = m_conf.getP25DstPort();
@ -355,9 +357,9 @@ int CUSRP2P25::run()
case 0x04U: case 0x04U:
::memcpy(buffer, REC66, 17U); ::memcpy(buffer, REC66, 17U);
::memcpy(buffer + 5U, m_p25Frame, 11U); ::memcpy(buffer + 5U, m_p25Frame, 11U);
buffer[1U] = (m_p25Src >> 16) & 0xFFU; buffer[1U] = (m_dmrid >> 16) & 0xFFU;
buffer[2U] = (m_p25Src >> 8) & 0xFFU; buffer[2U] = (m_dmrid >> 8) & 0xFFU;
buffer[3U] = (m_p25Src >> 0) & 0xFFU; buffer[3U] = (m_dmrid >> 0) & 0xFFU;
m_p25Network->writeData(buffer, 17U); m_p25Network->writeData(buffer, 17U);
break; break;
case 0x05U: case 0x05U:

View File

@ -46,6 +46,7 @@ private:
CUSRPNetwork* m_usrpNetwork; CUSRPNetwork* m_usrpNetwork;
CP25Network* m_p25Network; CP25Network* m_p25Network;
CModeConv m_conv; CModeConv m_conv;
uint32_t m_dmrid;
uint32_t m_p25Src; uint32_t m_p25Src;
uint32_t m_p25Dst; uint32_t m_p25Dst;
uint8_t* m_p25Frame; uint8_t* m_p25Frame;

View File

@ -1,5 +1,6 @@
[P25 Network] [P25 Network]
Callsign=AD8DP Callsign=AD8DP
DmrID=1234567
LocalAddress=127.0.0.1 LocalAddress=127.0.0.1
LocalPort=32010 LocalPort=32010
DstAddress=127.0.0.1 DstAddress=127.0.0.1