Skip to content

Commit 4e15283

Browse files
[lit] Added support for ICD DSLS in nrfconnect platform (#35618)
Added configuration option allowing to enable ICD DSLS for nrfconnect platform and integrated this functionality in the lit example.
1 parent aa69085 commit 4e15283

File tree

8 files changed

+56
-3
lines changed

8 files changed

+56
-3
lines changed

config/nrfconnect/chip-module/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
155155
matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT)
156156
matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT)
157157
matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT)
158+
matter_add_gn_arg_bool ("chip_enable_icd_dsls" CONFIG_CHIP_ICD_DSLS_SUPPORT)
158159
matter_add_gn_arg_bool ("icd_enforce_sit_slow_poll_limit" TRUE)
159160
endif()
160161

config/zephyr/Kconfig

+10-3
Original file line numberDiff line numberDiff line change
@@ -398,25 +398,32 @@ config CHIP_ICD_ACTIVE_MODE_THRESHOLD
398398
For LIT devices it cannot be set to a value smaller than 5000 ms.
399399

400400
config CHIP_ICD_LIT_SUPPORT
401-
bool "Intermittenly Connected Device Long Idle Time support"
401+
bool "Intermittently Connected Device Long Idle Time support"
402402
imply CHIP_ICD_CHECK_IN_SUPPORT
403403
imply CHIP_ICD_UAT_SUPPORT
404404
help
405405
Enables the Intermittently Connected Device Long Idle Time support in Matter.
406406
It also implies the ICD Check-In and UAT features support that are mandatory for LIT device.
407407

408408
config CHIP_ICD_CHECK_IN_SUPPORT
409-
bool "Intermittenly Connected Device Check-In protocol support"
409+
bool "Intermittently Connected Device Check-In protocol support"
410410
help
411411
Enables the Check-In protocol support in Matter. It allows an ICD device to notify the registered
412412
ICD clients that it is available for communication.
413413

414414
config CHIP_ICD_UAT_SUPPORT
415-
bool "Intermittenly Connected Device User Active Mode Trigger support"
415+
bool "Intermittently Connected Device User Active Mode Trigger support"
416416
help
417417
Enables the User Active Mode Trigger (UAT) support in Matter. It allows the User to use application specific
418418
means (e.g. button press) to trigger an ICD device to enter the active mode and become responsive.
419419

420+
config CHIP_ICD_DSLS_SUPPORT
421+
bool "Intermittenttly Connected Device Dynamic SIT LIT support"
422+
depends on CHIP_ICD_LIT_SUPPORT
423+
help
424+
Enables the Dynamic SIT LIT support in Matter. It allows the application to dynamically switch between
425+
SIT and LIT modes, as long as the requirements for these modes are met (e.g. device has at least one active ICD client).
426+
420427
config CHIP_ICD_CLIENTS_PER_FABRIC
421428
int "Intermittently Connected Device number of clients per fabric"
422429
default 2

examples/lit-icd-app/nrfconnect/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ duration of the effect.
167167
of the device. Releasing the button within the 3-second window cancels the
168168
factory reset procedure.
169169

170+
**Button 2** Represents the Dynamic SIT LIT Support feature from the
171+
Intermittently Connected Devices Management cluster. Pressing it requests
172+
putting the ICD device in the SIT mode. Pressing the button again withdraws the
173+
previous request.
174+
170175
**Button 3** Represents the User Active Mode Trigger feature from the
171176
Intermittently Connected Devices Management cluster. Pressing it puts the ICD
172177
device in the active mode and makes it responsive.

examples/lit-icd-app/nrfconnect/main/AppTask.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ bool sHaveBLEConnections = false;
8686
#ifdef CONFIG_CHIP_CRYPTO_PSA
8787
chip::Crypto::PSAOperationalKeystore sPSAOperationalKeystore{};
8888
#endif
89+
90+
#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT
91+
bool sIsSitModeRequested = false;
92+
#endif
8993
} // namespace
9094

