Skip to content

Commit e7936da

Browse files
Added the #if back for platforms that build the icd-management-server cluster without being ICD devices
1 parent 55f75e2 commit e7936da

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter

+5-1
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,10 @@ cluster IcdManagement = 70 {
13371337
optional octet_string<16> verificationKey = 1;
13381338
}
13391339

1340+
request struct StayActiveRequestRequest {
1341+
int32u stayActiveDuration = 0;
1342+
}
1343+
13401344
response struct StayActiveResponse = 4 {
13411345
int32u promisedActiveDuration = 0;
13421346
}
@@ -1346,7 +1350,7 @@ cluster IcdManagement = 70 {
13461350
/** Unregister a client from an end device */
13471351
fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
13481352
/** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */
1349-
command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
1353+
command access(invoke: manage) StayActiveRequest(StayActiveRequestRequest): StayActiveResponse = 3;
13501354
}
13511355

13521356
endpoint 0 {

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

+5
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,14 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(CommandHandler * comman
425425
bool emberAfIcdManagementClusterStayActiveRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
426426
const Commands::StayActiveRequest::DecodableType & commandData)
427427
{
428+
// Note: We only need this #if statement for platform examples that enable the ICD management server without building the sample
429+
// as an ICD. Since this is not spec compliant, we should remove this #if statement once we stop compiling the ICD management
430+
// server in those examples.
431+
#if CHIP_CONFIG_ENABLE_ICD_SERVER
428432
IcdManagement::Commands::StayActiveResponse::Type response;
429433
response.promisedActiveDuration = Server::GetInstance().GetICDManager().StayActiveRequest(commandData.stayActiveDuration);
430434
commandObj->AddResponse(commandPath, response);
435+
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
431436
return true;
432437
}
433438

src/app/tests/TestICDManager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ class TestICDManager
551551
// Verify That ICDManager starts in Idle
552552
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::IdleMode);
553553

554-
// Trigger a subscription report Put the ICD manager into active mode
554+
// Trigger a subscription report. Put the ICD manager into active mode.
555555
notifier.NotifySubscriptionReport();
556556
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
557557

558-
// Advance time by the duration of the stay active request - 1
558+
// Advance time by the ActiveModeDuration - 1
559559
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms);
560560
// Confirm ICD manager is in active mode
561561
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);

0 commit comments

Comments
 (0)