Improve D-Star error debugging.

This commit is contained in:
Jonathan Naylor 2016-04-19 17:15:37 +01:00
parent 0a74e8270f
commit 2b76af2e7b

View file

@ -126,19 +126,23 @@ bool CDStarControl::writeModem(unsigned char *data)
if (type == TAG_HEADER) { if (type == TAG_HEADER) {
CDStarHeader header(data + 1U); CDStarHeader header(data + 1U);
unsigned char my1[DSTAR_LONG_CALLSIGN_LENGTH];
header.getMyCall1(my1);
// Is this a transmission destined for a repeater? // Is this a transmission destined for a repeater?
if (!header.isRepeater()) if (!header.isRepeater()) {
LogMessage("D-Star, non repeater RF header received from %8.8s", my1);
return false; return false;
}
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH]; unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
header.getRPTCall1(callsign); header.getRPTCall1(callsign);
// Is it for us? // Is it for us?
if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0) if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0) {
LogMessage("D-Star, received RF header for wrong repeater (%8.8s) from %8.8s", callsign, my1);
return false; return false;
}
unsigned char my1[DSTAR_LONG_CALLSIGN_LENGTH];
header.getMyCall1(my1);
if (m_selfOnly && ::memcmp(my1, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH - 1U) != 0) { if (m_selfOnly && ::memcmp(my1, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH - 1U) != 0) {
LogMessage("D-Star, invalid access attempt from %8.8s", my1); LogMessage("D-Star, invalid access attempt from %8.8s", my1);
@ -283,13 +287,11 @@ bool CDStarControl::writeModem(unsigned char *data)
header->getMyCall1(my1); header->getMyCall1(my1);
if (m_selfOnly && ::memcmp(my1, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH - 1U) != 0) { if (m_selfOnly && ::memcmp(my1, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH - 1U) != 0) {
LogMessage("D-Star, invalid access attempt from %8.8s", my1);
delete header; delete header;
return false; return false;
} }
if (!m_selfOnly && std::find_if(m_blackList.begin(), m_blackList.end(), std::bind(CallsignCompare, std::placeholders::_1, my1)) != m_blackList.end()) { if (!m_selfOnly && std::find_if(m_blackList.begin(), m_blackList.end(), std::bind(CallsignCompare, std::placeholders::_1, my1)) != m_blackList.end()) {
LogMessage("D-Star, invalid access attempt from %8.8s", my1);
delete header; delete header;
return false; return false;
} }