From 709e86453e4a5c756058af39dda23d97c57a5407 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Wed, 10 Apr 2024 09:35:08 -0400 Subject: [PATCH] port test event trigger changes to 917 build.gn --- examples/platform/silabs/MatterConfig.cpp | 14 +++---- examples/platform/silabs/SiWx917/BUILD.gn | 42 +++++++++++++++---- examples/platform/silabs/efr32/BUILD.gn | 11 ++--- examples/smoke-co-alarm-app/silabs/README.md | 6 +-- .../silabs/build_for_wifi_args.gni | 14 +++++++ .../smoke-co-alarm-app/silabs/openthread.gn | 2 +- 6 files changed, 62 insertions(+), 27 deletions(-) diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 086ea5b09c2ef1..799bf3ad51e97e 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -55,10 +55,13 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #endif #include "SilabsDeviceDataProvider.h" -#include "SilabsTestEventTriggerDelegate.h" #include #include +#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +#include "SilabsTestEventTriggerDelegate.h" +#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED + #if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED #include #else @@ -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; @@ -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 diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index c894e134a6b6b4..eff25acb9b6573 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -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 @@ -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" ] @@ -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") { @@ -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 ] } diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index f8795b90381ba9..33e536dacefd88 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -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") { @@ -233,6 +232,7 @@ config("silabs-wifi-config") { if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } + if (sl_wfx_config_scan) { defines += [ "SL_WFX_CONFIG_SCAN" ] } @@ -240,6 +240,7 @@ config("silabs-wifi-config") { 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" ] diff --git a/examples/smoke-co-alarm-app/silabs/README.md b/examples/smoke-co-alarm-app/silabs/README.md index b5548b69f24f54..03ff976deca183 100644 --- a/examples/smoke-co-alarm-app/silabs/README.md +++ b/examples/smoke-co-alarm-app/silabs/README.md @@ -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 ``` diff --git a/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni b/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni index 047de7f34492df..8211818e706157 100644 --- a/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni +++ b/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni @@ -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 diff --git a/examples/smoke-co-alarm-app/silabs/openthread.gn b/examples/smoke-co-alarm-app/silabs/openthread.gn index 5a39f9e747ab4e..7f32969d422a63 100644 --- a/examples/smoke-co-alarm-app/silabs/openthread.gn +++ b/examples/smoke-co-alarm-app/silabs/openthread.gn @@ -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") }