Skip to content

Commit 3fdf3a8

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

File tree

8 files changed

+57
-10
lines changed

8 files changed

+57
-10
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ dpkg
453453
dropdown
454454
dryrun
455455
DS
456+
DSLS
456457
duplicative
457458
DUT
458459
DUTS

examples/contact-sensor-app/nxp/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ This is a list of ICD configuration gn args.
153153
| nxp_active_mode_threshold_ms | 1000 (ms) | Active Mode Threshold value |
154154
| nxp_icd_supported_clients_per_fabric | 2 | Registration slots per fabric |
155155
| chip_enable_icd_lit | false | Enable LIT ICD support |
156+
| chip_enable_icd_dsls | false | Enable LIT ICD DSLS support |
156157
| chip_persist_subscriptions | true | Try once to re-establish subscriptions from the server side after reboot. May be disabled for LIT use case |
157158
| chip_subscription_timeout_resumption | true | Same as above, but try to re-establish timeout out subscriptions |
158159
| using `Fibonacci Backoff` for retries pacing. May be disabled for LIT use case |

examples/contact-sensor-app/nxp/k32w1/README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ operation by corrupting packages and OTA will not work.
4141

4242
The user actions are summarized below:
4343

44-
| button | action | state | output |
45-
| ------ | ----------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
46-
| SW2 | short press | not commissioned | Enable BLE advertising |
47-
| SW2 | short press | commissioned + device is LIT | Enable Active Mode |
48-
| SW2 | long press | NA | Initiate a factory reset (can be cancelled by pressing the button again within the factory reset timeout limit - 6 seconds by default) |
49-
| SW3 | short press | NA | Toggle attribute `StateValue` value |
50-
| SW3 | long press | NA | Clean soft reset of the device (takes into account proper Matter shutdown procedure) |
44+
| button | action | state | output |
45+
| ------ | ------------ | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
46+
| SW2 | short press | not commissioned | Enable BLE advertising |
47+
| SW2 | short press | commissioned + device is LIT | Enable Active Mode |
48+
| SW2 | double press | commissioned + device is LIT + supports DSLS | Enable / Disable SIT Mode |
49+
| SW2 | long press | NA | Initiate a factory reset (can be cancelled by pressing the button again within the factory reset timeout limit - 6 seconds by default) |
50+
| SW3 | short press | NA | Toggle attribute `StateValue` value |
51+
| SW3 | long press | NA | Clean soft reset of the device (takes into account proper Matter shutdown procedure) |
5152

5253
## Building
5354

examples/contact-sensor-app/nxp/k32w1/args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ chip_with_lwip = false
3131

3232
chip_enable_icd_server = true
3333
chip_enable_icd_lit = false
34+
chip_enable_icd_dsls = false
3435
icd_enforce_sit_slow_poll_limit = true
3536
chip_persist_subscriptions = true
3637
chip_subscription_timeout_resumption = true

examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ endpoint 0 {
20122012
callback attribute acceptedCommandList;
20132013
callback attribute eventList;
20142014
callback attribute attributeList;
2015-
ram attribute featureMap default = 0x0007;
2015+
ram attribute featureMap default = 0x000F;
20162016
ram attribute clusterRevision default = 3;
20172017

20182018
handle command RegisterClient;

examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap

+2-2
Original file line numberDiff line numberDiff line change
@@ -3818,7 +3818,7 @@
38183818
"storageOption": "RAM",
38193819
"singleton": 0,
38203820
"bounded": 0,
3821-
"defaultValue": "0x0007",
3821+
"defaultValue": "0x000F",
38223822
"reportable": 1,
38233823
"minInterval": 1,
38243824
"maxInterval": 65534,
@@ -4317,4 +4317,4 @@
43174317
"parentEndpointIdentifier": null
43184318
}
43194319
]
4320-
}
4320+
}

examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.cpp

+36
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ ButtonManager ButtonManager::sInstance;
5151

5252
TimerHandle_t resetTimer;
5353

54+
#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
55+
static bool sitModeRequested;
56+
#endif // CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS
57+
5458
CHIP_ERROR ButtonManager::Init()
5559
{
5660
resetTimer = xTimerCreate("FnTmr", 1, false, (void *) this, [](TimerHandle_t xTimer) {
@@ -60,6 +64,10 @@ CHIP_ERROR ButtonManager::Init()
6064
});
6165
VerifyOrReturnError(resetTimer != NULL, APP_ERROR_CREATE_TIMER_FAILED);
6266

67+
#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
68+
static bool sitModeRequested;
69+
#endif // CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS
70+
6371
return CHIP_NO_ERROR;
6472
}
6573

@@ -76,6 +84,13 @@ button_status_t ButtonManager::BleCallback(void * handle, button_callback_messag
7684
case kBUTTON_EventLongPress:
7785
event.Handler = ButtonManager::ResetActionEventHandler;
7886
break;
87+
88+
#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
89+
case kBUTTON_EventDoubleClick:
90+
event.Handler = ButtonManager::DSLSActionEventHandler;
91+
break;
92+
#endif
93+
7994
default:
8095
/* No action required */
8196
break;
@@ -189,6 +204,27 @@ void ButtonManager::BleHandler(const AppEvent & event)
189204
chip::NXP::App::GetAppTask().SwitchCommissioningStateHandler();
190205
}
191206

207+
#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
208+
void ButtonManager::DSLSActionEventHandler(const AppEvent & event)
209+
{
210+
if (chip::DeviceLayer::ConfigurationMgr().IsFullyProvisioned())
211+
{
212+
if (!sitModeRequested)
213+
{
214+
chip::DeviceLayer::PlatformMgr().ScheduleWork(
215+
[](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestNotification(); }, 0);
216+
sitModeRequested = true;
217+
}
218+
else
219+
{
220+
chip::DeviceLayer::PlatformMgr().ScheduleWork(
221+
[](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifySITModeRequestWithdrawal(); }, 0);
222+
sitModeRequested = false;
223+
}
224+
}
225+
}
226+
#endif // CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS
227+
192228
void ButtonManager::CancelTimer()
193229
{
194230
if (xTimerStop(resetTimer, 0) == pdFAIL)

examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.h

+7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ class ButtonManager
8787
*/
8888
static void ResetActionEventHandler(const AppEvent & event);
8989

90+
/**
91+
* @brief This callback schedules a DSLS LIT action (Dynamic SIT LIT Support).
92+
*
93+
* It is used when the app requests SIT mode (check spec, "Runtime Operating Mode Switching")
94+
*/
95+
static void DSLSActionEventHandler(const AppEvent & event);
96+
9097
/**
9198
* @brief This callback performs a factory reset.
9299
*

0 commit comments

Comments
 (0)