Skip to content

Commit

Permalink
Make AckTime adjustable
Browse files Browse the repository at this point in the history
  • Loading branch information
phl0 committed Jun 14, 2017
1 parent 348e682 commit f0fc7c7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ m_dstarModule("C"),
m_dstarSelfOnly(false),
m_dstarBlackList(),
m_dstarAckReply(true),
m_dstarAckTime(1000U),
m_dstarErrorReply(true),
m_dmrEnabled(false),
m_dmrBeacons(false),
Expand Down Expand Up @@ -376,6 +377,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) {
Expand Down Expand Up @@ -813,6 +816,11 @@ bool CConf::getDStarAckReply() const
return m_dstarAckReply;
}

unsigned int CConf::getDStarAckTime() const
{
return m_dstarAckTime;
}

bool CConf::getDStarErrorReply() const
{
return m_dstarErrorReply;
Expand Down
2 changes: 2 additions & 0 deletions Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class CConf
bool getDStarSelfOnly() const;
std::vector<std::string> getDStarBlackList() const;
bool getDStarAckReply() const;
unsigned int getDStarAckTime() const;
bool getDStarErrorReply() const;

// The DMR section
Expand Down Expand Up @@ -246,6 +247,7 @@ class CConf
bool m_dstarSelfOnly;
std::vector<std::string> m_dstarBlackList;
bool m_dstarAckReply;
unsigned int m_dstarAckTime;
bool m_dstarErrorReply;

bool m_dmrEnabled;
Expand Down
4 changes: 2 additions & 2 deletions DStarControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -59,7 +59,7 @@ m_networkWatchdog(1000U, 0U, 1500U),
m_rfTimeoutTimer(1000U, timeout),
m_netTimeoutTimer(1000U, timeout),
m_packetTimer(1000U, 0U, 300U),
m_ackTimer(1000U, 0U, 750U),
m_ackTimer(ackTime, 0U, 750U),
m_errTimer(1000U, 0U, 750U),
m_interval(),
m_elapsed(),
Expand Down
2 changes: 1 addition & 1 deletion DStarControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions MMDVM.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Enable=1
Module=C
SelfOnly=0
AckReply=1
AckTime=1000
ErrorReply=1

[DMR]
Expand Down
12 changes: 7 additions & 5 deletions MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f0fc7c7

Please sign in to comment.