diff --git a/src/app/icd/IcdManagementServer.h b/src/app/icd/IcdManagementServer.h index 40782347e0b7ff..cab712e3a340a2 100644 --- a/src/app/icd/IcdManagementServer.h +++ b/src/app/icd/IcdManagementServer.h @@ -63,7 +63,7 @@ class IcdManagementServer "Spec requires the IdleModeInterval to be equal or greater to 1s."); uint32_t mIdleInterval_s = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC; - static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * 1000), + static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * kMillisecondsPerSecond), "Spec requires the IdleModeInterval be equal or greater to the ActiveModeInterval."); static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) >= 300, "Spec requires the ActiveModeThreshold to be equal or greater to 300ms"); diff --git a/src/app/tests/TestICDManager.cpp b/src/app/tests/TestICDManager.cpp index bed95c7088ba46..e7dcf3a23d2be3 100644 --- a/src/app/tests/TestICDManager.cpp +++ b/src/app/tests/TestICDManager.cpp @@ -20,9 +20,9 @@ #include #include #include +#include #include #include - #include #include #include @@ -117,7 +117,7 @@ class TestICDManager AdvanceClockAndRunEventLoop(ctx, IcdManagementServer::GetInstance().GetActiveModeIntervalMs() + 1); // Active mode interval expired, ICDManager transitioned to the IdleMode. NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::IdleMode); - AdvanceClockAndRunEventLoop(ctx, (IcdManagementServer::GetInstance().GetIdleModeIntervalMs() * 1000) + 1); + AdvanceClockAndRunEventLoop(ctx, secondsToMilliseconds(IcdManagementServer::GetInstance().GetIdleModeIntervalSec()) + 1); // Idle mode interval expired, ICDManager transitioned to the ActiveMode. NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode); @@ -166,7 +166,7 @@ class TestICDManager ctx->mICDManager.SetKeepActiveModeRequirements(ICDManager::KeepActiveFlags::kAwaitingMsgAck, true); NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode); // advance time so the active mode interval expires. - AdvanceClockAndRunEventLoop(ctx, IcdManagementServer::GetInstance().GetActiveModeInterval() + 1); + AdvanceClockAndRunEventLoop(ctx, IcdManagementServer::GetInstance().GetActiveModeIntervalMs() + 1); // A requirement flag is still set. We stay in active mode. NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);