From 1139860083db3d64120ea5b4df5e24ab23b1afc1 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 26 Jul 2023 13:21:05 -0400 Subject: [PATCH] [ICD]Move a trace that was being spammed in low active/idle interval. (#28292) * Move a trace that was being spammed in low active/idle interval. Now only reported on ICD mode update calls * add define to enable enforcing the SIT slow polling upper limit * Update src/app/icd/ICDManager.cpp Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky --- src/app/icd/ICDManager.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index f400a7e5801087..853fd044d36732 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -28,6 +28,11 @@ #include #include +#ifndef ICD_ENFORCE_SIT_SLOW_POLL_LIMIT +// Set to 1 to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) +#define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0 +#endif + namespace chip { namespace app { @@ -93,6 +98,13 @@ void ICDManager::UpdateIcdMode() } } mICDMode = tempMode; + + // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) + { + ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32 " seconds", + (GetSITPollingThreshold().count() / 1000)); + } } void ICDManager::UpdateOperationState(OperationalState state) @@ -108,14 +120,14 @@ void ICDManager::UpdateOperationState(OperationalState state) DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); + +#if ICD_ENFORCE_SIT_SLOW_POLL_LIMIT // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. - if (mICDMode == ICDMode::SIT && slowPollInterval > GetSITPollingThreshold()) + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) { - ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32, - (GetSITPollingThreshold().count() / 1000)); - // TODO Spec to define this conformance as a SHALL - // slowPollInterval = GetSITPollingThreshold(); + slowPollInterval = GetSITPollingThreshold(); } +#endif CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(slowPollInterval); if (err != CHIP_NO_ERROR)