Skip to content

Commit

Permalink
port test event trigger changes to 917 build.gn
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Apr 10, 2024
1 parent 512633f commit 709e864
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 27 deletions.
14 changes: 5 additions & 9 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys
#endif

#include "SilabsDeviceDataProvider.h"
#include "SilabsTestEventTriggerDelegate.h"
#include <app/InteractionModelEngine.h>
#include <app/TimerDelegates.h>

#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED
#include "SilabsTestEventTriggerDelegate.h"
#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED

#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED
#include <app/reporting/SynchronizedReportSchedulerImpl.h>
#else
Expand Down Expand Up @@ -216,12 +219,6 @@ void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event
}
}

#if SILABS_TEST_EVENT_TRIGGER_ENABLED
static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0xcc, 0xdd, 0xee, 0xff };
#endif // SILABS_TEST_EVENT_TRIGGER_ENABLED

CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
{
CHIP_ERROR err;
Expand Down Expand Up @@ -281,10 +278,9 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
initParams.reportScheduler = &sReportScheduler;

#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED
// TODO(#31723): Show to customers that they can do `Server::GetInstance().GetTestEventTriggerDelegate().AddHandler()`
static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate;
initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate;
#endif // SILABS_TEST_EVENT_TRIGGER_ENABLED
#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED

#if CHIP_CRYPTO_PLATFORM && !(defined(SLI_SI91X_MCU_INTERFACE))
// When building with EFR32 crypto, use the opaque key store
Expand Down
42 changes: 33 additions & 9 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ declare_args() {
chip_default_wifi_psk = ""

# Enable TestEventTrigger in GeneralDiagnostics cluster
silabs_test_event_trigger_enabled = false
sl_enable_test_event_trigger = false

# The EnableKey in hex string format used by TestEventTrigger command in
# GeneralDiagnostics cluster. The length of the string should be 32.
silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff"
# GeneralDiagnostics cluster. The length of the string should be 16 bytes.
sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF"
}

# Sanity check
Expand Down Expand Up @@ -77,6 +77,28 @@ config("chip_examples_project_config") {
]
}

config("test-event-trigger-config") {
defines = [
"SL_MATTER_TEST_EVENT_TRIGGER_ENABLED",
"SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"",
]
}

source_set("test-event-trigger") {
sources = [
"${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp",
"${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.h",
]

public_configs = [ ":test-event-trigger-config" ]

public_deps = [
":silabs-factory-data-provider",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
]
}

source_set("siwx917-matter-shell") {
if (chip_build_libshell) {
defines = [ "ENABLE_CHIP_SHELL" ]
Expand Down Expand Up @@ -126,6 +148,10 @@ source_set("silabs-factory-data-provider") {
]

public_configs = [ ":siwx917-common-config" ]

if (sl_enable_test_event_trigger) {
public_configs += [ ":test-event-trigger-config" ]
}
}

config("siwx917-common-config") {
Expand Down Expand Up @@ -267,18 +293,16 @@ source_set("siwx917-common") {
public_deps += [ ":silabs-factory-data-provider" ]
}

if (silabs_test_event_trigger_enabled) {
sources +=
[ "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp" ]
defines += [ "SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${silabs_test_event_trigger_enable_key}\"" ]
}

public_deps += [
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
]

if (sl_enable_test_event_trigger) {
public_deps += [ ":test-event-trigger" ]
}

if (app_data_model != "") {
public_deps += [ app_data_model ]
}
Expand Down
11 changes: 6 additions & 5 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ config("chip_examples_project_config") {
}

config("test-event-trigger-config") {
defines = [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLED" ]

if (sl_test_event_trigger_enable_key != "") {
defines += [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"" ]
}
defines = [
"SL_MATTER_TEST_EVENT_TRIGGER_ENABLED",
"SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"",
]
}

source_set("test-event-trigger") {
Expand Down Expand Up @@ -233,13 +232,15 @@ config("silabs-wifi-config") {
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}

if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}

if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

if (rs91x_wpa3_transition) {
# TODO: Change this macro once WF200 support is provided
defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ]
Expand Down
6 changes: 3 additions & 3 deletions examples/smoke-co-alarm-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ features can easily be toggled on or off. Here is a short list of options :

### Enabling test event trigger

`silabs_test_event_trigger_enabled, silabs_test_event_trigger_enable_key`
`sl_enable_test_event_trigger`

```
The value of silabs_test_event_trigger_enable_key is specific to each device manufacturer
The enable the test event trigger, `sl_enable_test_event_trigger` must be true.

$ ./scripts/examples/gn_silabs_example.sh ./examples/smoke-co-alarm-app/silabs ./out/smoke-co-alarm-app BRD4164A silabs_test_event_trigger_enabled=true silabs_test_event_trigger_enable_key=\"00112233445566778899aabbccddeeff\"
$ ./scripts/examples/gn_silabs_example.sh ./examples/smoke-co-alarm-app/silabs ./out/smoke-co-alarm-app BRD4164A sl_enable_test_event_trigger=true
```
14 changes: 14 additions & 0 deletions examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ import("${chip_root}/src/platform/silabs/wifi_args.gni")
chip_enable_ota_requestor = true
app_data_model =
"${chip_root}/examples/smoke-co-alarm-app/smoke-co-alarm-common"

sl_enable_test_event_trigger = true

# ICD Default configurations
chip_enable_icd_server = true
chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true
icd_enforce_sit_slow_poll_limit = true
chip_enable_icd_lit = true

# ICD Matter Configuration flags
sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration
sl_active_mode_duration_ms = 0 # 0 Active Mode Duration
sl_active_mode_threshold_ms = 30000 # 30s Active Mode Threshold
2 changes: 1 addition & 1 deletion examples/smoke-co-alarm-app/silabs/openthread.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ check_system_includes = true
default_args = {
target_cpu = "arm"
target_os = "freertos"
chip_openthread_ftd = false
chip_openthread_ftd = true

import("//openthread.gni")
}

0 comments on commit 709e864

Please sign in to comment.