Merge pull request #460 from lucamarche-iz1mlt/master
Add select ack message dstar
This commit is contained in:
commit
f149cc48f9
6 changed files with 44 additions and 13 deletions
10
Conf.cpp
10
Conf.cpp
|
@ -123,6 +123,7 @@ m_dstarSelfOnly(false),
|
|||
m_dstarBlackList(),
|
||||
m_dstarAckReply(true),
|
||||
m_dstarAckTime(750U),
|
||||
m_dstarAckMessage(false),
|
||||
m_dstarErrorReply(true),
|
||||
m_dstarRemoteGateway(false),
|
||||
m_dstarModeHang(10U),
|
||||
|
@ -495,10 +496,12 @@ bool CConf::read()
|
|||
}
|
||||
p = ::strtok(NULL, ",\r\n");
|
||||
}
|
||||
} else if (::strcmp(key, "AckReply") == 0)
|
||||
}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, "AckMessage") == 0)
|
||||
m_dstarAckMessage = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "ErrorReply") == 0)
|
||||
m_dstarErrorReply = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "RemoteGateway") == 0)
|
||||
|
@ -1105,6 +1108,11 @@ unsigned int CConf::getDStarAckTime() const
|
|||
return m_dstarAckTime;
|
||||
}
|
||||
|
||||
bool CConf::getDStarAckMessage() const
|
||||
{
|
||||
return m_dstarAckMessage;
|
||||
}
|
||||
|
||||
bool CConf::getDStarErrorReply() const
|
||||
{
|
||||
return m_dstarErrorReply;
|
||||
|
|
2
Conf.h
2
Conf.h
|
@ -112,6 +112,7 @@ public:
|
|||
std::vector<std::string> getDStarBlackList() const;
|
||||
bool getDStarAckReply() const;
|
||||
unsigned int getDStarAckTime() const;
|
||||
bool getDStarAckMessage() const;
|
||||
bool getDStarErrorReply() const;
|
||||
bool getDStarRemoteGateway() const;
|
||||
unsigned int getDStarModeHang() const;
|
||||
|
@ -335,6 +336,7 @@ private:
|
|||
std::vector<std::string> m_dstarBlackList;
|
||||
bool m_dstarAckReply;
|
||||
unsigned int m_dstarAckTime;
|
||||
bool m_dstarAckMessage;
|
||||
bool m_dstarErrorReply;
|
||||
bool m_dstarRemoteGateway;
|
||||
unsigned int m_dstarModeHang;
|
||||
|
|
|
@ -36,11 +36,12 @@ 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, unsigned int ackTime, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper) :
|
||||
CDStarControl::CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, unsigned int ackTime, bool ackMessage, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper) :
|
||||
m_callsign(NULL),
|
||||
m_gateway(NULL),
|
||||
m_selfOnly(selfOnly),
|
||||
m_ackReply(ackReply),
|
||||
m_ackMessage(ackMessage),
|
||||
m_errorReply(errorReply),
|
||||
m_remoteGateway(remoteGateway),
|
||||
m_blackList(blackList),
|
||||
|
@ -1049,10 +1050,18 @@ void CDStarControl::sendAck()
|
|||
m_network->getStatus(status, reflector);
|
||||
|
||||
char text[40U];
|
||||
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
|
||||
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
else
|
||||
::sprintf(text, "BER: %.1f%% ", float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
if (m_ackMessage && m_rssi != 0) {
|
||||
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
|
||||
::sprintf(text, "%-8.8s -%udBm ", reflector, m_aveRSSI / m_rssiCount);
|
||||
else
|
||||
::sprintf(text, "BER:%.1f%% -%udBm ", float(m_rfErrs * 100U) / float(m_rfBits), m_aveRSSI / m_rssiCount);
|
||||
}
|
||||
else {
|
||||
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
|
||||
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
else
|
||||
::sprintf(text, "BER: %.1f%% ", float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
}
|
||||
m_slowData.setText(text);
|
||||
|
||||
::memcpy(data, DSTAR_NULL_FRAME_DATA_BYTES, DSTAR_FRAME_LENGTH_BYTES + 1U);
|
||||
|
@ -1091,10 +1100,18 @@ void CDStarControl::sendError()
|
|||
m_network->getStatus(status, reflector);
|
||||
|
||||
char text[40U];
|
||||
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
|
||||
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
else
|
||||
::sprintf(text, "BER: %.1f%% ", float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
if (m_ackMessage && m_rssi != 0) {
|
||||
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
|
||||
::sprintf(text, "%-8.8s -%udBm ", reflector, m_aveRSSI / m_rssiCount);
|
||||
else
|
||||
::sprintf(text, "BER:%.1f%% -%udBm ", float(m_rfErrs * 100U) / float(m_rfBits), m_aveRSSI / m_rssiCount);
|
||||
}
|
||||
else {
|
||||
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
|
||||
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
else
|
||||
::sprintf(text, "BER: %.1f%% ", float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
}
|
||||
m_slowData.setText(text);
|
||||
|
||||
::memcpy(data, DSTAR_NULL_FRAME_DATA_BYTES, DSTAR_FRAME_LENGTH_BYTES + 1U);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
class CDStarControl {
|
||||
public:
|
||||
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, bool remoteGateway, CRSSIInterpolator* rssiMapper);
|
||||
CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, unsigned int ackTime, bool ackMessage, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper);
|
||||
~CDStarControl();
|
||||
|
||||
bool writeModem(unsigned char* data, unsigned int len);
|
||||
|
@ -52,6 +52,7 @@ private:
|
|||
bool m_selfOnly;
|
||||
bool m_ackReply;
|
||||
bool m_errorReply;
|
||||
bool m_ackMessage;
|
||||
bool m_remoteGateway;
|
||||
std::vector<std::string> m_blackList;
|
||||
CDStarNetwork* m_network;
|
||||
|
|
|
@ -87,6 +87,7 @@ Module=C
|
|||
SelfOnly=0
|
||||
AckReply=1
|
||||
AckTime=750
|
||||
AckMessage=0
|
||||
ErrorReply=1
|
||||
RemoteGateway=0
|
||||
# ModeHang=10
|
||||
|
|
|
@ -390,6 +390,7 @@ int CMMDVMHost::run()
|
|||
std::vector<std::string> blackList = m_conf.getDStarBlackList();
|
||||
bool ackReply = m_conf.getDStarAckReply();
|
||||
unsigned int ackTime = m_conf.getDStarAckTime();
|
||||
bool ackMessage = m_conf.getDStarAckMessage();
|
||||
bool errorReply = m_conf.getDStarErrorReply();
|
||||
bool remoteGateway = m_conf.getDStarRemoteGateway();
|
||||
m_dstarRFModeHang = m_conf.getDStarModeHang();
|
||||
|
@ -398,6 +399,7 @@ int CMMDVMHost::run()
|
|||
LogInfo(" Module: %s", module.c_str());
|
||||
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
||||
LogInfo(" Ack Reply: %s", ackReply ? "yes" : "no");
|
||||
LogInfo(" Ack message: %s", ackMessage ? "RSSI" : "BER");
|
||||
LogInfo(" Ack Time: %ums", ackTime);
|
||||
LogInfo(" Error Reply: %s", errorReply ? "yes" : "no");
|
||||
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
||||
|
@ -406,7 +408,7 @@ int CMMDVMHost::run()
|
|||
if (blackList.size() > 0U)
|
||||
LogInfo(" Black List: %u", blackList.size());
|
||||
|
||||
dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, ackTime, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi);
|
||||
dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, ackTime, ackMessage, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi);
|
||||
}
|
||||
|
||||
CTimer dmrBeaconIntervalTimer(1000U);
|
||||
|
|
Loading…
Reference in a new issue