diff --git a/examples/common/pigweed/BUILD.gn b/examples/common/pigweed/BUILD.gn index 638707c72040d1..2eb4edeee3581f 100644 --- a/examples/common/pigweed/BUILD.gn +++ b/examples/common/pigweed/BUILD.gn @@ -74,6 +74,7 @@ pw_proto_library("button_service") { pw_proto_library("event_service") { sources = [ "protos/event_service.proto" ] + inputs = [ "protos/event_service.options" ] deps = [ "$dir_pw_protobuf:common_protos" ] strip_prefix = "protos" prefix = "event_service" diff --git a/examples/common/pigweed/protos/event_service.options b/examples/common/pigweed/protos/event_service.options new file mode 100644 index 00000000000000..cee34667155c87 --- /dev/null +++ b/examples/common/pigweed/protos/event_service.options @@ -0,0 +1 @@ +chip.rpc.EventSetRequest.event_payload max_size:2048 // max event size diff --git a/examples/common/pigweed/protos/event_service.proto b/examples/common/pigweed/protos/event_service.proto index 01c5589fe1aebe..2adc79ab9598cb 100644 --- a/examples/common/pigweed/protos/event_service.proto +++ b/examples/common/pigweed/protos/event_service.proto @@ -1,14 +1,13 @@ syntax = "proto3"; -import 'pw_protobuf_protos/common.proto'; - package chip.rpc; +import 'pw_protobuf_protos/common.proto'; + message EventSetRequest { uint32 endpoint_id = 1; uint32 cluster_id = 2; - uint32 event_id = 3; - std::string event_payload = 4; + string event_payload = 3; // } message EventSetResponse { diff --git a/examples/common/pigweed/rpc_services/Event.h b/examples/common/pigweed/rpc_services/Event.h index d40a95e64dd88e..55c46304a0293e 100644 --- a/examples/common/pigweed/rpc_services/Event.h +++ b/examples/common/pigweed/rpc_services/Event.h @@ -31,13 +31,12 @@ namespace rpc { class Event final : public pw_rpc::nanopb::Event::Service { public: - virtual ~Event() = default; - - virtual pw::Status Set(const chip_rpc_EventSetRequest & request, chip_rpc_EventSetResponse & response) + ::pw::Status Set( const ::chip_rpc_EventSetRequest& request, ::chip_rpc_EventSetResponse& response) { EndpointId endpointId = request.endpoint_id; uint8_t newPosition = 1 ; // to be parsed from request.event_payload +printf("\033[41m %s, %d, request.event_playload=%s \033[0m \n", __func__, __LINE__, request.event_payload); EventNumber eventNumber; { DeviceLayer::StackLock lock; @@ -53,10 +52,10 @@ class Event final : public pw_rpc::nanopb::Event::Service return pw::OkStatus(); } - virtual pw::Status Get(const chip_rpc_EventGetRequest & request, chip_rpc_EventGetResponse & response) + ::pw::Status Get( const ::chip_rpc_EventGetRequest& request, ::chip_rpc_EventGetResponse& response) { EndpointId endpointId = request.endpoint_id; - uint32 event_id = 1; // TBD + // uint32_t event_id = 1; // TBD { DeviceLayer::StackLock lock; @@ -64,7 +63,7 @@ class Event final : public pw_rpc::nanopb::Event::Service // RETURN_STATUS_IF_NOT_OK(app::Clusters::Switch::Attributes::StateValue::Get(endpointId, &state_value)); } - response.state.event_id = event_id; + response.event_id = endpointId; return pw::OkStatus(); } }; diff --git a/examples/platform/linux/Rpc.cpp b/examples/platform/linux/Rpc.cpp index 6e5f2433cfaf03..5da57a37011408 100644 --- a/examples/platform/linux/Rpc.cpp +++ b/examples/platform/linux/Rpc.cpp @@ -89,7 +89,7 @@ Device device_service; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE #if defined(PW_RPC_EVENT_SERVICE) && PW_RPC_EVENT_SERVICE -BooleanState event_service; +Event event_service; #endif // defined(PW_RPC_EVENT_SERVICE) && PW_RPC_EVENT_SERVICE #if defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE