Skip to content

Commit

Permalink
clean up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs authored Mar 26, 2024
1 parent 48fe93d commit ae3ba59
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/app/icd/server/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,18 @@ bool ICDManager::CheckInMessagesWouldBeSent(const std::function<ShouldCheckInMsg

/**
* ShouldCheckInMsgsBeSentAtActiveModeFunction is used to determine if a Check-In message is required for a given registration.
* Due to how the ICD Check-In use-case interacts with the persistent subscription and subscription timeout resumption,
* having a single implementation of the function renders the implematention very difficult to understand and maintain.
* Because of this, each valid feature combination has its own implementation of the verifier.
* Due to how the ICD Check-In use-case interacts with the persistent subscription and subscription timeout resumption features,
* having a single implementation of the function renders the implementation very difficult to understand and maintain.
* Because of this, each valid feature combination has its own implementation of the function.
*/
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
#if CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION
/**
* @brief Implementation for when the persistant subscription and subscription timeout resumption feature are present.
* Verifier checks that there no active or persisted subscriptions for a given fabricIndex or subjectID.
* Function checks that there no active or persisted subscriptions for a given fabricIndex or subjectID.
*
* @param aFabricIndex
* @param subjectID subjectID to check. Can be an opperationnal node id or a CAT
* @param subjectID subjectID to check. Can be an operational node id or a CAT
*
* @return true Returns true if the fabricIndex and subjectId combination does not have an active or a persisted subscription.
* @return false Returns false if the fabricIndex and subjectId combination has an active or persisted subscription.
Expand All @@ -273,13 +273,13 @@ bool ICDManager::ShouldCheckInMsgsBeSentAtActiveModeFunction(FabricIndex aFabric
}
#else
/**
* @brief Implementation for when the persistant subscription is present without the subscription timeout resumption feature.
* Verifier checks that there no active subscriptions. If the boot up subscription resumption has been completed,
* verifier also checks if there are persisted subscriptions.
* @brief Implementation for when the persistant subscription feature is present without the subscription timeout resumption feature.
* Function checks that there no active subscriptions. If the boot up subscription resumption has not been completed,
* function also checks if there are persisted subscriptions.
*
* @note The persistent subscriptions feature tries to resume subscriptions at the highest min interval
* of all the persisted subscriptions. As such, it is possible for the ICD to return to Idle Mode
* until the timer elaspses. We do not when to send Check-In message to clients with persisted subscriptions
* until the timer elaspses. We do not want to send Check-In messages to clients with persisted subscriptions
* until we have tried to resubscribe.
*
* @param aFabricIndex
Expand All @@ -289,7 +289,7 @@ bool ICDManager::ShouldCheckInMsgsBeSentAtActiveModeFunction(FabricIndex aFabric
* If the boot up susbscription has not been completed, there must not be a persisted subscription either.
* @return false Returns false if the fabricIndex and subjectId combination has an active subscription.
* If the boot up susbscription has not been completed,
* if the fabricIndex and subjectId combination has a persisted subscription.
* returns false if the fabricIndex and subjectId combination has a persisted subscription.
*/
bool ICDManager::ShouldCheckInMsgsBeSentAtActiveModeFunction(FabricIndex aFabricIndex, NodeId subjectID)
{
Expand All @@ -305,8 +305,8 @@ bool ICDManager::ShouldCheckInMsgsBeSentAtActiveModeFunction(FabricIndex aFabric
#endif // CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION
#else
/**
* @brief Implementation for when neither the persistant subscription and subscription timeout resumption feature are present.
* Verifier checks that there no active sbuscriptions for a given fabricIndex and subjectId combination.
* @brief Implementation for when neither the persistant subscription and subscription timeout resumption features are present.
* Function checks that there no active sbuscriptions for a given fabricIndex and subjectId combination.
*
* @param aFabricIndex
* @param subjectID subjectID to check. Can be an opperationnal node id or a CAT
Expand All @@ -328,6 +328,7 @@ void ICDManager::TriggerCheckInMessages(const std::function<ShouldCheckInMsgsBeS
// If we are already in ActiveMode, Check-In messages have already been sent.
VerifyOrReturn(mOperationalState == OperationalState::IdleMode);

// If we don't have any Check-In messages to send, do nothing
VerifyOrReturn(CheckInMessagesWouldBeSent(verifier));
UpdateOperationState(OperationalState::ActiveMode);
}
Expand Down Expand Up @@ -390,15 +391,15 @@ void ICDManager::UpdateOperationState(OperationalState state)
mOperationalState = OperationalState::IdleMode;

#if CHIP_CONFIG_ENABLE_ICD_CIP
std::function<ShouldCheckInMsgsBeSentFunction> verifier =
std::function<ShouldCheckInMsgsBeSentFunction> function =
std::bind(&ICDManager::ShouldCheckInMsgsBeSentAtActiveModeFunction, this, std::placeholders::_1, std::placeholders::_2);
#endif // CHIP_CONFIG_ENABLE_ICD_CIP

// When the active mode interval is 0, we stay in idleMode until a notification brings the icd into active mode
// unless the device would need to send Check-In messages
if (ICDConfigurationData::GetInstance().GetActiveModeDuration() > kZero
#if CHIP_CONFIG_ENABLE_ICD_CIP
|| CheckInMessagesWouldBeSent(verifier)
|| CheckInMessagesWouldBeSent(function)
#endif // CHIP_CONFIG_ENABLE_ICD_CIP
)
{
Expand Down

0 comments on commit ae3ba59

Please sign in to comment.