diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 98fee746485cc3..3896ed6be7d9ad 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -155,6 +155,7 @@ if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_dsls" CONFIG_CHIP_ICD_DSLS_SUPPORT) matter_add_gn_arg_bool ("icd_enforce_sit_slow_poll_limit" TRUE) endif() diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 2a3a2d5495bf96..32306a9db89d13 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -398,7 +398,7 @@ config CHIP_ICD_ACTIVE_MODE_THRESHOLD For LIT devices it cannot be set to a value smaller than 5000 ms. config CHIP_ICD_LIT_SUPPORT - bool "Intermittenly Connected Device Long Idle Time support" + bool "Intermittently Connected Device Long Idle Time support" imply CHIP_ICD_CHECK_IN_SUPPORT imply CHIP_ICD_UAT_SUPPORT help @@ -406,17 +406,24 @@ config CHIP_ICD_LIT_SUPPORT It also implies the ICD Check-In and UAT features support that are mandatory for LIT device. config CHIP_ICD_CHECK_IN_SUPPORT - bool "Intermittenly Connected Device Check-In protocol support" + bool "Intermittently Connected Device Check-In protocol support" help Enables the Check-In protocol support in Matter. It allows an ICD device to notify the registered ICD clients that it is available for communication. config CHIP_ICD_UAT_SUPPORT - bool "Intermittenly Connected Device User Active Mode Trigger support" + bool "Intermittently Connected Device User Active Mode Trigger support" help Enables the User Active Mode Trigger (UAT) support in Matter. It allows the User to use application specific means (e.g. button press) to trigger an ICD device to enter the active mode and become responsive. +config CHIP_ICD_DSLS_SUPPORT + bool "Intermittenttly Connected Device Dynamic SIT LIT support" + depends on CHIP_ICD_LIT_SUPPORT + help + Enables the Dynamic SIT LIT support in Matter. It allows the application to dynamically switch between + SIT and LIT modes, as long as the requirements for these modes are met (e.g. device has at least one active ICD client). + config CHIP_ICD_CLIENTS_PER_FABRIC int "Intermittently Connected Device number of clients per fabric" default 2 diff --git a/examples/lit-icd-app/nrfconnect/README.md b/examples/lit-icd-app/nrfconnect/README.md index 1ff58274962fd9..789debe334ca31 100644 --- a/examples/lit-icd-app/nrfconnect/README.md +++ b/examples/lit-icd-app/nrfconnect/README.md @@ -167,6 +167,11 @@ duration of the effect. of the device. Releasing the button within the 3-second window cancels the factory reset procedure. +**Button 2** Represents the Dynamic SIT LIT Support feature from the +Intermittently Connected Devices Management cluster. Pressing it requests +putting the ICD device in the SIT mode. Pressing the button again withdrawns the +previous request. + **Button 3** Represents the User Active Mode Trigger feature from the Intermittently Connected Devices Management cluster. Pressing it puts the ICD device in the active mode and makes it responsive. diff --git a/examples/lit-icd-app/nrfconnect/main/AppTask.cpp b/examples/lit-icd-app/nrfconnect/main/AppTask.cpp index 336024fe289ea3..f2134f9005f20f 100644 --- a/examples/lit-icd-app/nrfconnect/main/AppTask.cpp +++ b/examples/lit-icd-app/nrfconnect/main/AppTask.cpp @@ -86,6 +86,10 @@ bool sHaveBLEConnections = false; #ifdef CONFIG_CHIP_CRYPTO_PSA chip::Crypto::PSAOperationalKeystore sPSAOperationalKeystore{}; #endif + +#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT +bool sIsSitModeRequested = false; +#endif } // namespace namespace LedConsts { @@ -285,6 +289,16 @@ void AppTask::ButtonEventHandler(uint32_t buttonState, uint32_t hasChanged) PostEvent(button_event); } +#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT + if (ICD_DSLS_BUTTON_MASK & buttonState & hasChanged) + { + button_event.ButtonEvent.PinNo = ICD_DSLS_BUTTON; + button_event.ButtonEvent.Action = static_cast(AppEventType::ButtonPushed); + button_event.Handler = IcdDslsEventHandler; + PostEvent(button_event); + } +#endif + if (ICD_UAT_BUTTON_MASK & hasChanged) { button_event.ButtonEvent.PinNo = ICD_UAT_BUTTON; @@ -294,6 +308,25 @@ void AppTask::ButtonEventHandler(uint32_t buttonState, uint32_t hasChanged) } } +#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT +void AppTask::IcdDslsEventHandler(const AppEvent &) +{ + if (sIsSitModeRequested) + { + LOG_ERR("SIT false"); + PlatformMgr().ScheduleWork([](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestWithdrawal(); }, 0); + sIsSitModeRequested = false; + } + else + { + LOG_ERR("SIT true"); + PlatformMgr().ScheduleWork([](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestNotification(); }, + 0); + sIsSitModeRequested = true; + } +} +#endif + void AppTask::IcdUatEventHandler(const AppEvent &) { // Temporarily claim network activity, until we implement a "user trigger" reason for ICD wakeups. diff --git a/examples/lit-icd-app/nrfconnect/main/include/AppConfig.h b/examples/lit-icd-app/nrfconnect/main/include/AppConfig.h index 26f63f5ec1fa06..7bde71fff0c9b1 100644 --- a/examples/lit-icd-app/nrfconnect/main/include/AppConfig.h +++ b/examples/lit-icd-app/nrfconnect/main/include/AppConfig.h @@ -23,6 +23,8 @@ #define FUNCTION_BUTTON DK_BTN1 #define FUNCTION_BUTTON_MASK DK_BTN1_MSK +#define ICD_DSLS_BUTTON DK_BTN2 +#define ICD_DSLS_BUTTON_MASK DK_BTN2_MSK #define ICD_UAT_BUTTON DK_BTN3 #define ICD_UAT_BUTTON_MASK DK_BTN3_MSK #define BLE_ADVERTISEMENT_START_BUTTON DK_BTN4 diff --git a/examples/lit-icd-app/nrfconnect/main/include/AppTask.h b/examples/lit-icd-app/nrfconnect/main/include/AppTask.h index f1513b2d1e75cb..0b9dc7cd2311a6 100644 --- a/examples/lit-icd-app/nrfconnect/main/include/AppTask.h +++ b/examples/lit-icd-app/nrfconnect/main/include/AppTask.h @@ -56,6 +56,9 @@ class AppTask static void FunctionTimerEventHandler(const AppEvent & event); static void FunctionHandler(const AppEvent & event); static void StartBLEAdvertisementHandler(const AppEvent & event); +#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT + static void IcdDslsEventHandler(const AppEvent & event); +#endif static void IcdUatEventHandler(const AppEvent & event); static void UpdateLedStateEventHandler(const AppEvent & event); diff --git a/examples/lit-icd-app/nrfconnect/prj.conf b/examples/lit-icd-app/nrfconnect/prj.conf index a21c89fd5c0009..77e944e442e15f 100644 --- a/examples/lit-icd-app/nrfconnect/prj.conf +++ b/examples/lit-icd-app/nrfconnect/prj.conf @@ -51,3 +51,5 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y # Enable LIT ICD configuration CONFIG_CHIP_ENABLE_ICD_SUPPORT=y CONFIG_CHIP_ICD_LIT_SUPPORT=y +CONFIG_CHIP_ICD_DSLS_SUPPORT=y +CONFIG_CHIP_ICD_SIT_SLOW_POLL_LIMIT=5000 diff --git a/examples/lit-icd-app/nrfconnect/prj_release.conf b/examples/lit-icd-app/nrfconnect/prj_release.conf index 9ae438428f602d..7d4aad434b3c1a 100644 --- a/examples/lit-icd-app/nrfconnect/prj_release.conf +++ b/examples/lit-icd-app/nrfconnect/prj_release.conf @@ -65,3 +65,5 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y # Enable LIT ICD configuration CONFIG_CHIP_ENABLE_ICD_SUPPORT=y CONFIG_CHIP_ICD_LIT_SUPPORT=y +CONFIG_CHIP_ICD_DSLS_SUPPORT=y +CONFIG_CHIP_ICD_SIT_SLOW_POLL_LIMIT=5000