From fda404992822e51ca89101dddeaf5519a5e32a4a Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sat, 19 Aug 2017 16:23:37 +0100 Subject: [PATCH] Move the Id into the General section. --- Conf.cpp | 18 +++++++++++++++++- Conf.h | 4 ++++ MMDVM.ini | 2 +- MMDVMHost.cpp | 7 +++++-- MMDVMHost.h | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index 8e6eeae..1889347 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -55,6 +55,7 @@ enum SECTION { CConf::CConf(const std::string& file) : m_file(file), m_callsign(), +m_id(0U), m_timeout(120U), m_duplex(true), m_rfModeHang(10U), @@ -126,6 +127,7 @@ m_fusionSelfOnly(false), m_fusionSQLEnabled(false), m_fusionSQL(0U), m_p25Enabled(false), +m_p25Id(0U), m_p25NAC(0x293U), m_p25SelfOnly(false), m_dstarNetworkEnabled(false), @@ -264,7 +266,9 @@ bool CConf::read() for (unsigned int i = 0U; value[i] != 0; i++) value[i] = ::toupper(value[i]); m_cwIdCallsign = m_callsign = value; - } else if (::strcmp(key, "Timeout") == 0) + } else if (::strcmp(key, "Id") == 0) + m_id = m_p25Id = m_dmrId = (unsigned int)::atoi(value); + else if (::strcmp(key, "Timeout") == 0) m_timeout = (unsigned int)::atoi(value); else if (::strcmp(key, "Duplex") == 0) m_duplex = ::atoi(value) == 1; @@ -466,6 +470,8 @@ bool CConf::read() } else if (section == SECTION_P25) { if (::strcmp(key, "Enable") == 0) m_p25Enabled = ::atoi(value) == 1; + else if (::strcmp(key, "Id") == 0) + m_p25Id = (unsigned int)::atoi(value); else if (::strcmp(key, "NAC") == 0) m_p25NAC = (unsigned int)::strtoul(value, NULL, 16); else if (::strcmp(key, "OverrideUIDCheck") == 0) @@ -606,6 +612,11 @@ std::string CConf::getCallsign() const return m_callsign; } +unsigned int CConf::getId() const +{ + return m_id; +} + unsigned int CConf::getTimeout() const { return m_timeout; @@ -961,6 +972,11 @@ bool CConf::getP25Enabled() const return m_p25Enabled; } +unsigned int CConf::getP25Id() const +{ + return m_p25Id; +} + unsigned int CConf::getP25NAC() const { return m_p25NAC; diff --git a/Conf.h b/Conf.h index 4d92512..b885c8e 100644 --- a/Conf.h +++ b/Conf.h @@ -32,6 +32,7 @@ public: // The General section std::string getCallsign() const; + unsigned int getId() const; unsigned int getTimeout() const; bool getDuplex() const; unsigned int getRFModeHang() const; @@ -123,6 +124,7 @@ public: // The P25 section bool getP25Enabled() const; + unsigned int getP25Id() const; unsigned int getP25NAC() const; bool getP25SelfOnly() const; @@ -200,6 +202,7 @@ public: private: std::string m_file; + unsigned int m_id; std::string m_callsign; unsigned int m_timeout; bool m_duplex; @@ -282,6 +285,7 @@ private: unsigned char m_fusionSQL; bool m_p25Enabled; + unsigned int m_p25Id; unsigned int m_p25NAC; bool m_p25SelfOnly; diff --git a/MMDVM.ini b/MMDVM.ini index a8c31e2..fb50f95 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -1,5 +1,6 @@ [General] Callsign=G9BF +Id=123456 Timeout=180 Duplex=1 # ModeHang=10 @@ -72,7 +73,6 @@ ErrorReply=1 [DMR] Enable=1 Beacons=1 -Id=123456 ColorCode=1 SelfOnly=0 EmbeddedLCOnly=0 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 6f4bf6c..475d062 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -149,6 +149,7 @@ m_p25Enabled(false), m_cwIdTime(0U), m_lookup(NULL), m_callsign(), +m_id(0U), m_cwCallsign() { } @@ -426,14 +427,14 @@ int CMMDVMHost::run() CP25Control* p25 = NULL; if (m_p25Enabled) { + unsigned int id = m_conf.getP25Id(); unsigned int nac = m_conf.getP25NAC(); - unsigned int id = m_conf.getDMRId(); bool uidOverride = m_conf.getP25OverrideUID(); bool selfOnly = m_conf.getP25SelfOnly(); LogInfo("P25 Parameters"); - LogInfo(" NAC: $%03X", nac); LogInfo(" Id: %u", id); + LogInfo(" NAC: $%03X", nac); LogInfo(" UID Override: %s", uidOverride ? "yes" : "no"); LogInfo(" Self Only: %s", selfOnly ? "yes" : "no"); @@ -1024,6 +1025,7 @@ void CMMDVMHost::readParams() m_p25Enabled = m_conf.getP25Enabled(); m_duplex = m_conf.getDuplex(); m_callsign = m_conf.getCallsign(); + m_id = m_conf.getId(); m_timeout = m_conf.getTimeout(); m_rfModeHang = m_conf.getRFModeHang(); @@ -1031,6 +1033,7 @@ void CMMDVMHost::readParams() LogInfo("General Parameters"); LogInfo(" Callsign: %s", m_callsign.c_str()); + LogInfo(" Id: %u", m_id); LogInfo(" Duplex: %s", m_duplex ? "yes" : "no"); LogInfo(" Timeout: %us", m_timeout); LogInfo(" RF Mode Hang: %us", m_rfModeHang); diff --git a/MMDVMHost.h b/MMDVMHost.h index 70868b0..6609d02 100644 --- a/MMDVMHost.h +++ b/MMDVMHost.h @@ -64,6 +64,7 @@ private: unsigned int m_cwIdTime; CDMRLookup* m_lookup; std::string m_callsign; + unsigned int m_id; std::string m_cwCallsign; void readParams();