From fd898994d4e018b861d428a695d72a13210dadce Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sat, 1 Oct 2022 20:57:08 -0400 Subject: [PATCH] add support for firmware CACH AT ignore command; properly set DMR site data to require registration of SUs; --- dmr/Slot.cpp | 5 ++++- modem/Modem.cpp | 30 ++++++++++++++++++++++++++++++ modem/Modem.h | 3 +++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dmr/Slot.cpp b/dmr/Slot.cpp index f49ca30b..50546780 100644 --- a/dmr/Slot.cpp +++ b/dmr/Slot.cpp @@ -541,6 +541,9 @@ void Slot::setTSCC(bool enable, bool dedicated) { m_enableTSCC = enable; m_dedicatedTSCC = dedicated; + if (m_enableTSCC) { + m_modem->setDMRIgnoreCACH_AT(m_slotNo); + } } /// @@ -622,7 +625,7 @@ void Slot::init(uint32_t colorCode, SiteData siteData, bool embeddedLCOnly, bool /// Channel Number. void Slot::setSiteData(uint32_t netId, uint8_t siteId, uint8_t channelId, uint32_t channelNo) { - m_siteData = SiteData(SITE_MODEL_SMALL, netId, siteId, 3U, false); + m_siteData = SiteData(SITE_MODEL_SMALL, netId, siteId, 3U, true); m_channelNo = channelNo; std::vector entries = m_idenTable->list(); diff --git a/modem/Modem.cpp b/modem/Modem.cpp index 00400b0f..8862aa50 100644 --- a/modem/Modem.cpp +++ b/modem/Modem.cpp @@ -1651,6 +1651,36 @@ bool Modem::writeDMRAbort(uint32_t slotNo) #endif // defined(ENABLE_DMR) } +/// +/// Sets the ignore flags for setting the CACH Access Type bit on the air interface modem. +/// +/// DMR slot to set ignore CACH AT flag for. +/// True, if set flag is written, otherwise false. +bool Modem::setDMRIgnoreCACH_AT(uint8_t slotNo) +{ +#if defined(ENABLE_DMR) + uint8_t buffer[4U]; + + buffer[0U] = DVM_FRAME_START; + buffer[1U] = 4U; + buffer[2U] = CMD_DMR_CACH_AT_CTRL; + buffer[3U] = slotNo; + + // are we on a protocol version 3 firmware? + if (m_protoVer >= 3U) { +#if DEBUG_MODEM + Utils::dump(1U, "Modem::setDMRIgnoreCACH_AT(), Written", buffer, 4U); +#endif + return write(buffer, 4U) == 4; + } else { + LogWarning(LOG_MODEM, "Modem::setDMRIgnoreCACH_AT(), ignoring CACH AT for slot %u is not supported on this modem!", slotNo); + return false; + } +#else + return false; +#endif // defined(ENABLE_DMR) +} + /// /// Writes raw data to the air interface modem. /// diff --git a/modem/Modem.h b/modem/Modem.h index 15f3665c..8246af19 100644 --- a/modem/Modem.h +++ b/modem/Modem.h @@ -117,6 +117,7 @@ namespace modem CMD_DMR_SHORTLC = 0x1CU, CMD_DMR_START = 0x1DU, CMD_DMR_ABORT = 0x1EU, + CMD_DMR_CACH_AT_CTRL = 0x1FU, CMD_P25_DATA = 0x31U, CMD_P25_LOST = 0x32U, @@ -328,6 +329,8 @@ namespace modem bool writeDMRShortLC(const uint8_t* lc); /// Writes a DMR abort message for the given slot to the air interface modem. bool writeDMRAbort(uint32_t slotNo); + /// Sets the ignore flags for setting the CACH Access Type bit on the air interface modem. + bool setDMRIgnoreCACH_AT(uint8_t slotNo); /// Writes raw data to the air interface modem. int write(const uint8_t* data, uint32_t length);