Drop duplicate and out-of-sequence DMR audio frames from RF

This commit is contained in:
Andy CA6JAU 2018-07-21 21:01:55 -04:00
parent e5c2ede05c
commit 3694da2dcd
2 changed files with 13 additions and 0 deletions

View file

@ -89,6 +89,7 @@ m_rfLC(NULL),
m_netLC(NULL),
m_rfSeqNo(0U),
m_rfN(0U),
m_lastrfN(0U),
m_netN(0U),
m_networkWatchdog(1000U, 0U, 1500U),
m_rfTimeoutTimer(1000U, timeout),
@ -529,6 +530,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
}
} else if (audioSync) {
if (m_rfState == RS_RF_AUDIO) {
m_lastrfN = 0;
// Convert the Audio Sync to be from the BS or MS as needed
CSync::addDMRAudioSync(data + 2U, m_duplex);
@ -574,6 +576,11 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
m_rfN = data[1U] & 0x0FU;
if (m_rfN > 5U)
return false;
if (m_rfN == m_lastrfN)
return false;
if (m_rfN != (m_lastrfN + 1U))
return false;
m_lastrfN = m_rfN;
unsigned int errors = 0U;
unsigned char fid = m_rfLC->getFID();
@ -816,6 +823,11 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
m_rfN = data[1U] & 0x0FU;
if (m_rfN > 5U)
return false;
if (m_rfN == m_lastrfN)
return false;
if (m_rfN != (m_lastrfN + 1U))
return false;
m_lastrfN = m_rfN;
// Regenerate the EMB
emb.getData(data + 2U);

View file

@ -79,6 +79,7 @@ private:
CDMRLC* m_netLC;
unsigned char m_rfSeqNo;
unsigned char m_rfN;
unsigned char m_lastrfN;
unsigned char m_netN;
CTimer m_networkWatchdog;
CTimer m_rfTimeoutTimer;