Skip to content

Commit

Permalink
[Infineon] Implement TestEventTrigger delegate for OTA query (#22749)
Browse files Browse the repository at this point in the history
* Make it possible to use TestEventTrigger command of GeneralDiagnostics
cluster to trigger OTA query on demand.
* Use OTATestEventTriggerDelegate in CYW30739 example.
  • Loading branch information
AlvinHsiao authored and pull[bot] committed Dec 5, 2022
1 parent 14559c9 commit 2063721
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/lighting-app/infineon/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <OTAConfig.h>
#endif
#include <app/clusters/identify-server/identify-server.h>
#include <app/clusters/ota-requestor/OTATestEventTriggerDelegate.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand Down Expand Up @@ -54,6 +55,11 @@ static wiced_led_config_t chip_lighting_led_config = {
.bright = 50,
};

// NOTE! This key is for test/certification only and should not be available in production devices!
uint8_t sTestEventTriggerEnableKey[chip::TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0xcc, 0xdd, 0xee, 0xff };

/**********************************************************
* Identify Callbacks
*********************************************************/
Expand Down Expand Up @@ -177,8 +183,10 @@ void InitApp(intptr_t args)
// Print QR Code URL
PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE));
/* Start CHIP datamodel server */
static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) };
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();
initParams.testEventTriggerDelegate = &testEventTriggerDelegate;
gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);
chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams;
Expand Down
8 changes: 8 additions & 0 deletions examples/lock-app/infineon/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#endif
#include <app/clusters/door-lock-server/door-lock-server.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/clusters/ota-requestor/OTATestEventTriggerDelegate.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand Down Expand Up @@ -69,6 +70,11 @@ static void UpdateClusterState(intptr_t context);
#define _countof(a) (sizeof(a) / sizeof(a[0]))
#endif

// NOTE! This key is for test/certification only and should not be available in production devices!
uint8_t sTestEventTriggerEnableKey[chip::TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0xcc, 0xdd, 0xee, 0xff };

static wiced_led_config_t chip_lighting_led_config[2] = {
{
.led = PLATFORM_LED_1,
Expand Down Expand Up @@ -174,8 +180,10 @@ void InitApp(intptr_t args)
// Print QR Code URL
PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE));
/* Start CHIP datamodel server */
static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) };
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();
initParams.testEventTriggerDelegate = &testEventTriggerDelegate;
gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);
chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams;
Expand Down

0 comments on commit 2063721

Please sign in to comment.