Skip to content

Commit

Permalink
Extending BatchActuateStreamResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbosch committed Nov 14, 2024
1 parent 95dcfcf commit f0bf515
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
26 changes: 22 additions & 4 deletions databroker/src/grpc/kuksa_val_v2/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,10 @@ impl proto::val_server::Val for broker::DataBroker {
// e.g. if sending an unsupported enum value
// - if the published value is out of the min/max range specified
//
// - Provider returns BatchActuateStreamResponse <- Databroker sends BatchActuateStreamRequest
// No error definition, a BatchActuateStreamResponse is expected from provider.
// - Databroker sends BatchActuateStreamRequest -> Provider may return BatchActuateStreamResponse upon error,
// but should for performance reasons send nothing upon success.
// It is up to the provider to decide if the stream shall be closed,
// as of today Databroker will not react on the received error message.
//
async fn open_provider_stream(
&self,
Expand Down Expand Up @@ -678,8 +680,24 @@ impl proto::val_server::Val for broker::DataBroker {
}
}
},
Some(BatchActuateStreamResponse(_batch_actuate_stream_response)) => {
// TODO discuss and implement
Some(BatchActuateStreamResponse(batch_actuate_stream_response)) => {
let mut msg : String = "Batch actuate stream response error".to_string();
if let Some(signal_id) = batch_actuate_stream_response.signal_id {
match signal_id.signal {
Some(proto::signal_id::Signal::Path(path)) => {
msg = msg + ", path: " + &path;
}
Some(proto::signal_id::Signal::Id(id)) => {
msg = msg + ", id: " + &id.to_string();
}
None => {}
}
}
if let Some(error) = batch_actuate_stream_response.error {
msg = msg + ", error code: " + &error.code.to_string() + ", error message: " + &error.message;
}
debug!(msg)

},
None => {

Expand Down
11 changes: 9 additions & 2 deletions proto/kuksa/val/v2/val.proto
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ service VAL {
// e.g. if sending an unsupported enum value
// - if the published value is out of the min/max range specified
//
// - Provider returns BatchActuateStreamResponse <- Databroker sends BatchActuateStreamRequest
// No error definition, a BatchActuateStreamResponse is expected from provider.
// - Databroker sends BatchActuateStreamRequest -> Provider may return one or more BatchActuateStreamResponse upon error,
// but should for performance reasons send nothing upon success.
// It is up to the provider to decide if the stream shall be closed,
// as of today Databroker will not react on the received error message.
//
rpc OpenProviderStream(stream OpenProviderStreamRequest) returns (stream OpenProviderStreamResponse);

Expand Down Expand Up @@ -280,7 +282,12 @@ message BatchActuateStreamRequest {
repeated ActuateRequest actuate_requests = 1;
}

// Message that can be used by provider to indicate that an actuation request was not accepted.
// It is optional for the provider to use this message, and for performance reasons it is recommended
// not to send it upon success.
message BatchActuateStreamResponse {
SignalID signal_id = 1;
Error error = 2;
}

message OpenProviderStreamRequest {
Expand Down

0 comments on commit f0bf515

Please sign in to comment.