mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 06:55:52 +08:00
Flush the queues if new data comes in.
This commit is contained in:
@@ -153,7 +153,6 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
did = lc->getDstId();
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
||||||
@@ -162,6 +161,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
|
|
||||||
m_rfLC = lc;
|
m_rfLC = lc;
|
||||||
|
|
||||||
@@ -518,7 +518,6 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
did = lc->getDstId();
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
||||||
@@ -527,6 +526,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
|
|
||||||
m_rfLC = lc;
|
m_rfLC = lc;
|
||||||
|
|
||||||
@@ -807,6 +807,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
|
|
||||||
// Store the LC for the embedded LC
|
// Store the LC for the embedded LC
|
||||||
m_netEmbeddedLC.setData(*m_netLC);
|
m_netEmbeddedLC.setData(*m_netLC);
|
||||||
@@ -1035,6 +1036,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
|
|
||||||
m_netTimeoutTimer.start();
|
m_netTimeoutTimer.start();
|
||||||
|
|
||||||
|
|||||||
20
Modem.cpp
20
Modem.cpp
@@ -57,6 +57,7 @@ const unsigned char MMDVM_DMR_DATA2 = 0x1AU;
|
|||||||
const unsigned char MMDVM_DMR_LOST2 = 0x1BU;
|
const unsigned char MMDVM_DMR_LOST2 = 0x1BU;
|
||||||
const unsigned char MMDVM_DMR_SHORTLC = 0x1CU;
|
const unsigned char MMDVM_DMR_SHORTLC = 0x1CU;
|
||||||
const unsigned char MMDVM_DMR_START = 0x1DU;
|
const unsigned char MMDVM_DMR_START = 0x1DU;
|
||||||
|
const unsigned char MMDVM_DMR_ABORT = 0x1EU;
|
||||||
|
|
||||||
const unsigned char MMDVM_YSF_DATA = 0x20U;
|
const unsigned char MMDVM_YSF_DATA = 0x20U;
|
||||||
const unsigned char MMDVM_YSF_LOST = 0x21U;
|
const unsigned char MMDVM_YSF_LOST = 0x21U;
|
||||||
@@ -1035,6 +1036,25 @@ bool CModem::writeDMRStart(bool tx)
|
|||||||
return m_serial.write(buffer, 4U) == 4;
|
return m_serial.write(buffer, 4U) == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CModem::writeDMRAbort(unsigned int slotNo)
|
||||||
|
{
|
||||||
|
if (slotNo == 1U)
|
||||||
|
m_txDMRData1.clear();
|
||||||
|
else
|
||||||
|
m_txDMRData2.clear();
|
||||||
|
|
||||||
|
unsigned char buffer[4U];
|
||||||
|
|
||||||
|
buffer[0U] = MMDVM_FRAME_START;
|
||||||
|
buffer[1U] = 4U;
|
||||||
|
buffer[2U] = MMDVM_DMR_ABORT;
|
||||||
|
buffer[3U] = slotNo;
|
||||||
|
|
||||||
|
// CUtils::dump(1U, "Written", buffer, 4U);
|
||||||
|
|
||||||
|
return m_serial.write(buffer, 4U) == 4;
|
||||||
|
}
|
||||||
|
|
||||||
bool CModem::writeDMRShortLC(const unsigned char* lc)
|
bool CModem::writeDMRShortLC(const unsigned char* lc)
|
||||||
{
|
{
|
||||||
assert(lc != NULL);
|
assert(lc != NULL);
|
||||||
|
|||||||
1
Modem.h
1
Modem.h
@@ -64,6 +64,7 @@ public:
|
|||||||
|
|
||||||
bool writeDMRStart(bool tx);
|
bool writeDMRStart(bool tx);
|
||||||
bool writeDMRShortLC(const unsigned char* lc);
|
bool writeDMRShortLC(const unsigned char* lc);
|
||||||
|
bool writeDMRAbort(unsigned int slotNo);
|
||||||
|
|
||||||
bool setMode(unsigned char mode);
|
bool setMode(unsigned char mode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user