From f5f27b4027dd613db8c0351f7da832901107d324 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Fri, 9 Aug 2024 18:11:30 -0400 Subject: [PATCH] Added test event triggers --- .../silabs/build_for_wifi_args.gni | 1 + .../silabs/openthread.gni | 1 + .../silabs/src/AppTask.cpp | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/examples/energy-management-app/silabs/build_for_wifi_args.gni b/examples/energy-management-app/silabs/build_for_wifi_args.gni index bfded904a34176..1b1c0ecd6a7c78 100644 --- a/examples/energy-management-app/silabs/build_for_wifi_args.gni +++ b/examples/energy-management-app/silabs/build_for_wifi_args.gni @@ -18,6 +18,7 @@ silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false import("${chip_root}/src/platform/silabs/wifi_args.gni") +sl_enable_test_event_trigger = true chip_enable_ota_requestor = false disable_lcd = true app_data_model = diff --git a/examples/energy-management-app/silabs/openthread.gni b/examples/energy-management-app/silabs/openthread.gni index 2813a5a1fb0bda..b45952e0c5f24b 100644 --- a/examples/energy-management-app/silabs/openthread.gni +++ b/examples/energy-management-app/silabs/openthread.gni @@ -23,6 +23,7 @@ app_data_model = chip_enable_ota_requestor = false chip_enable_openthread = true disable_lcd = true +sl_enable_test_event_trigger = true openthread_external_platform = "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" diff --git a/examples/energy-management-app/silabs/src/AppTask.cpp b/examples/energy-management-app/silabs/src/AppTask.cpp index 4ed73efb28711e..8b8aa7cb9e61e6 100644 --- a/examples/energy-management-app/silabs/src/AppTask.cpp +++ b/examples/energy-management-app/silabs/src/AppTask.cpp @@ -43,6 +43,13 @@ #include +#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +#include +#include +#include +#include +#endif + #if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917)) #define EVSE_LED 1 #else @@ -66,6 +73,12 @@ using namespace ::chip::DeviceLayer::Silabs; using namespace ::chip::DeviceLayer::Internal; using namespace chip::TLV; +#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +static EnergyEvseTestEventTriggerHandler sEnergyEvseTestEventTriggerHandler; +static EnergyReportingTestEventTriggerHandler sEnergyReportingTestEventTriggerHandler; +static DeviceEnergyManagementTestEventTriggerHandler sDeviceEnergyManagementTestEventTriggerHandler; +#endif + namespace chip { namespace app { namespace Clusters { @@ -120,6 +133,15 @@ CHIP_ERROR AppTask::Init() ApplicationInit(); +#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED + if (Server::GetInstance().GetTestEventTriggerDelegate() != nullptr) + { + Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sEnergyEvseTestEventTriggerHandler); + Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sEnergyReportingTestEventTriggerHandler); + Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sDeviceEnergyManagementTestEventTriggerHandler); + } +#endif + // Update the LCD with the Stored value. Show QR Code if not provisioned #ifdef DISPLAY_ENABLED GetLCD().WriteDemoUI(LightMgr().IsLightOn());