From 422015fba254bd72e13b4a157f7f82d80044d999 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 1 May 2024 14:45:04 +0000 Subject: [PATCH] Restyled by clang-format --- .../chef/common/chef-descriptor-namespace.h | 8 +- .../chef/common/chef-rpc-actions-worker.cpp | 63 +++--- .../chef/common/chef-rpc-actions-worker.h | 28 +-- .../clusters/switch/SwitchEventHandler.cpp | 1 - .../clusters/switch/SwitchEventHandler.h | 3 +- .../common/clusters/switch/SwitchManager.cpp | 181 +++++++++--------- .../common/pigweed/rpc_services/Actions.h | 32 ++-- examples/platform/esp32/Rpc.h | 9 +- examples/platform/linux/Rpc.cpp | 4 +- examples/platform/linux/Rpc.h | 11 +- examples/platform/nrfconnect/Rpc.h | 10 +- 11 files changed, 185 insertions(+), 165 deletions(-) diff --git a/examples/chef/common/chef-descriptor-namespace.h b/examples/chef/common/chef-descriptor-namespace.h index d3bf63ace32de7..e7e8e85df5a551 100644 --- a/examples/chef/common/chef-descriptor-namespace.h +++ b/examples/chef/common/chef-descriptor-namespace.h @@ -42,10 +42,10 @@ constexpr const uint8_t kTagPositionRight = 1; // Common Position Namespace: 8, tag: 2 (Top) constexpr const uint8_t kTagPositionTop = 2; // Common Position Namespace: 8, tag: 3 (Bottom) -constexpr const uint8_t kTagPositionBottom = 3; +constexpr const uint8_t kTagPositionBottom = 3; // Common Position Namespace: 8, tag: 4 (Middle) -constexpr const uint8_t kTagPositionMiddle = 4; +constexpr const uint8_t kTagPositionMiddle = 4; // Common Position Namespace: 8, tag: 5 (Row) -constexpr const uint8_t kTagPositionRow = 5; +constexpr const uint8_t kTagPositionRow = 5; // Common Position Namespace: 8, tag: 6 (Column) -constexpr const uint8_t kTagPositionColumn = 6; +constexpr const uint8_t kTagPositionColumn = 6; diff --git a/examples/chef/common/chef-rpc-actions-worker.cpp b/examples/chef/common/chef-rpc-actions-worker.cpp index 6fd00c9de44c37..abffc7ed2f2656 100644 --- a/examples/chef/common/chef-rpc-actions-worker.cpp +++ b/examples/chef/common/chef-rpc-actions-worker.cpp @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include using chip::app::DataModel::Nullable; @@ -32,11 +32,12 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::rpc; -static std::map gActionsDelegateMap {}; +static std::map gActionsDelegateMap{}; ActionsDelegate * RpcFindActionsDelegate(ClusterId clusterId) { - if (gActionsDelegateMap.find(clusterId) != gActionsDelegateMap.end()) { + if (gActionsDelegateMap.find(clusterId) != gActionsDelegateMap.end()) + { return gActionsDelegateMap[clusterId]; } @@ -45,12 +46,13 @@ ActionsDelegate * RpcFindActionsDelegate(ClusterId clusterId) static void RpcActionsTaskCallback(System::Layer * systemLayer, void * data) { - ChefRpcActionsWorker * worker = (ChefRpcActionsWorker *)data; + ChefRpcActionsWorker * worker = (ChefRpcActionsWorker *) data; worker->ProcessActionQueue(); } -bool ChefRpcActionsCallback(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, uint32_t actionId, std::vector args) +bool ChefRpcActionsCallback(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, uint32_t actionId, + std::vector args) { ActionTask task(endpointId, clusterId, static_cast(type), delayMs, actionId, args); @@ -61,13 +63,15 @@ bool ChefRpcActionsWorker::EnqueueAction(ActionTask task) { bool kickTimer = false; - if (queue.empty()) { - kickTimer = true; // kick timer when the first task is adding to the queue + if (queue.empty()) + { + kickTimer = true; // kick timer when the first task is adding to the queue } queue.push(task); - if (kickTimer) { + if (kickTimer) + { (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(task.delayMs), RpcActionsTaskCallback, this); } return true; @@ -80,27 +84,36 @@ void ChefRpcActionsWorker::ProcessActionQueue() queue.pop(); ActionsDelegate * delegate = RpcFindActionsDelegate(task.clusterId); - if ( nullptr == delegate ) { - ChipLogError(NotSpecified, "Cannot run action due to not finding delegate: endpointId=%d, clusterId=%04lx, attributeId=%04lx \033[0m \n", task.endpointId, static_cast(task.clusterId), static_cast(task.actionId)); - } else { + if (nullptr == delegate) + { + ChipLogError(NotSpecified, + "Cannot run action due to not finding delegate: endpointId=%d, clusterId=%04lx, attributeId=%04lx \033[0m \n", + task.endpointId, static_cast(task.clusterId), static_cast(task.actionId)); + } + else + { ActionType type = static_cast(task.type); - switch (type) { - case ActionType::WRITE_ATTRIBUTE: + switch (type) { - ChipLogProgress(NotSpecified, "Writing Attribute: endpointId=%d, clusterId=%04lx, attributeId=%04lx, args.size=%lu", task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), static_cast(task.args.size())); + case ActionType::WRITE_ATTRIBUTE: { + ChipLogProgress(NotSpecified, "Writing Attribute: endpointId=%d, clusterId=%04lx, attributeId=%04lx, args.size=%lu", + task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), + static_cast(task.args.size())); delegate->AttributeWriteHandler(task.endpointId, static_cast(task.actionId), task.args); } break; - case ActionType::RUN_COMMAND: - { - ChipLogProgress(NotSpecified, "Running Command: endpointId=%d, clusterId=%04lx, commandId=%04lx, args.size=%lu",task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), static_cast(task.args.size())); + case ActionType::RUN_COMMAND: { + ChipLogProgress(NotSpecified, "Running Command: endpointId=%d, clusterId=%04lx, commandId=%04lx, args.size=%lu", + task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), + static_cast(task.args.size())); delegate->CommandHandler(task.endpointId, static_cast(task.actionId), task.args); } break; - case ActionType::EMIT_EVENT: - { - ChipLogProgress(NotSpecified, "Emitting Event: endpointId=%d, clusterId=%04lx, eventIdId=%04lx, args.size=%lu",task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), static_cast(task.args.size())); + case ActionType::EMIT_EVENT: { + ChipLogProgress(NotSpecified, "Emitting Event: endpointId=%d, clusterId=%04lx, eventIdId=%04lx, args.size=%lu", + task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), + static_cast(task.args.size())); delegate->EventHandler(task.endpointId, static_cast(task.actionId), task.args); } break; @@ -109,21 +122,25 @@ void ChefRpcActionsWorker::ProcessActionQueue() } } - if (queue.empty()) { + if (queue.empty()) + { // Return due to no more actions in queue return; } // Run next action task = queue.front(); - ChipLogProgress(NotSpecified, "StartTimer: endpointId=%d, clusterId=%04lx, eventIdId=%04lx, task.delyMs=%lu",task.endpointId, static_cast(task.clusterId), static_cast(task.actionId), static_cast(task.delayMs)); + ChipLogProgress(NotSpecified, "StartTimer: endpointId=%d, clusterId=%04lx, eventIdId=%04lx, task.delyMs=%lu", task.endpointId, + static_cast(task.clusterId), static_cast(task.actionId), + static_cast(task.delayMs)); (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(task.delayMs), RpcActionsTaskCallback, this); } void ChefRpcActionsWorker::RegisterRpcActionsDelegate(ClusterId clusterId, ActionsDelegate * delegate) { // Register by cluster - if ( nullptr == RpcFindActionsDelegate(clusterId) ) { + if (nullptr == RpcFindActionsDelegate(clusterId)) + { gActionsDelegateMap[clusterId] = delegate; return; } diff --git a/examples/chef/common/chef-rpc-actions-worker.h b/examples/chef/common/chef-rpc-actions-worker.h index 4b6cb15f63a69a..c9d0fae46d1d94 100644 --- a/examples/chef/common/chef-rpc-actions-worker.h +++ b/examples/chef/common/chef-rpc-actions-worker.h @@ -21,9 +21,9 @@ #include #include #include -#include -#include #include +#include +#include #include "Rpc.h" @@ -33,34 +33,35 @@ namespace app { class ActionsDelegate { public: - ActionsDelegate(ClusterId clusterId): mClusterId(clusterId) { }; + ActionsDelegate(ClusterId clusterId) : mClusterId(clusterId){}; virtual ~ActionsDelegate() = default; - virtual void AttributeWriteHandler(chip::EndpointId endpointId, chip::AttributeId attributeId, std::vectorargs) {}; - virtual void CommandHandler(chip::EndpointId endpointId, chip::CommandId commandId, std::vectorargs) {}; - virtual void EventHandler(chip::EndpointId endpointId, chip::EventId eventId, std::vectorargs) {}; + virtual void AttributeWriteHandler(chip::EndpointId endpointId, chip::AttributeId attributeId, std::vector args){}; + virtual void CommandHandler(chip::EndpointId endpointId, chip::CommandId commandId, std::vector args){}; + virtual void EventHandler(chip::EndpointId endpointId, chip::EventId eventId, std::vector args){}; protected: ClusterId mClusterId; }; -struct ActionTask { +struct ActionTask +{ chip::EndpointId endpointId; chip::ClusterId clusterId; - chip::rpc::ActionType type; // Aligned with Storage buf + chip::rpc::ActionType type; // Aligned with Storage buf uint32_t delayMs; uint32_t actionId; std::vector args; - ActionTask(chip::EndpointId e, chip::ClusterId c, - chip::rpc::ActionType t, uint32_t d, uint32_t i, std::vector a): endpointId(e), clusterId(c), type(t), delayMs(d), actionId(i), args(a) {}; - ~ActionTask() {}; + ActionTask(chip::EndpointId e, chip::ClusterId c, chip::rpc::ActionType t, uint32_t d, uint32_t i, std::vector a) : + endpointId(e), clusterId(c), type(t), delayMs(d), actionId(i), args(a){}; + ~ActionTask(){}; }; class ChefRpcActionsWorker { public: - static ChefRpcActionsWorker& Instance(); + static ChefRpcActionsWorker & Instance(); ChefRpcActionsWorker(); @@ -68,10 +69,9 @@ class ChefRpcActionsWorker void ProcessActionQueue(); void RegisterRpcActionsDelegate(ClusterId clusterId, ActionsDelegate * delegate); - private: +private: std::queue queue; }; - } // namespace app } // namespace chip diff --git a/examples/chef/common/clusters/switch/SwitchEventHandler.cpp b/examples/chef/common/clusters/switch/SwitchEventHandler.cpp index 402244208dcac2..6313c214611d53 100644 --- a/examples/chef/common/clusters/switch/SwitchEventHandler.cpp +++ b/examples/chef/common/clusters/switch/SwitchEventHandler.cpp @@ -30,7 +30,6 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::Switch; using namespace chip::DeviceLayer; - void SwitchEventHandler::OnSwitchLatched(EndpointId endpointId, uint8_t newPosition) { ChipLogDetail(NotSpecified, "The latching switch is moved to a new position:%d", newPosition); diff --git a/examples/chef/common/clusters/switch/SwitchEventHandler.h b/examples/chef/common/clusters/switch/SwitchEventHandler.h index 3d0000efba87b3..1648e19cc829c5 100644 --- a/examples/chef/common/clusters/switch/SwitchEventHandler.h +++ b/examples/chef/common/clusters/switch/SwitchEventHandler.h @@ -32,7 +32,7 @@ namespace Switch { class SwitchEventHandler { public: - SwitchEventHandler() {}; + SwitchEventHandler(){}; /** * Should be called when the latching switch is moved to a new position. @@ -74,7 +74,6 @@ class SwitchEventHandler private: }; - } // namespace Switch } // namespace Clusters } // namespace app diff --git a/examples/chef/common/clusters/switch/SwitchManager.cpp b/examples/chef/common/clusters/switch/SwitchManager.cpp index 595edbaa7436be..11f6626135793c 100644 --- a/examples/chef/common/clusters/switch/SwitchManager.cpp +++ b/examples/chef/common/clusters/switch/SwitchManager.cpp @@ -16,16 +16,16 @@ * limitations under the License. */ +#include "SwitchEventHandler.h" #include #include #include #include #include #include -#include "SwitchEventHandler.h" -#include "chef-rpc-actions-worker.h" #include "chef-descriptor-namespace.h" +#include "chef-rpc-actions-worker.h" using namespace chip; using namespace chip::app; @@ -36,135 +36,132 @@ using namespace chip::DeviceLayer; using namespace chip::rpc; using namespace chip::app; -class SwitchActionsDelegate: public chip::app::ActionsDelegate +class SwitchActionsDelegate : public chip::app::ActionsDelegate { public: - SwitchActionsDelegate(ClusterId clusterId, SwitchEventHandler *eventHandler): ActionsDelegate(clusterId), mEventHandler(eventHandler){}; - ~SwitchActionsDelegate() override {}; - - void AttributeWriteHandler(chip::EndpointId endpointId, chip::AttributeId attributeId, std::vectorargs) override; - void EventHandler(chip::EndpointId endpointId, chip::EventId eventId, std::vectorargs) override; + SwitchActionsDelegate(ClusterId clusterId, SwitchEventHandler * eventHandler) : + ActionsDelegate(clusterId), mEventHandler(eventHandler){}; + ~SwitchActionsDelegate() override{}; + void AttributeWriteHandler(chip::EndpointId endpointId, chip::AttributeId attributeId, std::vector args) override; + void EventHandler(chip::EndpointId endpointId, chip::EventId eventId, std::vector args) override; private: - SwitchEventHandler *mEventHandler; + SwitchEventHandler * mEventHandler; }; -void SwitchActionsDelegate::AttributeWriteHandler(chip::EndpointId endpointId, chip::AttributeId attributeId, std::vectorargs) +void SwitchActionsDelegate::AttributeWriteHandler(chip::EndpointId endpointId, chip::AttributeId attributeId, + std::vector args) { - if (args.empty()) { + if (args.empty()) + { ChipLogError(NotSpecified, "Queue is empty "); return; } - switch (attributeId) { - case Switch::Attributes::NumberOfPositions::Id: - { - uint8_t data = static_cast(args[0]); - app::Clusters::Switch::Attributes::NumberOfPositions::Set(endpointId, data); - } - break; - case Switch::Attributes::CurrentPosition::Id: - { - uint8_t data = static_cast(args[0]); - app::Clusters::Switch::Attributes::CurrentPosition::Set(endpointId, data); - } - break; - case Switch::Attributes::MultiPressMax::Id: - { - uint8_t data = static_cast(args[0]); - app::Clusters::Switch::Attributes::MultiPressMax::Set(endpointId, data); - } - break; + switch (attributeId) + { + case Switch::Attributes::NumberOfPositions::Id: { + uint8_t data = static_cast(args[0]); + app::Clusters::Switch::Attributes::NumberOfPositions::Set(endpointId, data); + } + break; + case Switch::Attributes::CurrentPosition::Id: { + uint8_t data = static_cast(args[0]); + app::Clusters::Switch::Attributes::CurrentPosition::Set(endpointId, data); + } + break; + case Switch::Attributes::MultiPressMax::Id: { + uint8_t data = static_cast(args[0]); + app::Clusters::Switch::Attributes::MultiPressMax::Set(endpointId, data); + } + break; default: break; } } -void SwitchActionsDelegate::EventHandler(chip::EndpointId endpointId, chip::EventId eventId, std::vectorargs) +void SwitchActionsDelegate::EventHandler(chip::EndpointId endpointId, chip::EventId eventId, std::vector args) { - if (args.empty()) { + if (args.empty()) + { ChipLogError(NotSpecified, "Queue is empty "); return; } - switch (eventId) { - case Events::SwitchLatched::Id: - { - uint8_t newPosition = static_cast(args[0]); - mEventHandler->OnSwitchLatched(endpointId, newPosition); - } - break; - case Events::InitialPress::Id: - { - uint8_t newPosition = static_cast(args[0]); - mEventHandler->OnInitialPress(endpointId, newPosition); - } - break; - case Events::LongPress::Id: - { - uint8_t newPosition = static_cast(args[0]); - mEventHandler->OnLongPress(endpointId, newPosition); - } - break; - case Events::ShortRelease::Id: - { - uint8_t previousPosition = static_cast(args[0]); - mEventHandler->OnShortRelease(endpointId, previousPosition); - } - break; - case Events::LongRelease::Id: - { - uint8_t previousPosition = static_cast(args[0]); - mEventHandler->OnLongRelease(endpointId, previousPosition); - } - break; - case Events::MultiPressOngoing::Id: + switch (eventId) + { + case Events::SwitchLatched::Id: { + uint8_t newPosition = static_cast(args[0]); + mEventHandler->OnSwitchLatched(endpointId, newPosition); + } + break; + case Events::InitialPress::Id: { + uint8_t newPosition = static_cast(args[0]); + mEventHandler->OnInitialPress(endpointId, newPosition); + } + break; + case Events::LongPress::Id: { + uint8_t newPosition = static_cast(args[0]); + mEventHandler->OnLongPress(endpointId, newPosition); + } + break; + case Events::ShortRelease::Id: { + uint8_t previousPosition = static_cast(args[0]); + mEventHandler->OnShortRelease(endpointId, previousPosition); + } + break; + case Events::LongRelease::Id: { + uint8_t previousPosition = static_cast(args[0]); + mEventHandler->OnLongRelease(endpointId, previousPosition); + } + break; + case Events::MultiPressOngoing::Id: { + if (args.size() < 2) { - if (args.size() < 2) { - ChipLogError(NotSpecified, "MultiPressOngoing to few arguments"); - return; - } - uint8_t newPosition = static_cast(args[0]); - uint8_t currentNumberOfPressesCounted = static_cast(args[1]); - mEventHandler->OnMultiPressOngoing(endpointId, newPosition, currentNumberOfPressesCounted); + ChipLogError(NotSpecified, "MultiPressOngoing to few arguments"); + return; } - break; - case Events::MultiPressComplete::Id: + uint8_t newPosition = static_cast(args[0]); + uint8_t currentNumberOfPressesCounted = static_cast(args[1]); + mEventHandler->OnMultiPressOngoing(endpointId, newPosition, currentNumberOfPressesCounted); + } + break; + case Events::MultiPressComplete::Id: { + if (args.size() < 2) { - if (args.size() < 2) { - ChipLogError(NotSpecified, "MultiPressComplete to few arguments"); - return; - } - uint8_t previousPosition = static_cast(args[0]); - uint8_t totalNumberOfPressesCounted = static_cast(args[1]); - mEventHandler->OnMultiPressComplete(endpointId, previousPosition, totalNumberOfPressesCounted); + ChipLogError(NotSpecified, "MultiPressComplete to few arguments"); + return; } - break; + uint8_t previousPosition = static_cast(args[0]); + uint8_t totalNumberOfPressesCounted = static_cast(args[1]); + mEventHandler->OnMultiPressComplete(endpointId, previousPosition, totalNumberOfPressesCounted); + } + break; default: break; } }; - const Clusters::Descriptor::Structs::SemanticTagStruct::Type gLatchingSwitch[] = { { .namespaceID = kNamespaceCommonLevel, - .tag = kTagCommonLow, - .label = chip::Optional>( - { chip::app::DataModel::MakeNullable(chip::CharSpan("Low", 3)) })}, + .tag = kTagCommonLow, + .label = chip::Optional>( + { chip::app::DataModel::MakeNullable(chip::CharSpan("Low", 3)) }) }, { .namespaceID = kNamespaceCommonLevel, - .tag = kTagCommonMedium, - .label = chip::Optional>( - { chip::app::DataModel::MakeNullable(chip::CharSpan("Medium", 6)) })}, + .tag = kTagCommonMedium, + .label = chip::Optional>( + { chip::app::DataModel::MakeNullable(chip::CharSpan("Medium", 6)) }) }, { .namespaceID = kNamespaceCommonLevel, - .tag = kTagCommonHigh, - .label = chip::Optional>( - { chip::app::DataModel::MakeNullable(chip::CharSpan("High", 4)) })} + .tag = kTagCommonHigh, + .label = chip::Optional>( + { chip::app::DataModel::MakeNullable(chip::CharSpan("High", 4)) }) } }; void emberAfSwitchClusterInitCallback(EndpointId endpointId) { ChipLogProgress(Zcl, "Chef: emberAfSwitchClusterInitCallback"); - ChefRpcActionsWorker::Instance().RegisterRpcActionsDelegate(Clusters::Switch::Id, new SwitchActionsDelegate(Clusters::Switch::Id, new SwitchEventHandler())); + ChefRpcActionsWorker::Instance().RegisterRpcActionsDelegate( + Clusters::Switch::Id, new SwitchActionsDelegate(Clusters::Switch::Id, new SwitchEventHandler())); SetTagList(/* endpoint= */ 1, Span(gLatchingSwitch)); } diff --git a/examples/common/pigweed/rpc_services/Actions.h b/examples/common/pigweed/rpc_services/Actions.h index 9ff7fe92982407..ad03662a1550e2 100644 --- a/examples/common/pigweed/rpc_services/Actions.h +++ b/examples/common/pigweed/rpc_services/Actions.h @@ -23,8 +23,8 @@ #include #include -#include "app/util/attribute-storage.h" #include "actions_service/actions_service.rpc.pb.h" +#include "app/util/attribute-storage.h" #include "pigweed/rpc_services/internal/StatusUtils.h" #include #include @@ -36,37 +36,43 @@ namespace rpc { class Actions final : public pw_rpc::nanopb::Actions::Service { public: - enum class Type: uint8_t { + enum class Type : uint8_t + { Attribute = 0, - Command = 1, - Event = 2, + Command = 1, + Event = 2, }; - ::pw::Status Set( const chip_rpc_ActionsRequest & request, ::pw_protobuf_Empty & response) + ::pw::Status Set(const chip_rpc_ActionsRequest & request, ::pw_protobuf_Empty & response) { DeviceLayer::StackLock lock; - ChipLogError(NotSpecified," request.endpoint_id=%d, request.cluster_id=%d", request.endpoint_id, request.cluster_id); + ChipLogError(NotSpecified, " request.endpoint_id=%d, request.cluster_id=%d", request.endpoint_id, request.cluster_id); - for (int i = 0; i < request.actions_count; i++) { + for (int i = 0; i < request.actions_count; i++) + { chip_rpc_Action action = request.actions[i]; std::vector args; - if (action.has_arg1) args.push_back(action.arg1); - if (action.has_arg2) args.push_back(action.arg2); - if (action.has_arg3) args.push_back(action.arg3); + if (action.has_arg1) + args.push_back(action.arg1); + if (action.has_arg2) + args.push_back(action.arg2); + if (action.has_arg3) + args.push_back(action.arg3); - mActionsSubscribeCallback(request.endpoint_id, request.cluster_id, static_cast(action.type), action.delayMs, action.actionId, args); + mActionsSubscribeCallback(request.endpoint_id, request.cluster_id, static_cast(action.type), action.delayMs, + action.actionId, args); } return pw::OkStatus(); } - using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, uint32_t actionId, std::vector args); + using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, + uint32_t actionId, std::vector args); void SubscribeActions(RpcActionsSubscribeCallback subscriber) { mActionsSubscribeCallback = subscriber; }; private: RpcActionsSubscribeCallback mActionsSubscribeCallback; - }; } // namespace rpc diff --git a/examples/platform/esp32/Rpc.h b/examples/platform/esp32/Rpc.h index 13ab1c3174aa88..ff1a5f319ac975 100644 --- a/examples/platform/esp32/Rpc.h +++ b/examples/platform/esp32/Rpc.h @@ -22,12 +22,13 @@ namespace rpc { enum class ActionType : uint8_t { - WRITE_ATTRIBUTE = 0x00, // Write an cluster Attribute - RUN_COMMAND = 0x01, // Run a cluster Command - EMIT_EVENT = 0x02, // Emit a cluster Events + WRITE_ATTRIBUTE = 0x00, // Write an cluster Attribute + RUN_COMMAND = 0x01, // Run a cluster Command + EMIT_EVENT = 0x02, // Emit a cluster Events }; -using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, uint32_t actionId, std::vector args); +using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, + uint32_t actionId, std::vector args); void SubscribeActions(RpcActionsSubscribeCallback subscriber); diff --git a/examples/platform/linux/Rpc.cpp b/examples/platform/linux/Rpc.cpp index 269512832d6683..6e20e2aecf61b9 100644 --- a/examples/platform/linux/Rpc.cpp +++ b/examples/platform/linux/Rpc.cpp @@ -20,11 +20,11 @@ #include "pw_rpc_system_server/rpc_server.h" #include "pw_rpc_system_server/socket.h" -#include #include +#include -#include #include "Rpc.h" +#include #if defined(PW_RPC_ACTIONS_SERVICE) && PW_RPC_ACTIONS_SERVICE #include "pigweed/rpc_services/Actions.h" diff --git a/examples/platform/linux/Rpc.h b/examples/platform/linux/Rpc.h index 2e45364fd360f8..51f3f2e473bacb 100644 --- a/examples/platform/linux/Rpc.h +++ b/examples/platform/linux/Rpc.h @@ -18,20 +18,21 @@ #pragma once -#include #include +#include namespace chip { namespace rpc { enum class ActionType : uint8_t { - WRITE_ATTRIBUTE = 0x00, // Write an cluster Attribute - RUN_COMMAND = 0x01, // Run a cluster Command - EMIT_EVENT = 0x02, // Emit a cluster Events + WRITE_ATTRIBUTE = 0x00, // Write an cluster Attribute + RUN_COMMAND = 0x01, // Run a cluster Command + EMIT_EVENT = 0x02, // Emit a cluster Events }; -using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, uint32_t actionId, std::vector args); +using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, + uint32_t actionId, std::vector args); void SubscribeActions(RpcActionsSubscribeCallback subscriber); diff --git a/examples/platform/nrfconnect/Rpc.h b/examples/platform/nrfconnect/Rpc.h index be82bbe9fa191e..40efcb0750ca2b 100644 --- a/examples/platform/nrfconnect/Rpc.h +++ b/examples/platform/nrfconnect/Rpc.h @@ -25,16 +25,16 @@ namespace rpc { enum class ActionType : uint8_t { - WRITE_ATTRIBUTE = 0x00, // Write an cluster Attribute - RUN_COMMAND = 0x01, // Run a cluster Command - EMIT_EVENT = 0x02, // Emit a cluster Events + WRITE_ATTRIBUTE = 0x00, // Write an cluster Attribute + RUN_COMMAND = 0x01, // Run a cluster Command + EMIT_EVENT = 0x02, // Emit a cluster Events }; -using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, uint32_t actionId, std::vector args); +using RpcActionsSubscribeCallback = bool (*)(EndpointId endpointId, ClusterId clusterId, uint8_t type, uint32_t delayMs, + uint32_t actionId, std::vector args); void SubscribeActions(RpcActionsSubscribeCallback subscriber); - class NrfButton; void RunRpcService(void *, void *, void *);