Skip to content

Commit 67d831e

Browse files
[NXP][example_common] Adding a dedicated KCONFIG option to register a simple test event trigger delegate (project-chip#42133)
* [NXP][example_common] Adding a dedicated KCONFIG option to register a simple test event trigger delegate Signed-off-by: Oliver Fan <[email protected]> * Update examples/platform/nxp/common/app_task/source/AppTaskBase.cpp Co-authored-by: Gatien Chapon <[email protected]> --------- Signed-off-by: Oliver Fan <[email protected]> Co-authored-by: Gatien Chapon <[email protected]>
1 parent 162e4a0 commit 67d831e

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

examples/platform/nxp/common/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ if CHIP_APP_OTA_REQUESTOR
290290

291291
endif # CHIP_APP_OTA_REQUESTOR
292292

293+
config CHIP_REGISTER_SIMPLE_TEST_EVENT_TRIGGER_DELEGATE
294+
bool "Registration of simple test event trigger delegate"
295+
default y if CHIP_ENABLE_ICD_SUPPORT
296+
help
297+
Enable registration of a simple test event trigger delegate, ONLY enable it for matter certification testing.
298+
293299
config CHIP_APP_RPC
294300
bool "App RPC"
295301
help

examples/platform/nxp/common/app_task/source/AppTaskBase.cpp

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,15 @@
8989
#include "OTARequestorInitiator.h"
9090
#endif
9191

92-
#if CONFIG_CHIP_TEST_EVENT && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
93-
#include <app/clusters/ota-requestor/OTATestEventTriggerDelegate.h>
92+
#if defined(CONFIG_CHIP_REGISTER_SIMPLE_TEST_EVENT_TRIGGER_DELEGATE) && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
93+
#include <app/clusters/ota-requestor/OTATestEventTriggerHandler.h>
9494
#endif
9595

9696
#ifdef ENABLE_CHIP_SHELL
9797
#include <lib/shell/commands/WiFi.h>
9898
#endif
9999

100-
#ifdef SMOKE_CO_ALARM
101-
#include <app/TestEventTriggerDelegate.h>
102-
#include <app/clusters/smoke-co-alarm-server/SmokeCOTestEventTriggerHandler.h>
103-
#endif
104-
105-
#if CHIP_CONFIG_ENABLE_ICD_SERVER
100+
#ifdef CONFIG_CHIP_REGISTER_SIMPLE_TEST_EVENT_TRIGGER_DELEGATE
106101
#include <app/TestEventTriggerDelegate.h>
107102
#endif
108103

@@ -147,13 +142,7 @@ app::Clusters::NetworkCommissioning::Instance
147142
extern char baseServiceInstanceName[];
148143
#endif
149144

150-
#if CHIP_CONFIG_ENABLE_ICD_SERVER || (CONFIG_CHIP_TEST_EVENT && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
151-
static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
152-
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
153-
0xcc, 0xdd, 0xee, 0xff };
154-
#endif
155-
156-
#ifdef SMOKE_CO_ALARM
145+
#ifdef CONFIG_CHIP_REGISTER_SIMPLE_TEST_EVENT_TRIGGER_DELEGATE
157146
static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
158147
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
159148
0xcc, 0xdd, 0xee, 0xff };
@@ -184,23 +173,16 @@ void chip::NXP::App::AppTaskBase::InitServer(intptr_t arg)
184173
initParams.reportScheduler = &sReportScheduler;
185174
#endif
186175

187-
#if CONFIG_CHIP_TEST_EVENT && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
188-
static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) };
189-
initParams.testEventTriggerDelegate = &testEventTriggerDelegate;
190-
#endif
191-
192-
#ifdef SMOKE_CO_ALARM
176+
#ifdef CONFIG_CHIP_REGISTER_SIMPLE_TEST_EVENT_TRIGGER_DELEGATE
193177
static SimpleTestEventTriggerDelegate sTestEventTriggerDelegate{};
194-
static SmokeCOTestEventTriggerHandler sSmokeCOTestEventTriggerHandler{};
195178
VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR);
196-
VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sSmokeCOTestEventTriggerHandler) == CHIP_NO_ERROR);
197179
initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate;
180+
181+
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
182+
static OTATestEventTriggerHandler sOtaTestEventTriggerHandler{};
183+
VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sOtaTestEventTriggerHandler) == CHIP_NO_ERROR);
198184
#endif
199185

200-
#if CHIP_CONFIG_ENABLE_ICD_SERVER
201-
static SimpleTestEventTriggerDelegate sTestEventTriggerDelegate{};
202-
VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR);
203-
initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate;
204186
#endif
205187

206188
#if CONFIG_OPERATIONAL_KEYSTORE

0 commit comments

Comments
 (0)