Skip to content

Commit 3a59352

Browse files
committed
[lit icd] add sdk support for dsls (Dynamic SIT LIT support)
Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
1 parent 952873e commit 3a59352

File tree

6 files changed

+71
-1
lines changed

6 files changed

+71
-1
lines changed

src/app/icd/icd.gni

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ declare_args() {
3030

3131
# Set to true to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5)
3232
icd_enforce_sit_slow_poll_limit = false
33+
34+
# Set to true if device supports dynamic switching from SIT to LIT operating modes
35+
chip_enable_icd_dsls = false
3336
}
3437

3538
# Set the defaults for CIP and UAT features to be consistent with the LIT value.

src/app/icd/server/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ buildconfig_header("icd-server-buildconfig") {
3636
"CHIP_CONFIG_ENABLE_ICD_LIT=${chip_enable_icd_lit}",
3737
"CHIP_CONFIG_ENABLE_ICD_CIP=${chip_enable_icd_checkin}",
3838
"CHIP_CONFIG_ENABLE_ICD_UAT=${chip_enable_icd_user_active_mode_trigger}",
39+
"CHIP_CONFIG_ENABLE_ICD_DSLS=${chip_enable_icd_dsls}",
3940
"ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_icd_report_on_active_mode}",
4041
"ICD_MAX_NOTIFICATION_SUBSCRIBERS=${icd_max_notification_subscribers}",
4142
"ICD_ENFORCE_SIT_SLOW_POLL_LIMIT=${icd_enforce_sit_slow_poll_limit}",

src/app/icd/server/ICDManager.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void ICDManager::UpdateICDMode()
365365

366366
#if CHIP_CONFIG_ENABLE_ICD_LIT
367367
// Device can only switch to the LIT operating mode if LIT support is present
368-
if (SupportsFeature(Feature::kLongIdleTimeSupport))
368+
if (SupportsFeature(Feature::kLongIdleTimeSupport) && !mSITModeRequested)
369369
{
370370
VerifyOrDie(mStorage != nullptr);
371371
VerifyOrDie(mFabricTable != nullptr);
@@ -622,6 +622,20 @@ void ICDManager::OnActiveRequestWithdrawal(KeepActiveFlags request)
622622
}
623623
}
624624

625+
#if CHIP_CONFIG_ENABLE_ICD_DSLS
626+
void ICDManager::OnSITModeRequest()
627+
{
628+
mSITModeRequested = true;
629+
this->UpdateICDMode();
630+
}
631+
632+
void ICDManager::OnSITModeRequestWithdrawal()
633+
{
634+
mSITModeRequested = false;
635+
this->UpdateICDMode();
636+
}
637+
#endif // CHIP_CONFIG_ENABLE_ICD_DSLS
638+
625639
void ICDManager::OnNetworkActivity()
626640
{
627641
this->UpdateOperationState(OperationalState::ActiveMode);

src/app/icd/server/ICDManager.h

+10
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler
241241
void OnNetworkActivity() override;
242242
void OnKeepActiveRequest(KeepActiveFlags request) override;
243243
void OnActiveRequestWithdrawal(KeepActiveFlags request) override;
244+
245+
#if CHIP_CONFIG_ENABLE_ICD_DSLS
246+
void OnSITModeRequest() override;
247+
void OnSITModeRequestWithdrawal() override;
248+
#endif
249+
244250
void OnICDManagementServerEvent(ICDManagementEvents event) override;
245251
void OnSubscriptionReport() override;
246252

@@ -356,6 +362,10 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler
356362
ObjectPool<ObserverPointer, CHIP_CONFIG_ICD_OBSERVERS_POOL_SIZE> mStateObserverPool;
357363
uint8_t mOpenExchangeContextCount = 0;
358364

365+
#if CHIP_CONFIG_ENABLE_ICD_DSLS
366+
bool mSITModeRequested = false;
367+
#endif
368+
359369
#if CHIP_CONFIG_ENABLE_ICD_CIP
360370
uint8_t mCheckInRequestCount = 0;
361371

src/app/icd/server/ICDNotifier.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ void ICDNotifier::NotifyActiveRequestWithdrawal(ICDListener::KeepActiveFlags req
8989
}
9090
}
9191

92+
#if CHIP_CONFIG_ENABLE_ICD_DSLS
93+
void ICDNotifier::NotifySITModeRequestNotification()
94+
{
95+
for (auto subscriber : mSubscribers)
96+
{
97+
if (subscriber != nullptr)
98+
{
99+
subscriber->OnSITModeRequest();
100+
}
101+
}
102+
}
103+
104+
void ICDNotifier::NotifySITModeRequestWithdrawal()
105+
{
106+
for (auto subscriber : mSubscribers)
107+
{
108+
if (subscriber != nullptr)
109+
{
110+
subscriber->OnSITModeRequestWithdrawal();
111+
}
112+
}
113+
}
114+
#endif //CHIP_CONFIG_ENABLE_ICD_DSLS
115+
92116
void ICDNotifier::NotifyICDManagementEvent(ICDListener::ICDManagementEvents event)
93117
{
94118
for (auto subscriber : mSubscribers)

src/app/icd/server/ICDNotifier.h

+18
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ class ICDListener
7171
*/
7272
virtual void OnKeepActiveRequest(KeepActiveFlags request) = 0;
7373

74+
#if CHIP_CONFIG_ENABLE_ICD_DSLS
75+
/**
76+
* @brief This function is called for all subscribers of the ICDNotifier when it calls NotifySITModeRequestNotification.
77+
* It informs the subscriber that the ICD must be kept in SIT mode.
78+
*/
79+
virtual void OnSITModeRequest() = 0;
80+
81+
/**
82+
* @brief This function is called for all subscribers of the ICDNotifier when it calls NotifySITModeRequestWithdrawal.
83+
* It informs the subscriber that a previous request no longer needs ICD to be kept in SIT mode.
84+
*/
85+
virtual void OnSITModeRequestWithdrawal() = 0;
86+
#endif //CHIP_CONFIG_ENABLE_ICD_DSLS
87+
7488
/**
7589
* @brief This function is called for all subscribers of the ICDNotifier when it calls NotifyActiveRequestWithdrawal.
7690
* It informs the subscriber that a previous request no longer needs ICD to maintain its Active Mode.
@@ -109,6 +123,10 @@ class ICDNotifier
109123
void NotifyNetworkActivityNotification();
110124
void NotifyActiveRequestNotification(ICDListener::KeepActiveFlags request);
111125
void NotifyActiveRequestWithdrawal(ICDListener::KeepActiveFlags request);
126+
#if CHIP_CONFIG_ENABLE_ICD_DSLS
127+
void NotifySITModeRequestNotification();
128+
void NotifySITModeRequestWithdrawal();
129+
#endif // CHIP_CONFIG_ENABLE_ICD_DSLS
112130
void NotifyICDManagementEvent(ICDListener::ICDManagementEvents event);
113131
void NotifySubscriptionReport();
114132

0 commit comments

Comments
 (0)