diff --git a/src/common/lookups/AffiliationLookup.cpp b/src/common/lookups/AffiliationLookup.cpp index 262b96b5..e061008b 100644 --- a/src/common/lookups/AffiliationLookup.cpp +++ b/src/common/lookups/AffiliationLookup.cpp @@ -79,7 +79,8 @@ void AffiliationLookup::unitReg(uint32_t srcId) } /* Helper to group unaffiliate a source ID. */ -bool AffiliationLookup::unitDereg(uint32_t srcId) + +bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic) { bool ret = false; @@ -105,7 +106,7 @@ bool AffiliationLookup::unitDereg(uint32_t srcId) if (ret) { if (m_unitDereg != nullptr) { - m_unitDereg(srcId); + m_unitDereg(srcId, automatic); } } @@ -541,7 +542,7 @@ void AffiliationLookup::clock(uint32_t ms) // release units registrations that have timed out for (uint32_t srcId : unitsToDereg) { - unitDereg(srcId); + unitDereg(srcId, true); } } } diff --git a/src/common/lookups/AffiliationLookup.h b/src/common/lookups/AffiliationLookup.h index 4ab3e10d..1de12a3b 100644 --- a/src/common/lookups/AffiliationLookup.h +++ b/src/common/lookups/AffiliationLookup.h @@ -74,9 +74,10 @@ namespace lookups /** * @brief Helper to deregister a source ID. * @param srcId Source Radio ID. + * @param automatic Flag indicating the deregistration is a result of an automated timer. * @returns bool True, if source ID is deregistered, otherwise false. */ - virtual bool unitDereg(uint32_t srcId); + virtual bool unitDereg(uint32_t srcId, bool automatic = false); /** * @brief Helper to start the source ID registration timer. * @param srcId Source Radio ID. @@ -265,7 +266,7 @@ namespace lookups * @brief Helper to set the unit deregistration callback. * @param callback Unit deregistration function callback. */ - void setUnitDeregCallback(std::function&& callback) { m_unitDereg = callback; } + void setUnitDeregCallback(std::function&& callback) { m_unitDereg = callback; } protected: uint8_t m_rfGrantChCnt; @@ -282,8 +283,8 @@ namespace lookups // chNo dstId slot std::function m_releaseGrant; - // srcId - std::function m_unitDereg; + // srcId auto + std::function m_unitDereg; std::string m_name; ChannelLookup* m_chLookup; diff --git a/src/host/dmr/Slot.cpp b/src/host/dmr/Slot.cpp index 8f55ccd2..5819c9c3 100644 --- a/src/host/dmr/Slot.cpp +++ b/src/host/dmr/Slot.cpp @@ -924,7 +924,7 @@ void Slot::init(Control* dmr, bool authoritative, uint32_t colorCode, SiteData s }); // set the unit deregistration callback - m_affiliations->setUnitDeregCallback([=](uint32_t srcId) { + m_affiliations->setUnitDeregCallback([=](uint32_t srcId, bool automatic) { if (m_network != nullptr) m_network->announceUnitDeregistration(srcId); }); diff --git a/src/host/nxdn/Control.cpp b/src/host/nxdn/Control.cpp index 9cd40ceb..50fca213 100644 --- a/src/host/nxdn/Control.cpp +++ b/src/host/nxdn/Control.cpp @@ -272,7 +272,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw }); // set the unit deregistration callback - m_affiliations.setUnitDeregCallback([=](uint32_t srcId) { + m_affiliations.setUnitDeregCallback([=](uint32_t srcId, bool automatic) { if (m_network != nullptr) m_network->announceUnitDeregistration(srcId); }); diff --git a/src/host/p25/Control.cpp b/src/host/p25/Control.cpp index eba8ff34..61a73743 100644 --- a/src/host/p25/Control.cpp +++ b/src/host/p25/Control.cpp @@ -404,12 +404,12 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw }); // set the unit deregistration callback - m_affiliations.setUnitDeregCallback([=](uint32_t srcId) { + m_affiliations.setUnitDeregCallback([=](uint32_t srcId, bool automatic) { if (m_network != nullptr) m_network->announceUnitDeregistration(srcId); // fire off a U_REG_CMD to get the SU to re-affiliate - if (m_enableControl) { + if (m_enableControl && automatic) { m_control->writeRF_TSDU_U_Reg_Cmd(srcId); } });