Skip to content

Commit

Permalink
[ICD]Move a trace that was being spammed in low active/idle interval. (
Browse files Browse the repository at this point in the history
…#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 <bzbarsky@apple.com>

---------

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
2 people authored and pull[bot] committed Sep 5, 2023
1 parent b0aaa5a commit 1139860
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/app/icd/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#include <platform/internal/CHIPDeviceLayerInternal.h>
#include <stdlib.h>

#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 {

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 1139860

Please sign in to comment.