Skip to content

Commit 3c49395

Browse files
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Applied comments about #if and clarifying maximum guaranteed stay active
1 parent ba60af4 commit 3c49395

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/app/clusters/icd-management-server/icd-management-server.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,9 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(CommandHandler * comman
425425
bool emberAfIcdManagementClusterStayActiveRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
426426
const Commands::StayActiveRequest::DecodableType & commandData)
427427
{
428-
#if CHIP_CONFIG_ENABLE_ICD_SERVER
429428
IcdManagement::Commands::StayActiveResponse::Type response;
430429
response.promisedActiveDuration = Server::GetInstance().GetICDManager().StayActiveRequest(commandData.stayActiveDuration);
431430
commandObj->AddResponse(commandPath, response);
432-
#else
433-
// Note: We only keep this line around for platforms examples that enable the ICD management server without building the sample
434-
// as an ICD.
435-
commandObj->AddStatus(commandPath, InteractionModel::Status::UnsupportedCommand);
436-
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
437431
return true;
438432
}
439433

src/app/icd/server/ICDConfigurationData.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ICDConfigurationData
6161

6262
System::Clock::Milliseconds16 GetActiveModeThreshold() { return mActiveThreshold; }
6363

64-
System::Clock::Milliseconds32 GetMaxStayActiveDuration() { return kMaxStayActiveDuration; }
64+
System::Clock::Milliseconds32 GetMaxStayActiveDuration() { return kMaxGuaranteedStayActiveDuration; }
6565

6666
Protocols::SecureChannel::CheckInCounter & GetICDCounter() { return mICDCounter; }
6767

@@ -125,8 +125,9 @@ class ICDConfigurationData
125125

126126
static constexpr System::Clock::Seconds32 kMaxIdleModeDuration = System::Clock::Seconds32(18 * kSecondsPerHour);
127127
static constexpr System::Clock::Seconds32 kMinIdleModeDuration = System::Clock::Seconds32(1);
128-
// As defined in the spec, the maximum duration for the StayActiveDuration is 30s (spec 7.5.1)
129-
static constexpr System::Clock::Milliseconds32 kMaxStayActiveDuration = System::Clock::Milliseconds32(30000);
128+
// As defined in the spec, the maximum guaranteed duration for the StayActiveDuration is 30s "Matter Application
129+
// Clusters: 9.17.7.5.1. PromisedActiveDuration Field"
130+
static constexpr System::Clock::Milliseconds32 kMaxGuaranteedStayActiveDuration = System::Clock::Milliseconds32(30000);
130131

131132
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC) <= kMaxIdleModeDuration.count(),
132133
"Spec requires the IdleModeDuration to be equal or inferior to 64800s.");

src/app/icd/server/ICDManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ class ICDManager : public ICDListener
110110
OperationalState GetOperationalState() { return mOperationalState; }
111111

112112
/**
113-
* @brief Extends the Active Mode duration for whichever is smallest between 30000 milliseconds and stayActiveDuration, taking
114-
* in account the remaining active time.
113+
* @brief Ensures that the remaining Active Mode duration is at least the smaller of 30000 milliseconds and stayActiveDuration.
114+
*
115115
* @param stayActiveDuration The duration (in milliseconds) requested by the client to stay in Active Mode
116116
* @return The duration (in milliseconds) the device will stay in Active Mode
117117
*/

0 commit comments

Comments
 (0)