@@ -35,6 +35,7 @@ namespace app {
35
35
using namespace chip ::app;
36
36
using namespace chip ::app::Clusters;
37
37
using namespace chip ::app::Clusters::IcdManagement;
38
+ using namespace System ::Clock;
38
39
39
40
static_assert (UINT8_MAX >= CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS,
40
41
" ICDManager::mOpenExchangeContextCount cannot hold count for the max exchange count" );
@@ -55,8 +56,8 @@ void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricT
55
56
" The CheckIn protocol feature is required for LIT support." );
56
57
VerifyOrDieWithMsg (SupportsFeature (Feature::kUserActiveModeTrigger ), AppServer,
57
58
" The user ActiveMode trigger feature is required for LIT support." );
58
- VerifyOrDieWithMsg (ICDConfigurationData::GetInstance ().GetMinLitActiveModeThresholdMs () <=
59
- ICDConfigurationData::GetInstance ().GetActiveModeThresholdMs (),
59
+ VerifyOrDieWithMsg (ICDConfigurationData::GetInstance ().GetMinLitActiveModeThreshold () <=
60
+ ICDConfigurationData::GetInstance ().GetActiveModeThreshold (),
60
61
AppServer, " The minimum ActiveModeThreshold value for a LIT ICD is 5 seconds." );
61
62
// Disabling check until LIT support is compelte
62
63
// VerifyOrDieWithMsg((GetSlowPollingInterval() <= GetSITPollingThreshold()) , AppServer,
@@ -280,13 +281,12 @@ void ICDManager::UpdateOperationState(OperationalState state)
280
281
// When the active mode interval is 0, we stay in idleMode until a notification brings the icd into active mode
281
282
// unless the device would need to send Check-In messages
282
283
// TODO(#30281) : Verify how persistent subscriptions affects this at ICDManager::Init
283
- if (ICDConfigurationData::GetInstance ().GetActiveModeDurationMs () > 0 || CheckInMessagesWouldBeSent ())
284
+ if (ICDConfigurationData::GetInstance ().GetActiveModeDuration () > kZero || CheckInMessagesWouldBeSent ())
284
285
{
285
- uint32_t idleModeDuration = ICDConfigurationData::GetInstance ().GetIdleModeDurationSec ();
286
- DeviceLayer::SystemLayer ().StartTimer (System::Clock::Seconds32 (idleModeDuration), OnIdleModeDone, this );
286
+ DeviceLayer::SystemLayer ().StartTimer (ICDConfigurationData::GetInstance ().GetIdleModeDuration (), OnIdleModeDone, this );
287
287
}
288
288
289
- System::Clock:: Milliseconds32 slowPollInterval = ICDConfigurationData::GetInstance ().GetSlowPollingInterval ();
289
+ Milliseconds32 slowPollInterval = ICDConfigurationData::GetInstance ().GetSlowPollingInterval ();
290
290
291
291
// Going back to Idle, all Check-In messages are sent
292
292
mICDSenderPool .ReleaseAll ();
@@ -305,21 +305,23 @@ void ICDManager::UpdateOperationState(OperationalState state)
305
305
// Make sure the idle mode timer is stopped
306
306
DeviceLayer::SystemLayer ().CancelTimer (OnIdleModeDone, this );
307
307
308
- mOperationalState = OperationalState::ActiveMode;
309
- uint32_t activeModeDuration = ICDConfigurationData::GetInstance ().GetActiveModeDurationMs ();
308
+ mOperationalState = OperationalState::ActiveMode;
309
+ Milliseconds32 activeModeDuration = ICDConfigurationData::GetInstance ().GetActiveModeDuration ();
310
310
311
- if (activeModeDuration == 0 && !mKeepActiveFlags .HasAny ())
311
+ if (activeModeDuration == kZero && !mKeepActiveFlags .HasAny ())
312
312
{
313
313
// A Network Activity triggered the active mode and activeModeDuration is 0.
314
314
// Stay active for at least Active Mode Threshold.
315
- activeModeDuration = ICDConfigurationData::GetInstance ().GetActiveModeThresholdMs ();
315
+ activeModeDuration = ICDConfigurationData::GetInstance ().GetActiveModeThreshold ();
316
316
}
317
317
318
- DeviceLayer::SystemLayer ().StartTimer (System::Clock::Timeout ( activeModeDuration) , OnActiveModeDone, this );
318
+ DeviceLayer::SystemLayer ().StartTimer (activeModeDuration, OnActiveModeDone, this );
319
319
320
- uint32_t activeModeJitterInterval =
321
- (activeModeDuration >= ICD_ACTIVE_TIME_JITTER_MS) ? activeModeDuration - ICD_ACTIVE_TIME_JITTER_MS : 0 ;
322
- DeviceLayer::SystemLayer ().StartTimer (System::Clock::Timeout (activeModeJitterInterval), OnTransitionToIdle, this );
320
+ Milliseconds32 activeModeJitterInterval = Milliseconds32 (ICD_ACTIVE_TIME_JITTER_MS);
321
+ activeModeJitterInterval =
322
+ (activeModeDuration >= activeModeJitterInterval) ? activeModeDuration - activeModeJitterInterval : kZero ;
323
+
324
+ DeviceLayer::SystemLayer ().StartTimer (activeModeJitterInterval, OnTransitionToIdle, this );
323
325
324
326
CHIP_ERROR err =
325
327
DeviceLayer::ConnectivityMgr ().SetPollingInterval (ICDConfigurationData::GetInstance ().GetFastPollingInterval ());
@@ -337,14 +339,16 @@ void ICDManager::UpdateOperationState(OperationalState state)
337
339
}
338
340
else
339
341
{
340
- uint16_t activeModeThreshold = ICDConfigurationData::GetInstance ().GetActiveModeThresholdMs ();
341
- DeviceLayer::SystemLayer ().ExtendTimerTo (System::Clock::Timeout (activeModeThreshold), OnActiveModeDone, this );
342
- uint16_t activeModeJitterThreshold =
343
- (activeModeThreshold >= ICD_ACTIVE_TIME_JITTER_MS) ? activeModeThreshold - ICD_ACTIVE_TIME_JITTER_MS : 0 ;
342
+ Milliseconds16 activeModeThreshold = ICDConfigurationData::GetInstance ().GetActiveModeThreshold ();
343
+ DeviceLayer::SystemLayer ().ExtendTimerTo (activeModeThreshold, OnActiveModeDone, this );
344
+
345
+ Milliseconds32 activeModeJitterThreshold = Milliseconds32 (ICD_ACTIVE_TIME_JITTER_MS);
346
+ activeModeJitterThreshold =
347
+ (activeModeThreshold >= activeModeJitterThreshold) ? activeModeThreshold - activeModeJitterThreshold : kZero ;
348
+
344
349
if (!mTransitionToIdleCalled )
345
350
{
346
- DeviceLayer::SystemLayer ().ExtendTimerTo (System::Clock::Timeout (activeModeJitterThreshold), OnTransitionToIdle,
347
- this );
351
+ DeviceLayer::SystemLayer ().ExtendTimerTo (activeModeJitterThreshold, OnTransitionToIdle, this );
348
352
}
349
353
}
350
354
}
0 commit comments