Skip to content

Commit

Permalink
[Telink] restyled
Browse files Browse the repository at this point in the history
  • Loading branch information
s07641069 committed May 13, 2024
1 parent 20dbba8 commit 05f9411
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion examples/light-switch-app/telink/src/binding-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion examples/lighting-app/telink/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int32_t>(AppEvent::kEventType_DeviceAction), value);
GetAppTask().SetInitiateAction(AppTask::COLOR_ACTION_CT, static_cast<int32_t>(AppEvent::kEventType_DeviceAction),
value);
}
else
{
Expand Down
11 changes: 6 additions & 5 deletions examples/lock-app/telink/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}
12 changes: 5 additions & 7 deletions examples/platform/telink/common/src/AppTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
};
Expand All @@ -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);
};
Expand Down
4 changes: 2 additions & 2 deletions examples/pump-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions examples/pump-controller-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 4 additions & 3 deletions src/platform/telink/FactoryDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,12 @@ template <class FlashFactoryData>
CHIP_ERROR FactoryDataProvider<FlashFactoryData>::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;
}
Expand Down

0 comments on commit 05f9411

Please sign in to comment.