Allow for optional seperate (and longer) CW Ids.

This commit is contained in:
Jonathan Naylor 2017-04-10 17:55:53 +01:00
parent dd2db36409
commit 99d57bf102
5 changed files with 25 additions and 5 deletions

View File

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

2
Conf.h
View File

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

View File

@ -29,6 +29,7 @@ FileRoot=MMDVM
[CW Id]
Enable=1
Time=10
# Callsign=
[DMR Id Lookup]
File=DMRIds.dat

View File

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

View File

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