Skip to content

Commit

Permalink
Added test event triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Aug 9, 2024
1 parent 8a4e24e commit f5f27b4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions examples/energy-management-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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"
22 changes: 22 additions & 0 deletions examples/energy-management-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@

#include <platform/CHIPDeviceLayer.h>

#if SL_MATTER_TEST_EVENT_TRIGGER_ENABLED
#include <app/TestEventTriggerDelegate.h>
#include <app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h>
#include <app/clusters/electrical-energy-measurement-server/EnergyReportingTestEventTriggerHandler.h>
#include <app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h>
#endif

#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))
#define EVSE_LED 1
#else
Expand All @@ -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 {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit f5f27b4

Please sign in to comment.