diff --git a/src/dmr/Control.cpp b/src/dmr/Control.cpp
index 66d6c8a1..ff12b93d 100644
--- a/src/dmr/Control.cpp
+++ b/src/dmr/Control.cpp
@@ -153,10 +153,12 @@ void Control::setOptions(yaml::Node& conf, bool controlPermitTG, const std::vect
case 1U:
m_slot1->setTSCC(enableTSCC, dedicatedTSCC);
m_slot1->setControlPermitTG(m_controlPermitTG);
+ //m_slot2->setTSCCPayload(true); // this is not the correct way this should be done
break;
case 2U:
m_slot2->setTSCC(enableTSCC, dedicatedTSCC);
m_slot2->setControlPermitTG(m_controlPermitTG);
+ //m_slot1->setTSCCPayload(true); // this is not the correct way this should be done
break;
default:
LogError(LOG_DMR, "DMR, invalid slot, TSCC disabled, slotNo = %u", m_tsccSlotNo);
diff --git a/src/dmr/DMRDefines.h b/src/dmr/DMRDefines.h
index 5c843fb1..5791a04d 100644
--- a/src/dmr/DMRDefines.h
+++ b/src/dmr/DMRDefines.h
@@ -222,6 +222,7 @@ namespace dmr
const uint8_t SLCO_NULL = 0x00U;
const uint8_t SLCO_ACT = 0x01U;
const uint8_t SLCO_TSCC = 0x02U;
+ const uint8_t SLCO_PAYLOAD = 0x03U;
// Reason Code(s)
const uint8_t TS_ACK_RSN_MSG = 0x60U; // TS - Message Accepted
diff --git a/src/dmr/Slot.cpp b/src/dmr/Slot.cpp
index 5c335054..9e9599a3 100644
--- a/src/dmr/Slot.cpp
+++ b/src/dmr/Slot.cpp
@@ -414,6 +414,12 @@ void Slot::clock()
}
}
+ // increment the TSCC counter on every slot 1 clock
+ m_tsccCnt++;
+ if (m_tsccCnt == TSCC_MAX_CNT) {
+ m_tsccCnt = 0U;
+ }
+
// if we have control enabled; do clocking to generate a CC data stream
if (m_enableTSCC) {
// clock all the grant timers
@@ -438,12 +444,6 @@ void Slot::clock()
if (m_ccPacketInterval.isRunning() && m_ccPacketInterval.hasExpired()) {
if (m_ccRunning) {
- // increment the TSCC counter on every slot 1 clock
- m_tsccCnt++;
- if (m_tsccCnt == TSCC_MAX_CNT) {
- m_tsccCnt = 0U;
- }
-
if (m_ccSeq == 3U) {
m_ccSeq = 0U;
}
@@ -464,6 +464,10 @@ void Slot::clock()
}
}
+ if (m_tsccPayloadSlot) {
+ setShortLC_Payload(m_siteData, m_tsccCnt);
+ }
+
m_rfTimeoutTimer.clock(ms);
if (m_rfTimeoutTimer.isRunning() && m_rfTimeoutTimer.hasExpired()) {
if (!m_rfTimeout) {
@@ -1072,7 +1076,6 @@ void Slot::setShortLC(uint32_t slotNo, uint32_t id, uint8_t flco, bool voice)
///
///
///
-///
///
///
void Slot::setShortLC_TSCC(SiteData siteData, uint16_t counter)
@@ -1132,3 +1135,66 @@ void Slot::setShortLC_TSCC(SiteData siteData, uint16_t counter)
m_modem->writeDMRShortLC(sLC);
}
+
+///
+///
+///
+///
+///
+void Slot::setShortLC_Payload(SiteData siteData, uint16_t counter)
+{
+ assert(m_modem != nullptr);
+
+ uint8_t lc[5U];
+ uint32_t lcValue = 0U;
+ lcValue = SLCO_PAYLOAD;
+ lcValue = (lcValue << 2) + siteData.siteModel();
+
+ switch (siteData.siteModel())
+ {
+ case SITE_MODEL_TINY:
+ {
+ lcValue = (lcValue << 9) + siteData.netId();
+ lcValue = (lcValue << 3) + siteData.siteId();
+ }
+ break;
+ case SITE_MODEL_SMALL:
+ {
+ lcValue = (lcValue << 7) + siteData.netId();
+ lcValue = (lcValue << 5) + siteData.siteId();
+ }
+ break;
+ case SITE_MODEL_LARGE:
+ {
+ lcValue = (lcValue << 5) + siteData.netId();
+ lcValue = (lcValue << 7) + siteData.siteId();
+ }
+ break;
+ case SITE_MODEL_HUGE:
+ {
+ lcValue = (lcValue << 2) + siteData.netId();
+ lcValue = (lcValue << 10) + siteData.siteId();
+ }
+ break;
+ }
+
+ lcValue = (lcValue << 1) + 0U; // Payload channel is Normal
+ lcValue = (lcValue << 9) + (counter & 0x1FFU);
+
+ // split value into bytes
+ lc[0U] = (uint8_t)((lcValue >> 24) & 0xFFU);
+ lc[1U] = (uint8_t)((lcValue >> 16) & 0xFFU);
+ lc[2U] = (uint8_t)((lcValue >> 8) & 0xFFU);
+ lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU);
+ lc[4U] = edac::CRC::crc8(lc, 4U);
+
+ //LogDebug(LOG_DMR, "setShortLC_Payload, netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId());
+ //Utils::dump(1U, "setShortLC_Payload", lc, 5U);
+
+ uint8_t sLC[9U];
+
+ lc::ShortLC shortLC;
+ shortLC.encode(lc, sLC);
+
+ m_modem->writeDMRShortLC(sLC);
+}
diff --git a/src/dmr/Slot.h b/src/dmr/Slot.h
index 7e155f75..45b76565 100644
--- a/src/dmr/Slot.h
+++ b/src/dmr/Slot.h
@@ -105,6 +105,8 @@ namespace dmr
/// Helper to enable and configure TSCC support for this slot.
void setTSCC(bool enable, bool dedicated);
+ /// Sets a flag indicating whether the slot is a TSCC payload slot.
+ void setTSCCPayload(bool payload) { m_tsccPayloadSlot = payload; }
/// Sets a flag indicating whether the DMR control channel can send permit-tg to voice channels.
void setControlPermitTG(bool controlPermitTG) { m_controlPermitTG = controlPermitTG; }
/// Helper to set the voice error silence threshold.
@@ -189,6 +191,7 @@ namespace dmr
bool m_enableTSCC;
bool m_dedicatedTSCC;
+ bool m_tsccPayloadSlot;
bool m_controlPermitTG;
@@ -264,6 +267,8 @@ namespace dmr
static void setShortLC(uint32_t slotNo, uint32_t id, uint8_t flco = FLCO_GROUP, bool voice = true);
/// Helper to set the DMR short LC for TSCC.
static void setShortLC_TSCC(SiteData siteData, uint16_t counter);
+ /// Helper to set the DMR short LC for payload.
+ static void setShortLC_Payload(SiteData siteData, uint16_t counter);
};
} // namespace dmr