9195
namespace LedConsts {
@@ -285,6 +289,16 @@ void AppTask::ButtonEventHandler(uint32_t buttonState, uint32_t hasChanged)
285289
PostEvent(button_event);
286290
}
287291

292+
#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT
293+
if (ICD_DSLS_BUTTON_MASK & buttonState & hasChanged)
294+
{
295+
button_event.ButtonEvent.PinNo = ICD_DSLS_BUTTON;
296+
button_event.ButtonEvent.Action = static_cast<uint8_t>(AppEventType::ButtonPushed);
297+
button_event.Handler = IcdDslsEventHandler;
298+
PostEvent(button_event);
299+
}
300+
#endif
301+
288302
if (ICD_UAT_BUTTON_MASK & hasChanged)
289303
{
290304
button_event.ButtonEvent.PinNo = ICD_UAT_BUTTON;
@@ -294,6 +308,23 @@ void AppTask::ButtonEventHandler(uint32_t buttonState, uint32_t hasChanged)
294308
}
295309
}
296310

311+
#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT
312+
void AppTask::IcdDslsEventHandler(const AppEvent &)
313+
{
314+
if (sIsSitModeRequested)
315+
{
316+
PlatformMgr().ScheduleWork([](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestWithdrawal(); }, 0);
317+
sIsSitModeRequested = false;
318+
}
319+
else
320+
{
321+
PlatformMgr().ScheduleWork([](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestNotification(); },
322+
0);
323+
sIsSitModeRequested = true;
324+
}
325+
}
326+
#endif
327+
297328
void AppTask::IcdUatEventHandler(const AppEvent &)
298329
{
299330
// Temporarily claim network activity, until we implement a "user trigger" reason for ICD wakeups.

examples/lit-icd-app/nrfconnect/main/include/AppConfig.h

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#define FUNCTION_BUTTON DK_BTN1
2525
#define FUNCTION_BUTTON_MASK DK_BTN1_MSK
26+
#define ICD_DSLS_BUTTON DK_BTN2
27+
#define ICD_DSLS_BUTTON_MASK DK_BTN2_MSK
2628
#define ICD_UAT_BUTTON DK_BTN3
2729
#define ICD_UAT_BUTTON_MASK DK_BTN3_MSK
2830
#define BLE_ADVERTISEMENT_START_BUTTON DK_BTN4

examples/lit-icd-app/nrfconnect/main/include/AppTask.h

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class AppTask
5656
static void FunctionTimerEventHandler(const AppEvent & event);
5757
static void FunctionHandler(const AppEvent & event);
5858
static void StartBLEAdvertisementHandler(const AppEvent & event);
59+
#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT
60+
static void IcdDslsEventHandler(const AppEvent & event);
61+
#endif
5962
static void IcdUatEventHandler(const AppEvent & event);
6063
static void UpdateLedStateEventHandler(const AppEvent & event);
6164

examples/lit-icd-app/nrfconnect/prj.conf

+2
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y
5151
# Enable LIT ICD configuration
5252
CONFIG_CHIP_ENABLE_ICD_SUPPORT=y
5353
CONFIG_CHIP_ICD_LIT_SUPPORT=y
54+
CONFIG_CHIP_ICD_DSLS_SUPPORT=y
55+
CONFIG_CHIP_ICD_SIT_SLOW_POLL_LIMIT=5000

examples/lit-icd-app/nrfconnect/prj_release.conf

+2
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y
6565
# Enable LIT ICD configuration
6666
CONFIG_CHIP_ENABLE_ICD_SUPPORT=y
6767
CONFIG_CHIP_ICD_LIT_SUPPORT=y
68+
CONFIG_CHIP_ICD_DSLS_SUPPORT=y
69+
CONFIG_CHIP_ICD_SIT_SLOW_POLL_LIMIT=5000

0 commit comments

Comments
 (0)