Add the DMR Abort command.

This commit is contained in:
Jonathan Naylor 2016-06-17 07:47:11 +01:00
parent 195f94c368
commit 4dbcfd6b04
3 changed files with 31 additions and 0 deletions

View File

@ -185,6 +185,25 @@ uint8_t CDMRTX::writeShortLC(const uint8_t* data, uint8_t length)
return 0U;
}
uint8_t CDMRTX::writeAbort(const uint8_t* data, uint8_t length)
{
if (length != 1U)
return 4U;
switch (data[0U]) {
case 1U:
m_fifo[0U].reset();
return 0U;
case 2U:
m_fifo[1U].reset();
return 0U;
default:
return 4U;
}
}
void CDMRTX::setStart(bool start)
{
m_state = start ? DMRTXSTATE_SLOT1 : DMRTXSTATE_IDLE;

View File

@ -40,7 +40,9 @@ public:
uint8_t writeData1(const uint8_t* data, uint8_t length);
uint8_t writeData2(const uint8_t* data, uint8_t length);
uint8_t writeShortLC(const uint8_t* data, uint8_t length);
uint8_t writeAbort(const uint8_t* data, uint8_t length);
void setStart(bool start);
void setCal(bool start);

View File

@ -47,6 +47,7 @@ const uint8_t MMDVM_DMR_DATA2 = 0x1AU;
const uint8_t MMDVM_DMR_LOST2 = 0x1BU;
const uint8_t MMDVM_DMR_SHORTLC = 0x1CU;
const uint8_t MMDVM_DMR_START = 0x1DU;
const uint8_t MMDVM_DMR_ABORT = 0x1EU;
const uint8_t MMDVM_YSF_DATA = 0x20U;
const uint8_t MMDVM_YSF_LOST = 0x21U;
@ -521,6 +522,15 @@ void CSerialPort::process()
}
break;
case MMDVM_DMR_ABORT:
if (m_dmrEnable)
err = dmrTX.writeAbort(m_buffer + 3U, m_len - 3U);
if (err != 0U) {
DEBUG2("Received invalid DMR Abort", err);
sendNAK(err);
}
break;
case MMDVM_YSF_DATA:
if (m_ysfEnable) {
if (m_modemState == STATE_IDLE || m_modemState == STATE_YSF)