From 05f94111bc81149fa7c68db8f62c47bd4d2dda71 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Mon, 13 May 2024 17:29:07 +0300 Subject: [PATCH] [Telink] restyled --- .../light-switch-app/telink/src/binding-handler.cpp | 2 +- examples/lighting-app/telink/src/ZclCallbacks.cpp | 3 ++- examples/lock-app/telink/src/ZclCallbacks.cpp | 11 ++++++----- .../platform/telink/common/src/AppTaskCommon.cpp | 12 +++++------- examples/pump-app/telink/src/AppTask.cpp | 4 ++-- examples/pump-controller-app/telink/src/AppTask.cpp | 4 ++-- src/platform/telink/FactoryDataProvider.cpp | 7 ++++--- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/examples/light-switch-app/telink/src/binding-handler.cpp b/examples/light-switch-app/telink/src/binding-handler.cpp index 07ae3a8c5ffe89..22c83a8b9fd788 100644 --- a/examples/light-switch-app/telink/src/binding-handler.cpp +++ b/examples/light-switch-app/telink/src/binding-handler.cpp @@ -16,8 +16,8 @@ */ #include "binding-handler.h" -#include "IdentifyCommand.h" #include "AppConfig.h" +#include "IdentifyCommand.h" #include "app/CommandSender.h" #include "app/clusters/bindings/BindingManager.h" #include "app/server/Server.h" diff --git a/examples/lighting-app/telink/src/ZclCallbacks.cpp b/examples/lighting-app/telink/src/ZclCallbacks.cpp index 447edaf8beead8..e28d31c833de43 100644 --- a/examples/lighting-app/telink/src/ZclCallbacks.cpp +++ b/examples/lighting-app/telink/src/ZclCallbacks.cpp @@ -108,7 +108,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & else if (attributeId == ColorControl::Attributes::ColorTemperatureMireds::Id) { ChipLogDetail(Zcl, "New Temperature Mireds color = %u", *(uint16_t *) value); - GetAppTask().SetInitiateAction(AppTask::COLOR_ACTION_CT, static_cast(AppEvent::kEventType_DeviceAction), value); + GetAppTask().SetInitiateAction(AppTask::COLOR_ACTION_CT, static_cast(AppEvent::kEventType_DeviceAction), + value); } else { diff --git a/examples/lock-app/telink/src/ZclCallbacks.cpp b/examples/lock-app/telink/src/ZclCallbacks.cpp index 555c46f8814489..e4bd320981877c 100644 --- a/examples/lock-app/telink/src/ZclCallbacks.cpp +++ b/examples/lock-app/telink/src/ZclCallbacks.cpp @@ -85,8 +85,8 @@ bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const { ChipLogProgress(Zcl, "Door Lock App: Unlock Command endpoint=%d", endpointId); - return LockMgr().LockAction(AppEvent::kEventType_DeviceAction, LockManager::UNLOCK_ACTION, LockManager::OperationSource::kRemote, - endpointId, err, fabricIdx, nodeId, pinCode); + return LockMgr().LockAction(AppEvent::kEventType_DeviceAction, LockManager::UNLOCK_ACTION, + LockManager::OperationSource::kRemote, endpointId, err, fabricIdx, nodeId, pinCode); } // TODO : Add helper function to call from the Unlock command if we establish Unbolt doesn't need a different behaviour than Unlock @@ -96,8 +96,8 @@ bool emberAfPluginDoorLockOnDoorUnboltCommand(chip::EndpointId endpointId, const { ChipLogProgress(Zcl, "Door Lock App: Unbolt Command endpoint=%d", endpointId); - return LockMgr().LockAction(AppEvent::kEventType_DeviceAction, LockManager::UNBOLT_ACTION, LockManager::OperationSource::kRemote, - endpointId, err, fabricIdx, nodeId, pinCode); + return LockMgr().LockAction(AppEvent::kEventType_DeviceAction, LockManager::UNBOLT_ACTION, + LockManager::OperationSource::kRemote, endpointId, err, fabricIdx, nodeId, pinCode); } bool emberAfPluginDoorLockGetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, CredentialTypeEnum credentialType, @@ -170,5 +170,6 @@ DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t h void emberAfPluginDoorLockOnAutoRelock(chip::EndpointId endpointId) { // Apply the relock state in the application control - LockMgr().LockAction(AppEvent::kEventType_DeviceAction, LockManager::LOCK_ACTION, LockManager::OperationSource::kRemote, endpointId); + LockMgr().LockAction(AppEvent::kEventType_DeviceAction, LockManager::LOCK_ACTION, LockManager::OperationSource::kRemote, + endpointId); } diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index f5e6c9a1503c32..e47dcdbe37049b 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -89,10 +89,8 @@ void OnIdentifyTriggerEffect(Identify * identify) } Identify sIdentify = { - kExampleEndpointId, - AppTask::IdentifyStartHandler, - AppTask::IdentifyStopHandler, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, + kExampleEndpointId, AppTask::IdentifyStartHandler, + AppTask::IdentifyStopHandler, Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, OnIdentifyTriggerEffect, }; @@ -276,7 +274,7 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sOtaTestEventTriggerHandler) == CHIP_NO_ERROR); (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.appDelegate = &sCallbacks; + initParams.appDelegate = &sCallbacks; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); @@ -324,7 +322,7 @@ void AppTaskCommon::IdentifyStartHandler(Identify *) AppEvent event; event.Type = AppEvent::kEventType_IdentifyStart; - event.Handler = [](AppEvent *event) { + event.Handler = [](AppEvent * event) { ChipLogProgress(Zcl, "OnIdentifyStart"); PwmManager::getInstance().setPwmBlink(PwmManager::EAppPwm_Indication, kIdentifyBlinkRateMs, kIdentifyBlinkRateMs); }; @@ -336,7 +334,7 @@ void AppTaskCommon::IdentifyStopHandler(Identify *) AppEvent event; event.Type = AppEvent::kEventType_IdentifyStop; - event.Handler = [](AppEvent *event) { + event.Handler = [](AppEvent * event) { ChipLogProgress(Zcl, "OnIdentifyStop"); PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Indication, false); }; diff --git a/examples/pump-app/telink/src/AppTask.cpp b/examples/pump-app/telink/src/AppTask.cpp index ba89d33bca3a69..10e58c3e2edc73 100644 --- a/examples/pump-app/telink/src/AppTask.cpp +++ b/examples/pump-app/telink/src/AppTask.cpp @@ -85,10 +85,10 @@ void AppTask::ActionCompleted(PumpManager::Action_t action, int32_t actor) void AppTask::PostStartActionRequest(int32_t actor, PumpManager::Action_t action) { AppEvent event; - event.Type = AppEvent::kEventType_DeviceAction; + event.Type = AppEvent::kEventType_DeviceAction; event.DeviceEvent.Actor = actor; event.DeviceEvent.Action = action; - event.Handler = StartActionEventHandler; + event.Handler = StartActionEventHandler; sAppTask.PostEvent(&event); } diff --git a/examples/pump-controller-app/telink/src/AppTask.cpp b/examples/pump-controller-app/telink/src/AppTask.cpp index cab294ecef7563..b36888cda159fd 100644 --- a/examples/pump-controller-app/telink/src/AppTask.cpp +++ b/examples/pump-controller-app/telink/src/AppTask.cpp @@ -103,10 +103,10 @@ void AppTask::ActionCompleted(PumpManager::Action_t action, int32_t actor) void AppTask::PostStartActionRequest(int32_t actor, PumpManager::Action_t action) { AppEvent event; - event.Type = AppEvent::kEventType_DeviceAction; + event.Type = AppEvent::kEventType_DeviceAction; event.DeviceEvent.Actor = actor; event.DeviceEvent.Action = action; - event.Handler = StartActionEventHandler; + event.Handler = StartActionEventHandler; sAppTask.PostEvent(&event); } diff --git a/src/platform/telink/FactoryDataProvider.cpp b/src/platform/telink/FactoryDataProvider.cpp index 4dac04aecf0522..ba02131911370f 100644 --- a/src/platform/telink/FactoryDataProvider.cpp +++ b/src/platform/telink/FactoryDataProvider.cpp @@ -329,11 +329,12 @@ template CHIP_ERROR FactoryDataProvider::GetEnableKey(MutableByteSpan & enableKey) { ReturnErrorCodeIf(!mFactoryData.enable_key.data, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - ReturnErrorCodeIf(enableKey.size() < mFactoryData.enable_key.len/2, CHIP_ERROR_BUFFER_TOO_SMALL); + ReturnErrorCodeIf(enableKey.size() < mFactoryData.enable_key.len / 2, CHIP_ERROR_BUFFER_TOO_SMALL); - Encoding::HexToBytes((const char*)mFactoryData.enable_key.data, mFactoryData.enable_key.len, enableKey.data(), enableKey.size()); + Encoding::HexToBytes((const char *) mFactoryData.enable_key.data, mFactoryData.enable_key.len, enableKey.data(), + enableKey.size()); - enableKey.reduce_size(mFactoryData.enable_key.len/2); + enableKey.reduce_size(mFactoryData.enable_key.len / 2); return CHIP_NO_ERROR; }