Merge pull request #313 from phl0/makeAckTimeAdjustable

Make AckTime adjustable
This commit is contained in:
Jonathan Naylor 2017-06-16 08:27:18 +01:00 committed by GitHub
commit 194b543b32
6 changed files with 22 additions and 9 deletions

View file

@ -103,6 +103,7 @@ m_dstarModule("C"),
m_dstarSelfOnly(false),
m_dstarBlackList(),
m_dstarAckReply(true),
m_dstarAckTime(750U),
m_dstarErrorReply(true),
m_dmrEnabled(false),
m_dmrBeacons(false),
@ -382,6 +383,8 @@ bool CConf::read()
}
} else if (::strcmp(key, "AckReply") == 0)
m_dstarAckReply = ::atoi(value) == 1;
else if (::strcmp(key, "AckTime") == 0)
m_dstarAckTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "ErrorReply") == 0)
m_dstarErrorReply = ::atoi(value) == 1;
} else if (section == SECTION_DMR) {
@ -829,6 +832,11 @@ bool CConf::getDStarAckReply() const
return m_dstarAckReply;
}
unsigned int CConf::getDStarAckTime() const
{
return m_dstarAckTime;
}
bool CConf::getDStarErrorReply() const
{
return m_dstarErrorReply;

2
Conf.h
View file

@ -94,6 +94,7 @@ public:
bool getDStarSelfOnly() const;
std::vector<std::string> getDStarBlackList() const;
bool getDStarAckReply() const;
unsigned int getDStarAckTime() const;
bool getDStarErrorReply() const;
// The DMR section
@ -250,6 +251,7 @@ private:
bool m_dstarSelfOnly;
std::vector<std::string> m_dstarBlackList;
bool m_dstarAckReply;
unsigned int m_dstarAckTime;
bool m_dstarErrorReply;
bool m_dmrEnabled;

View file

@ -36,7 +36,7 @@ bool CallsignCompare(const std::string& arg, const unsigned char* my)
// #define DUMP_DSTAR
CDStarControl::CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper) :
CDStarControl::CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, unsigned int ackTime, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper) :
m_callsign(NULL),
m_gateway(NULL),
m_selfOnly(selfOnly),
@ -59,8 +59,8 @@ m_networkWatchdog(1000U, 0U, 1500U),
m_rfTimeoutTimer(1000U, timeout),
m_netTimeoutTimer(1000U, timeout),
m_packetTimer(1000U, 0U, 300U),
m_ackTimer(1000U, 0U, 750U),
m_errTimer(1000U, 0U, 750U),
m_ackTimer(1000U, 0U, ackTime),
m_errTimer(1000U, 0U, ackTime),
m_interval(),
m_elapsed(),
m_rfFrames(0U),

View file

@ -37,7 +37,7 @@
class CDStarControl {
public:
CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper);
CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, unsigned int ackTime, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper);
~CDStarControl();
bool writeModem(unsigned char* data, unsigned int len);

View file

@ -66,6 +66,7 @@ Enable=1
Module=C
SelfOnly=0
AckReply=1
AckTime=750
ErrorReply=1
[DMR]

View file

@ -335,22 +335,24 @@ int CMMDVMHost::run()
CDStarControl* dstar = NULL;
if (m_dstarEnabled) {
std::string module = m_conf.getDStarModule();
bool selfOnly = m_conf.getDStarSelfOnly();
std::string module = m_conf.getDStarModule();
bool selfOnly = m_conf.getDStarSelfOnly();
std::vector<std::string> blackList = m_conf.getDStarBlackList();
bool ackReply = m_conf.getDStarAckReply();
bool errorReply = m_conf.getDStarErrorReply();
bool ackReply = m_conf.getDStarAckReply();
unsigned int ackTime = m_conf.getDStarAckTime();
bool errorReply = m_conf.getDStarErrorReply();
LogInfo("D-Star Parameters");
LogInfo(" Module: %s", module.c_str());
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
LogInfo(" Ack Reply: %s", ackReply ? "yes" : "no");
LogInfo(" Ack Time: %ums", ackTime);
LogInfo(" Error Reply: %s", errorReply ? "yes" : "no");
if (blackList.size() > 0U)
LogInfo(" Black List: %u", blackList.size());
dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, rssi);
dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, ackTime, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, rssi);
}
CDMRControl* dmr = NULL;