diff --git a/kuksa_databroker/databroker/src/broker.rs b/kuksa_databroker/databroker/src/broker.rs index 99719b702..3ed09cd9b 100644 --- a/kuksa_databroker/databroker/src/broker.rs +++ b/kuksa_databroker/databroker/src/broker.rs @@ -55,7 +55,7 @@ pub struct Datapoint { #[derive(Debug, Clone)] pub struct Entry { pub datapoint: Datapoint, - pub actuator_target: Option, + pub actuator_target: Option, pub metadata: Metadata, } @@ -145,7 +145,7 @@ pub struct EntryUpdate { // Actuator target is wrapped in an additional Option<> in // order to be able to convey "update it to None" which would // mean setting it to `Some(None)`. - pub actuator_target: Option>, // only for actuators + pub actuator_target: Option>, // only for actuators // Metadata pub entry_type: Option, @@ -176,8 +176,8 @@ impl Entry { if let Some(datapoint) = &update.datapoint { self.validate_value(&datapoint.value)?; } - if let Some(Some(value)) = &update.actuator_target { - self.validate_value(value)?; + if let Some(Some(actuatortarget)) = &update.actuator_target { + self.validate_value(&actuatortarget.value)?; } Ok(()) } diff --git a/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/conversions.rs b/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/conversions.rs index 29cc1c389..1651bb219 100644 --- a/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/conversions.rs +++ b/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/conversions.rs @@ -324,7 +324,9 @@ impl From for proto::DataEntry { None => None, }, actuator_target: match from.actuator_target { - Some(Some(actuator_target)) => Option::::from(actuator_target), + Some(Some(actuator_target)) => { + Option::::from(actuator_target) + } Some(None) => None, None => None, }, diff --git a/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs b/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs index d99c6ec45..f4c2ad49d 100644 --- a/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs +++ b/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs @@ -261,7 +261,9 @@ fn proto_entry_from_entry_and_fields( }; let actuator_target = if fields.contains(&proto::Field::ActuatorTarget) { match entry.actuator_target { - Some(actuator_target) => Option::::from(actuator_target), + Some(actuator_target) => { + Option::::from(actuator_target) + } None => None, } } else { @@ -419,7 +421,7 @@ impl broker::EntryUpdate { }; let actuator_target = if fields.contains(&proto::Field::ActuatorTarget) { match &entry.actuator_target { - Some(datapoint) => Some(Some(broker::DataValue::from(datapoint.value.clone()))), + Some(datapoint) => Some(Some(broker::Datapoint::from(datapoint.clone()))), None => Some(None), } } else { diff --git a/kuksa_databroker/databroker/src/grpc/sdv_databroker_v1/broker.rs b/kuksa_databroker/databroker/src/grpc/sdv_databroker_v1/broker.rs index a14992184..82b0dc003 100644 --- a/kuksa_databroker/databroker/src/grpc/sdv_databroker_v1/broker.rs +++ b/kuksa_databroker/databroker/src/grpc/sdv_databroker_v1/broker.rs @@ -96,9 +96,7 @@ impl proto::broker_server::Broker for broker::DataBroker { broker::EntryUpdate { path: None, datapoint: None, - actuator_target: Some(Some(broker::DataValue::from( - &datapoint, - ))), + actuator_target: Some(Some(broker::Datapoint::from(&datapoint))), entry_type: None, data_type: None, description: None,