Skip to content

Commit

Permalink
[Telink] Fix certification tests (#33419)
Browse files Browse the repository at this point in the history
* [Telink] Fix EnableKey parameter of factory data

* [Telink] Add Shell Identify and TriggerEffect commands

* [Telink] Use LED for Identify

* [Telink] Event struct cleanup

* [Telink] restyled

* [Telink] use OTATestEventTriggerHandler for  OtaSoftwareUpdateRequestor cluster only
  • Loading branch information
s07641069 authored and pull[bot] committed Sep 23, 2024
1 parent 711324b commit 3fe5bf6
Show file tree
Hide file tree
Showing 18 changed files with 441 additions and 168 deletions.
64 changes: 0 additions & 64 deletions examples/bridge-app/telink/include/AppEvent.h

This file was deleted.

8 changes: 4 additions & 4 deletions examples/bridge-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* Copyright (c) 2023-2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -539,10 +539,10 @@ void AppTask::LightingActionEventHandler(AppEvent * aEvent)
Action_t action = INVALID_ACTION;
int32_t actor = 0;

if (aEvent->Type == AppEvent::kEventType_Lighting)
if (aEvent->Type == AppEvent::kEventType_DeviceAction)
{
action = static_cast<Action_t>(aEvent->LightingEvent.Action);
actor = aEvent->LightingEvent.Actor;
action = static_cast<Action_t>(aEvent->DeviceEvent.Action);
actor = aEvent->DeviceEvent.Actor;
}
else if (aEvent->Type == AppEvent::kEventType_Button)
{
Expand Down
12 changes: 6 additions & 6 deletions examples/contact-sensor-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2022-2023 Project CHIP Authors
* Copyright (c) 2022-2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -67,9 +67,9 @@ void AppTask::OnStateChanged(ContactSensorManager::State aState)
void AppTask::PostContactActionRequest(ContactSensorManager::Action aAction)
{
AppEvent event;
event.Type = AppEvent::kEventType_Contact;
event.ContactEvent.Action = static_cast<uint8_t>(aAction);
event.Handler = ContactActionEventHandler;
event.Type = AppEvent::kEventType_DeviceAction;
event.DeviceEvent.Action = static_cast<uint8_t>(aAction);
event.Handler = ContactActionEventHandler;

sAppTask.PostEvent(&event);
}
Expand All @@ -95,9 +95,9 @@ void AppTask::ContactActionEventHandler(AppEvent * aEvent)

ChipLogProgress(NotSpecified, "ContactActionEventHandler");

if (aEvent->Type == AppEvent::kEventType_Contact)
if (aEvent->Type == AppEvent::kEventType_DeviceAction)
{
action = static_cast<ContactSensorManager::Action>(aEvent->ContactEvent.Action);
action = static_cast<ContactSensorManager::Action>(aEvent->DeviceEvent.Action);
}
else if (aEvent->Type == AppEvent::kEventType_Button)
{
Expand Down
10 changes: 5 additions & 5 deletions examples/contact-sensor-app/telink/src/ContactSensorManager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* Copyright (c) 2022-2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -54,15 +54,15 @@ bool ContactSensorManager::IsContactClosed()
void ContactSensorManager::InitiateAction(Action aAction)
{
AppEvent event;
event.Type = AppEvent::kEventType_Contact;
event.ContactEvent.Action = static_cast<uint8_t>(aAction);
event.Handler = HandleAction;
event.Type = AppEvent::kEventType_DeviceAction;
event.DeviceEvent.Action = static_cast<uint8_t>(aAction);
event.Handler = HandleAction;
GetAppTask().PostEvent(&event);
}

void ContactSensorManager::HandleAction(AppEvent * aEvent)
{
Action action = static_cast<Action>(aEvent->ContactEvent.Action);
Action action = static_cast<Action>(aEvent->DeviceEvent.Action);
// Change current state based on action:
// - if state is closed and action is signal lost, change state to opened
// - if state is opened and action is signal detected, change state to closed
Expand Down
Loading

0 comments on commit 3fe5bf6

Please sign in to comment.