correct issue with P25 deregistrations always generating a U_REG_CMD instead of only generating a U_REG_CMD for registration timeouts;

pull/61/head
Bryan Biedenkapp 2 years ago
parent 5159c6f8c7
commit 6a040b6bec

@ -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);
}
}
}

@ -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<void(uint32_t)>&& callback) { m_unitDereg = callback; }
void setUnitDeregCallback(std::function<void(uint32_t, bool)>&& callback) { m_unitDereg = callback; }
protected:
uint8_t m_rfGrantChCnt;
@ -282,8 +283,8 @@ namespace lookups
// chNo dstId slot
std::function<void(uint32_t, uint32_t, uint8_t)> m_releaseGrant;
// srcId
std::function<void(uint32_t)> m_unitDereg;
// srcId auto
std::function<void(uint32_t, bool)> m_unitDereg;
std::string m_name;
ChannelLookup* m_chLookup;

@ -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);
});

@ -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);
});

@ -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);
}
});

Loading…
Cancel
Save

Powered by TurnKey Linux.