From 55f75e2dfc1fe5db8640d6d0342f215b9dfb3d65 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:33:40 -0500 Subject: [PATCH] Co-authored-by: Boris Zbarsky Applied comments about #if and clarifying maximum guaranteed stay active --- .../icd-management-server/icd-management-server.cpp | 6 ------ src/app/icd/server/ICDConfigurationData.h | 7 ++++--- src/app/icd/server/ICDManager.h | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/app/clusters/icd-management-server/icd-management-server.cpp b/src/app/clusters/icd-management-server/icd-management-server.cpp index abe748611691c5..0739b9ee6af798 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.cpp +++ b/src/app/clusters/icd-management-server/icd-management-server.cpp @@ -425,15 +425,9 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(CommandHandler * comman bool emberAfIcdManagementClusterStayActiveRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::StayActiveRequest::DecodableType & commandData) { -#if CHIP_CONFIG_ENABLE_ICD_SERVER IcdManagement::Commands::StayActiveResponse::Type response; response.promisedActiveDuration = Server::GetInstance().GetICDManager().StayActiveRequest(commandData.stayActiveDuration); commandObj->AddResponse(commandPath, response); -#else - // Note: We only keep this line around for platforms examples that enable the ICD management server without building the sample - // as an ICD. - commandObj->AddStatus(commandPath, InteractionModel::Status::UnsupportedCommand); -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER return true; } diff --git a/src/app/icd/server/ICDConfigurationData.h b/src/app/icd/server/ICDConfigurationData.h index 70f1152bc6ec00..350244127831c0 100644 --- a/src/app/icd/server/ICDConfigurationData.h +++ b/src/app/icd/server/ICDConfigurationData.h @@ -61,7 +61,7 @@ class ICDConfigurationData System::Clock::Milliseconds16 GetActiveModeThreshold() { return mActiveThreshold; } - System::Clock::Milliseconds32 GetMaxStayActiveDuration() { return kMaxStayActiveDuration; } + System::Clock::Milliseconds32 GetMaxStayActiveDuration() { return kMaxGuaranteedStayActiveDuration; } Protocols::SecureChannel::CheckInCounter & GetICDCounter() { return mICDCounter; } @@ -125,8 +125,9 @@ class ICDConfigurationData static constexpr System::Clock::Seconds32 kMaxIdleModeDuration = System::Clock::Seconds32(18 * kSecondsPerHour); static constexpr System::Clock::Seconds32 kMinIdleModeDuration = System::Clock::Seconds32(1); - // As defined in the spec, the maximum duration for the StayActiveDuration is 30s (spec 7.5.1) - static constexpr System::Clock::Milliseconds32 kMaxStayActiveDuration = System::Clock::Milliseconds32(30000); + // As defined in the spec, the maximum guaranteed duration for the StayActiveDuration is 30s "Matter Application + // Clusters: 9.17.7.5.1. PromisedActiveDuration Field" + static constexpr System::Clock::Milliseconds32 kMaxGuaranteedStayActiveDuration = System::Clock::Milliseconds32(30000); static_assert((CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC) <= kMaxIdleModeDuration.count(), "Spec requires the IdleModeDuration to be equal or inferior to 64800s."); diff --git a/src/app/icd/server/ICDManager.h b/src/app/icd/server/ICDManager.h index 9ac7f9aa3d8be5..0f5eefdb8d703e 100644 --- a/src/app/icd/server/ICDManager.h +++ b/src/app/icd/server/ICDManager.h @@ -110,8 +110,8 @@ class ICDManager : public ICDListener OperationalState GetOperationalState() { return mOperationalState; } /** - * @brief Extends the Active Mode duration for whichever is smallest between 30000 milliseconds and stayActiveDuration, taking - * in account the remaining active time. + * @brief Ensures that the remaining Active Mode duration is at least the smaller of 30000 milliseconds and stayActiveDuration. + * * @param stayActiveDuration The duration (in milliseconds) requested by the client to stay in Active Mode * @return The duration (in milliseconds) the device will stay in Active Mode */