Make the D-Star ack optional.

This commit is contained in:
Jonathan Naylor
2017-06-10 13:18:18 +01:00
parent 6d2123cc49
commit 043ffe96d9
6 changed files with 22 additions and 5 deletions

View File

@@ -100,6 +100,7 @@ m_dstarEnabled(false),
m_dstarModule("C"), m_dstarModule("C"),
m_dstarSelfOnly(false), m_dstarSelfOnly(false),
m_dstarBlackList(), m_dstarBlackList(),
m_dstarAckReply(true),
m_dstarErrorReply(true), m_dstarErrorReply(true),
m_dmrEnabled(false), m_dmrEnabled(false),
m_dmrBeacons(false), m_dmrBeacons(false),
@@ -373,7 +374,9 @@ bool CConf::read()
} }
p = ::strtok(NULL, ",\r\n"); p = ::strtok(NULL, ",\r\n");
} }
} else if (::strcmp(key, "ErrorReply") == 0) } else if (::strcmp(key, "AckReply") == 0)
m_dstarAckReply = ::atoi(value) == 1;
else if (::strcmp(key, "ErrorReply") == 0)
m_dstarErrorReply = ::atoi(value) == 1; m_dstarErrorReply = ::atoi(value) == 1;
} else if (section == SECTION_DMR) { } else if (section == SECTION_DMR) {
if (::strcmp(key, "Enable") == 0) if (::strcmp(key, "Enable") == 0)
@@ -805,6 +808,11 @@ std::vector<std::string> CConf::getDStarBlackList() const
return m_dstarBlackList; return m_dstarBlackList;
} }
bool CConf::getDStarAckReply() const
{
return m_dstarAckReply;
}
bool CConf::getDStarErrorReply() const bool CConf::getDStarErrorReply() const
{ {
return m_dstarErrorReply; return m_dstarErrorReply;

2
Conf.h
View File

@@ -91,6 +91,7 @@ public:
std::string getDStarModule() const; std::string getDStarModule() const;
bool getDStarSelfOnly() const; bool getDStarSelfOnly() const;
std::vector<std::string> getDStarBlackList() const; std::vector<std::string> getDStarBlackList() const;
bool getDStarAckReply() const;
bool getDStarErrorReply() const; bool getDStarErrorReply() const;
// The DMR section // The DMR section
@@ -244,6 +245,7 @@ private:
std::string m_dstarModule; std::string m_dstarModule;
bool m_dstarSelfOnly; bool m_dstarSelfOnly;
std::vector<std::string> m_dstarBlackList; std::vector<std::string> m_dstarBlackList;
bool m_dstarAckReply;
bool m_dstarErrorReply; bool m_dstarErrorReply;
bool m_dmrEnabled; bool m_dmrEnabled;

View File

@@ -36,10 +36,11 @@ bool CallsignCompare(const std::string& arg, const unsigned char* my)
// #define DUMP_DSTAR // #define DUMP_DSTAR
CDStarControl::CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, 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, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper) :
m_callsign(NULL), m_callsign(NULL),
m_gateway(NULL), m_gateway(NULL),
m_selfOnly(selfOnly), m_selfOnly(selfOnly),
m_ackReply(ackReply),
m_errorReply(errorReply), m_errorReply(errorReply),
m_blackList(blackList), m_blackList(blackList),
m_network(network), m_network(network),
@@ -523,7 +524,9 @@ void CDStarControl::writeEndRF()
if (m_netState == RS_NET_IDLE) { if (m_netState == RS_NET_IDLE) {
m_display->clearDStar(); m_display->clearDStar();
m_ackTimer.start();
if (m_ackReply)
m_ackTimer.start();
if (m_network != NULL) if (m_network != NULL)
m_network->reset(); m_network->reset();

View File

@@ -37,7 +37,7 @@
class CDStarControl { class CDStarControl {
public: public:
CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, 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, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper);
~CDStarControl(); ~CDStarControl();
bool writeModem(unsigned char* data, unsigned int len); bool writeModem(unsigned char* data, unsigned int len);
@@ -50,6 +50,7 @@ private:
unsigned char* m_callsign; unsigned char* m_callsign;
unsigned char* m_gateway; unsigned char* m_gateway;
bool m_selfOnly; bool m_selfOnly;
bool m_ackReply;
bool m_errorReply; bool m_errorReply;
std::vector<std::string> m_blackList; std::vector<std::string> m_blackList;
CDStarNetwork* m_network; CDStarNetwork* m_network;

View File

@@ -63,6 +63,7 @@ Port=/dev/ttyACM1
Enable=1 Enable=1
Module=C Module=C
SelfOnly=0 SelfOnly=0
AckReply=1
ErrorReply=1 ErrorReply=1
[DMR] [DMR]

View File

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