Add rejected state to incoming RF data.
This commit is contained in:
parent
6f848722f9
commit
9035656eeb
|
@ -117,7 +117,6 @@ bool CDStarControl::writeModem(unsigned char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == TAG_LOST) {
|
if (type == TAG_LOST) {
|
||||||
if (m_rfState == RS_RF_LATE_ENTRY)
|
|
||||||
m_rfState = RS_RF_LISTENING;
|
m_rfState = RS_RF_LISTENING;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +130,7 @@ bool CDStarControl::writeModem(unsigned char *data)
|
||||||
// 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);
|
LogMessage("D-Star, non repeater RF header received from %8.8s", my1);
|
||||||
|
m_rfState = RS_RF_REJECTED;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,16 +140,19 @@ bool CDStarControl::writeModem(unsigned char *data)
|
||||||
// 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);
|
LogMessage("D-Star, received RF header for wrong repeater (%8.8s) from %8.8s", callsign, my1);
|
||||||
|
m_rfState = RS_RF_REJECTED;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
m_rfState = RS_RF_REJECTED;
|
||||||
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);
|
LogMessage("D-Star, invalid access attempt from %8.8s", my1);
|
||||||
|
m_rfState = RS_RF_REJECTED;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +208,9 @@ bool CDStarControl::writeModem(unsigned char *data)
|
||||||
|
|
||||||
LogMessage("D-Star, received RF header from %8.8s/%4.4s to %8.8s", my1, my2, your);
|
LogMessage("D-Star, received RF header from %8.8s/%4.4s to %8.8s", my1, my2, your);
|
||||||
} else if (type == TAG_EOT) {
|
} else if (type == TAG_EOT) {
|
||||||
if (m_rfState == RS_RF_AUDIO) {
|
if (m_rfState == RS_RF_REJECTED) {
|
||||||
|
m_rfState = RS_RF_LISTENING;
|
||||||
|
} else if (m_rfState == RS_RF_AUDIO) {
|
||||||
if (m_net)
|
if (m_net)
|
||||||
writeNetworkDataRF(DSTAR_END_PATTERN_BYTES, 0U, true);
|
writeNetworkDataRF(DSTAR_END_PATTERN_BYTES, 0U, true);
|
||||||
|
|
||||||
|
@ -220,7 +225,9 @@ bool CDStarControl::writeModem(unsigned char *data)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (type == TAG_DATA) {
|
} else if (type == TAG_DATA) {
|
||||||
if (m_rfState == RS_RF_LISTENING) {
|
if (m_rfState == RS_RF_REJECTED) {
|
||||||
|
return false;
|
||||||
|
} else if (m_rfState == RS_RF_LISTENING) {
|
||||||
// The sync is regenerated by the modem so can do exact match
|
// The sync is regenerated by the modem so can do exact match
|
||||||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
||||||
m_slowData.start();
|
m_slowData.start();
|
||||||
|
@ -436,7 +443,7 @@ void CDStarControl::writeNetwork()
|
||||||
if (length == 0U)
|
if (length == 0U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_rfState != RS_RF_LISTENING && m_netState == RS_NET_IDLE)
|
if (m_rfState == RS_RF_AUDIO && m_netState == RS_NET_IDLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_networkWatchdog.start();
|
m_networkWatchdog.start();
|
||||||
|
|
Loading…
Reference in a new issue