Skip to content

Commit 62ccf9c

Browse files
Applied suggestions
1 parent e7936da commit 62ccf9c

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/app/icd/server/ICDConfigurationData.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ICDConfigurationData
6161

6262
System::Clock::Milliseconds16 GetActiveModeThreshold() { return mActiveThreshold; }
6363

64-
System::Clock::Milliseconds32 GetMaxStayActiveDuration() { return kMaxGuaranteedStayActiveDuration; }
64+
System::Clock::Milliseconds32 GetGuaranteedStayActiveDuration() { return kGuaranteedStayActiveDuration; }
6565

6666
Protocols::SecureChannel::CheckInCounter & GetICDCounter() { return mICDCounter; }
6767

@@ -127,7 +127,7 @@ class ICDConfigurationData
127127
static constexpr System::Clock::Seconds32 kMinIdleModeDuration = System::Clock::Seconds32(1);
128128
// As defined in the spec, the maximum guaranteed duration for the StayActiveDuration is 30s "Matter Application
129129
// Clusters: 9.17.7.5.1. PromisedActiveDuration Field"
130-
static constexpr System::Clock::Milliseconds32 kMaxGuaranteedStayActiveDuration = System::Clock::Milliseconds32(30000);
130+
static constexpr System::Clock::Milliseconds32 kGuaranteedStayActiveDuration = System::Clock::Milliseconds32(30000);
131131

132132
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC) <= kMaxIdleModeDuration.count(),
133133
"Spec requires the IdleModeDuration to be equal or inferior to 64800s.");

src/app/icd/server/ICDManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ uint32_t ICDManager::StayActiveRequest(uint32_t stayActiveDuration)
126126
VerifyOrReturnValue(mOperationalState == OperationalState::ActiveMode, 0);
127127

128128
uint32_t promisedActiveDuration =
129-
std::min(static_cast<uint32_t>(ICDConfigurationData::GetInstance().GetMaxStayActiveDuration().count()), stayActiveDuration);
129+
std::min(ICDConfigurationData::GetInstance().GetGuaranteedStayActiveDuration().count(), stayActiveDuration);
130130

131131
// If the device is already in ActiveMode, we need to extend the active mode duration
132132
// for whichever is smallest between 30000 milliseconds and stayActiveDuration, taking in account the remaining active time.

src/app/icd/server/ICDManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ class ICDManager : public ICDListener
140140

141141
protected:
142142
/**
143-
* @brief Hepler function that extends the Active Mode duration by the extendDuration parameter
144-
* as well as the Active Mode Jitter timer for the transition to iddle mode.
143+
* @brief Hepler function that extends the Active Mode duration as well as the Active Mode Jitter timer for the transition to
144+
* iddle mode.
145145
*/
146146
void ExtendActiveMode(System::Clock::Milliseconds16 extendDuration);
147147

src/app/tests/TestICDManager.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class TestICDManager
556556
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
557557

558558
// Advance time by the ActiveModeDuration - 1
559-
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms);
559+
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms32);
560560
// Confirm ICD manager is in active mode
561561
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
562562

@@ -567,48 +567,48 @@ class TestICDManager
567567
NL_TEST_ASSERT(aSuite, stayActivePromisedMs == stayActiveRequestedMs);
568568

569569
// Advance time by the duration of the stay stayActiveRequestedMs - 1 ms
570-
AdvanceClockAndRunEventLoop(ctx, System::Clock::Milliseconds32(stayActiveRequestedMs) - 1_ms);
570+
AdvanceClockAndRunEventLoop(ctx, System::Clock::Milliseconds32(stayActiveRequestedMs) - 1_ms32);
571571
// Confirm ICD manager is in active mode
572572
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
573573

574574
// Advance time by 1ms and Confirm ICD manager is in idle mode
575-
AdvanceClockAndRunEventLoop(ctx, 1_ms);
575+
AdvanceClockAndRunEventLoop(ctx, 1_ms32);
576576
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::IdleMode);
577577

578578
// Trigger a subscription report Put the ICD manager into active mode
579579
notifier.NotifySubscriptionReport();
580580
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
581581

582582
// Advance time by the duration of the stay active request - 1 ms
583-
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms);
583+
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms32);
584584
stayActiveRequestedMs = 35000;
585585
// Send a stay active request for 35 seconds, which is higher than the maximum stay active duration (30 seconds)
586586
stayActivePromisedMs = ctx->mICDManager.StayActiveRequest(stayActiveRequestedMs);
587587
// confirm the promised time is the maximum stay active duration (30 seconds)
588588
NL_TEST_ASSERT(aSuite, stayActivePromisedMs == 30000);
589589

590590
// Advance time by the duration of the max stay active duration - 1 ms
591-
AdvanceClockAndRunEventLoop(ctx, System::Clock::Milliseconds32(30000) - 1_ms);
591+
AdvanceClockAndRunEventLoop(ctx, System::Clock::Milliseconds32(30000) - 1_ms32);
592592
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
593593

594594
// Advance time by 1ms and Confirm ICD manager is in idle mode
595-
AdvanceClockAndRunEventLoop(ctx, 1_ms);
595+
AdvanceClockAndRunEventLoop(ctx, 1_ms32);
596596
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::IdleMode);
597597

598598
// Trigger a subscription report Put the ICD manager into active mode
599599
notifier.NotifySubscriptionReport();
600600
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
601601

602602
// Advance time by the duration of the stay active request - 1 ms
603-
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms);
603+
AdvanceClockAndRunEventLoop(ctx, icdConfigData.GetActiveModeDuration() - 1_ms32);
604604
stayActiveRequestedMs = 30000;
605605
// Send a stay active request for 30 seconds
606606
stayActivePromisedMs = ctx->mICDManager.StayActiveRequest(stayActiveRequestedMs);
607607
// confirm the promised time is the same as the requested time
608608
NL_TEST_ASSERT(aSuite, stayActivePromisedMs == 30000);
609609

610610
// Advance time by the duration of the stay active request - 20000 ms
611-
AdvanceClockAndRunEventLoop(ctx, System::Clock::Milliseconds32(stayActiveRequestedMs) - 20000_ms);
611+
AdvanceClockAndRunEventLoop(ctx, System::Clock::Milliseconds32(stayActiveRequestedMs) - 20000_ms32);
612612
// Confirm ICD manager is in active mode, we should have 20000 seconds left at that point
613613
NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode);
614614

0 commit comments

Comments
 (0)