diff --git a/Conf.cpp b/Conf.cpp index e39c5a3..dd44669 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -76,6 +76,7 @@ m_logFilePath(), m_logFileRoot(), m_cwIdEnabled(false), m_cwIdTime(10U), +m_cwIdCallsign(), m_dmrIdLookupFile(), m_dmrIdLookupTime(0U), m_modemPort(), @@ -252,7 +253,7 @@ bool CConf::read() // Convert the callsign to upper case for (unsigned int i = 0U; value[i] != 0; i++) value[i] = ::toupper(value[i]); - m_callsign = value; + m_cwIdCallsign = m_callsign = value; } else if (::strcmp(key, "Timeout") == 0) m_timeout = (unsigned int)::atoi(value); else if (::strcmp(key, "Duplex") == 0) @@ -300,7 +301,14 @@ bool CConf::read() m_cwIdEnabled = ::atoi(value) == 1; else if (::strcmp(key, "Time") == 0) m_cwIdTime = (unsigned int)::atoi(value); - } else if (section == SECTION_DMRID_LOOKUP) { + else if (::strcmp(key, "Callsign") == 0) { + // Convert the callsign to upper case + for (unsigned int i = 0U; value[i] != 0; i++) + value[i] = ::toupper(value[i]); + m_cwIdCallsign = value; + } + } + else if (section == SECTION_DMRID_LOOKUP) { if (::strcmp(key, "File") == 0) m_dmrIdLookupFile = value; else if (::strcmp(key, "Time") == 0) @@ -675,6 +683,11 @@ unsigned int CConf::getCWIdTime() const return m_cwIdTime; } +std::string CConf::getCWIdCallsign() const +{ + return m_cwIdCallsign; +} + std::string CConf::getDMRIdLookupFile() const { return m_dmrIdLookupFile; diff --git a/Conf.h b/Conf.h index 38ee173..b92525f 100644 --- a/Conf.h +++ b/Conf.h @@ -59,6 +59,7 @@ public: // The CW ID section bool getCWIdEnabled() const; unsigned int getCWIdTime() const; + std::string getCWIdCallsign() const; // The DMR Id section std::string getDMRIdLookupFile() const; @@ -214,6 +215,7 @@ private: bool m_cwIdEnabled; unsigned int m_cwIdTime; + std::string m_cwIdCallsign; std::string m_dmrIdLookupFile; unsigned int m_dmrIdLookupTime; diff --git a/MMDVM.ini b/MMDVM.ini index 80e1525..dc18eae 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -29,6 +29,7 @@ FileRoot=MMDVM [CW Id] Enable=1 Time=10 +# Callsign= [DMR Id Lookup] File=DMRIds.dat diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 5ff96f6..2dbba28 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -144,7 +144,8 @@ m_ysfEnabled(false), m_p25Enabled(false), m_cwIdTime(0U), m_lookup(NULL), -m_callsign() +m_callsign(), +m_cwCallsign() { } @@ -286,9 +287,11 @@ int CMMDVMHost::run() if (m_conf.getCWIdEnabled()) { unsigned int time = m_conf.getCWIdTime(); + m_cwCallsign = m_conf.getCWIdCallsign(); LogInfo("CW Id Parameters"); LogInfo(" Time: %u mins", time); + LogInfo(" Callsign: %s", m_cwCallsign.c_str()); m_cwIdTime = time * 60U; @@ -716,7 +719,7 @@ int CMMDVMHost::run() if (m_mode == MODE_IDLE && !m_modem->hasTX()){ LogDebug("sending CW ID"); m_display->writeCW(); - m_modem->sendCWId(m_callsign); + m_modem->sendCWId(m_cwCallsign); m_cwIdTimer.setTimeout(m_cwIdTime); m_cwIdTimer.start(); diff --git a/MMDVMHost.h b/MMDVMHost.h index 8608d5d..70868b0 100644 --- a/MMDVMHost.h +++ b/MMDVMHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,6 +64,7 @@ private: unsigned int m_cwIdTime; CDMRLookup* m_lookup; std::string m_callsign; + std::string m_cwCallsign; void readParams(); bool createModem();