diff --git a/src/common/lookups/TalkgroupRulesLookup.cpp b/src/common/lookups/TalkgroupRulesLookup.cpp index f581b976..d79861b6 100644 --- a/src/common/lookups/TalkgroupRulesLookup.cpp +++ b/src/common/lookups/TalkgroupRulesLookup.cpp @@ -105,13 +105,14 @@ void TalkgroupRulesLookup::clear() /* Adds a new entry to the lookup table by the specified unique ID. */ -void TalkgroupRulesLookup::addEntry(uint32_t id, uint8_t slot, bool enabled, bool nonPreferred) +void TalkgroupRulesLookup::addEntry(uint32_t id, uint8_t slot, bool enabled, bool affiliated, bool nonPreferred) { TalkgroupRuleGroupVoiceSource source; TalkgroupRuleConfig config; source.tgId(id); source.tgSlot(slot); config.active(enabled); + config.affiliated(affiliated); config.nonPreferred(nonPreferred); std::lock_guard lock(m_mutex); @@ -131,6 +132,7 @@ void TalkgroupRulesLookup::addEntry(uint32_t id, uint8_t slot, bool enabled, boo config = it->config(); config.active(enabled); + config.affiliated(affiliated); config.nonPreferred(nonPreferred); TalkgroupRuleGroupVoice entry = *it; diff --git a/src/common/lookups/TalkgroupRulesLookup.h b/src/common/lookups/TalkgroupRulesLookup.h index d74a7333..6b7258f4 100644 --- a/src/common/lookups/TalkgroupRulesLookup.h +++ b/src/common/lookups/TalkgroupRulesLookup.h @@ -545,9 +545,10 @@ namespace lookups * @param id Unique ID to add. * @param slot DMR slot this talkgroup is valid on. * @param enabled Flag indicating if talkgroup ID is enabled or not. + * @param affiliated Flag indicating if talkgroup ID requires affiliated or not. * @param nonPreferred Flag indicating if the talkgroup ID is non-preferred. */ - void addEntry(uint32_t id, uint8_t slot, bool enabled, bool nonPreferred = false); + void addEntry(uint32_t id, uint8_t slot, bool enabled, bool affiliated = false, bool nonPreferred = false); /** * @brief Adds a new entry to the lookup table. * @param groupVoice Group Voice Configuration Block. diff --git a/src/fne/network/FNENetwork.cpp b/src/fne/network/FNENetwork.cpp index e9cabf01..4891d679 100644 --- a/src/fne/network/FNENetwork.cpp +++ b/src/fne/network/FNENetwork.cpp @@ -1621,9 +1621,14 @@ void FNENetwork::writeTGIDs(uint32_t peerId) if (entry.config().active()) { uint8_t slotNo = entry.source().tgSlot(); - // set upper bit of the slot number to flag non-preferred + // set the $80 bit of the slot number to flag non-preferred if (nonPreferred) { - slotNo = 0x80U + (slotNo & 0x03U); + slotNo |= 0x80U; + } + + // set the $40 bit of the slot number to identify if this TG is by affiliation or not + if (entry.config().affiliated()) { + slotNo |= 0x40U; } tgidList.push_back({ entry.source().tgId(), slotNo }); diff --git a/src/host/network/Network.cpp b/src/host/network/Network.cpp index 48f9707b..23c3a2f9 100644 --- a/src/host/network/Network.cpp +++ b/src/host/network/Network.cpp @@ -413,6 +413,7 @@ void Network::clock(uint32_t ms) for (uint32_t i = 0; i < len; i++) { uint32_t id = __GET_UINT16(buffer, offs); uint8_t slot = (buffer[offs + 3U]) & 0x03U; + bool affiliated = (buffer[offs + 3U] & 0x40U) == 0x40U; bool nonPreferred = (buffer[offs + 3U] & 0x80U) == 0x80U; lookups::TalkgroupRuleGroupVoice tid = m_tidLookup->find(id, slot); @@ -431,8 +432,9 @@ void Network::clock(uint32_t ms) m_tidLookup->eraseEntry(id, slot); } - LogMessage(LOG_NET, "Activated%s TG %u TS %u in TGID table", (nonPreferred) ? " non-preferred" : "", id, slot); - m_tidLookup->addEntry(id, slot, true, nonPreferred); + LogMessage(LOG_NET, "Activated%s%s TG %u TS %u in TGID table", + (nonPreferred) ? " non-preferred" : "", (affiliated) ? " affiliated" : "", id, slot); + m_tidLookup->addEntry(id, slot, true, affiliated, nonPreferred); } offs += 5U;