Move the Id into the General section.

This commit is contained in:
Jonathan Naylor 2017-08-19 16:23:37 +01:00
parent afe38bcb9d
commit fda4049928
5 changed files with 28 additions and 4 deletions

View file

@ -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;

4
Conf.h
View file

@ -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;

View file

@ -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

View file

@ -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);

View file

@ -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();