diff --git a/databroker/src/grpc/kuksa_val_v1/conversions.rs b/databroker/src/grpc/kuksa_val_v1/conversions.rs index a4df19d1..d9b972d1 100644 --- a/databroker/src/grpc/kuksa_val_v1/conversions.rs +++ b/databroker/src/grpc/kuksa_val_v1/conversions.rs @@ -143,7 +143,6 @@ impl From for Option { })), timestamp: Some(from.ts.into()), }), - broker::DataValue::ValueFailure(_) => None, } } } @@ -232,7 +231,6 @@ impl From for Option { })), timestamp: None, }), - broker::DataValue::ValueFailure(_) => None, } } } diff --git a/databroker/src/grpc/kuksa_val_v2/conversions.rs b/databroker/src/grpc/kuksa_val_v2/conversions.rs index 44a990cc..1d7aae72 100644 --- a/databroker/src/grpc/kuksa_val_v2/conversions.rs +++ b/databroker/src/grpc/kuksa_val_v2/conversions.rs @@ -159,10 +159,6 @@ impl From for Option { })), timestamp: Some(from.ts.into()), }), - broker::DataValue::ValueFailure(failure) => Some(proto::Datapoint { - value_state: Some(proto::datapoint::ValueState::Failure(i32::from(&failure))), - timestamp: Some(from.ts.into()), - }), } } } @@ -180,31 +176,6 @@ impl From<&broker::ValueFailure> for i32 { } } -impl From<&i32> for broker::ValueFailure { - fn from(from: &i32) -> Self { - match from { - 1 => broker::ValueFailure::InvalidValue, - 2 => broker::ValueFailure::NotProvided, - 3 => broker::ValueFailure::UnknownSignal, - 4 => broker::ValueFailure::AccessDenied, - 5 => broker::ValueFailure::InternalError, - _ => broker::ValueFailure::Unspecified, - } - } -} - -fn from_i32(value: i32) -> proto::ValueFailure { - // Use a match statement to convert the i32 to the corresponding enum variant - match value { - 1 => proto::ValueFailure::InvalidValue, - 2 => proto::ValueFailure::NotProvided, - 3 => proto::ValueFailure::UnknownSignal, - 4 => proto::ValueFailure::AccessDenied, - 5 => proto::ValueFailure::InternalError, - _ => proto::ValueFailure::Unspecified, - } -} - impl From<&proto::ValueFailure> for broker::ValueFailure { fn from(value_failure: &proto::ValueFailure) -> Self { match value_failure { @@ -256,11 +227,9 @@ impl From<&proto::Datapoint> for broker::DataValue { Some(proto::value::TypedValue::DoubleArray(array)) => { broker::DataValue::DoubleArray(array.values.clone()) } - None => todo!(), + None => broker::DataValue::NotAvailable, }, - Some(Failure(value)) => { - broker::DataValue::ValueFailure(broker::ValueFailure::from(&from_i32(*value))) - } + Some(Failure(_)) => broker::DataValue::NotAvailable, None => broker::DataValue::NotAvailable, } } diff --git a/databroker/src/grpc/sdv_databroker_v1/conversions.rs b/databroker/src/grpc/sdv_databroker_v1/conversions.rs index 8b3325a4..d52600e6 100644 --- a/databroker/src/grpc/sdv_databroker_v1/conversions.rs +++ b/databroker/src/grpc/sdv_databroker_v1/conversions.rs @@ -101,9 +101,6 @@ impl From<&broker::Datapoint> for proto::Datapoint { broker::DataValue::NotAvailable => proto::datapoint::Value::FailureValue( proto::datapoint::Failure::NotAvailable as i32, ), - broker::DataValue::ValueFailure(_) => proto::datapoint::Value::FailureValue( - proto::datapoint::Failure::InternalError as i32, - ), }; proto::Datapoint { @@ -169,9 +166,6 @@ impl From<&broker::QueryField> for proto::Datapoint { broker::DataValue::NotAvailable => proto::datapoint::Value::FailureValue( proto::datapoint::Failure::NotAvailable.into(), ), - broker::DataValue::ValueFailure(_) => proto::datapoint::Value::FailureValue( - proto::datapoint::Failure::InternalError.into(), - ), }; proto::Datapoint { diff --git a/databroker/src/types.rs b/databroker/src/types.rs index 16000c31..ed3f029f 100644 --- a/databroker/src/types.rs +++ b/databroker/src/types.rs @@ -84,7 +84,6 @@ pub enum DataValue { Uint64Array(Vec), FloatArray(Vec), DoubleArray(Vec), - ValueFailure(ValueFailure), } #[derive(Debug)]