Skip to content

Commit

Permalink
[lit] Added support for ICD DSLS in nrfconnect platform (#35618)
Browse files Browse the repository at this point in the history
Added configuration option allowing to enable ICD DSLS for
nrfconnect platform and integrated this functionality
in the lit example.
  • Loading branch information
kkasperczyk-no authored and pull[bot] committed Nov 29, 2024
1 parent a177f84 commit 3800814
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
13 changes: 10 additions & 3 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -398,25 +398,32 @@ 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
Enables the Intermittently Connected Device Long Idle Time support in Matter.
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
Expand Down
5 changes: 5 additions & 0 deletions examples/lit-icd-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 withdraws 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.
Expand Down
31 changes: 31 additions & 0 deletions examples/lit-icd-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<uint8_t>(AppEventType::ButtonPushed);
button_event.Handler = IcdDslsEventHandler;
PostEvent(button_event);
}
#endif

if (ICD_UAT_BUTTON_MASK & hasChanged)
{
button_event.ButtonEvent.PinNo = ICD_UAT_BUTTON;
Expand All @@ -294,6 +308,23 @@ void AppTask::ButtonEventHandler(uint32_t buttonState, uint32_t hasChanged)
}
}

#ifdef CONFIG_CHIP_ICD_DSLS_SUPPORT
void AppTask::IcdDslsEventHandler(const AppEvent &)
{
if (sIsSitModeRequested)
{
PlatformMgr().ScheduleWork([](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestWithdrawal(); }, 0);
sIsSitModeRequested = false;
}
else
{
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.
Expand Down
2 changes: 2 additions & 0 deletions examples/lit-icd-app/nrfconnect/main/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions examples/lit-icd-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions examples/lit-icd-app/nrfconnect/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/lit-icd-app/nrfconnect/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3800814

Please sign in to comment.