From a0ce789f45aa6daf6b284f2f3affdfc13c7f75cf Mon Sep 17 00:00:00 2001 From: Ash Beitz <8304894+ashbeitz@users.noreply.github.com> Date: Thu, 9 May 2024 14:03:51 -0700 Subject: [PATCH] Digital Twin Graph --- digital-twin-model/src/sdv_v1.rs | 119 +++++++++++------- .../digital_twin_graph/consumer/src/main.rs | 36 +++--- .../seat_massager_provider/src/main.rs | 45 +++---- .../src/request_impl.rs | 2 +- .../vehicle_core_provider/src/main.rs | 15 ++- samples/seat_massager/consumer/src/main.rs | 4 +- .../provider/src/request_impl.rs | 6 +- 7 files changed, 122 insertions(+), 105 deletions(-) diff --git a/digital-twin-model/src/sdv_v1.rs b/digital-twin-model/src/sdv_v1.rs index ba5587ae..f1932662 100644 --- a/digital-twin-model/src/sdv_v1.rs +++ b/digital-twin-model/src/sdv_v1.rs @@ -31,7 +31,7 @@ pub mod airbag_seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -53,7 +53,7 @@ pub mod airbag_seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -80,7 +80,7 @@ pub mod airbag_seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -101,7 +101,7 @@ pub mod airbag_seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -156,7 +156,7 @@ pub mod basic_airbag_seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct ENTITY_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -242,7 +242,7 @@ pub mod cabin { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct ENTITY_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -281,6 +281,20 @@ pub mod camera { pub media_content: Vec, } } + + #[derive(derivative::Derivative)] + #[derivative(Default)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] + pub struct ENTITY_TYPE { + #[serde(rename = "@context")] + #[derivative(Default(value = "crate::sdv_v1::context()"))] + pub context: Vec, + #[serde(rename = "@id")] + pub instance_id: String, + #[serde(rename = "@type")] + #[derivative(Default(value = "crate::sdv_v1::camera::ID.to_string()"))] + pub model_id: String, + } } pub mod hmi { @@ -300,7 +314,7 @@ pub mod hmi { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -335,6 +349,20 @@ pub mod hmi { } } + #[derive(derivative::Derivative)] + #[derivative(Default)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] + pub struct ENTITY_TYPE { + #[serde(rename = "@context")] + #[derivative(Default(value = "crate::sdv_v1::context()"))] + pub context: Vec, + #[serde(rename = "@id")] + pub instance_id: String, + #[serde(rename = "@type")] + #[derivative(Default(value = "crate::sdv_v1::hmi::ID.to_string()"))] + pub model_id: String, + } + pub mod status { pub const ID: &str = "dtmi:sdv:hmi:status;1"; pub const NAME: &str = "status"; @@ -367,6 +395,20 @@ pub mod hvac { pub type TYPE = bool; } + + #[derive(derivative::Derivative)] + #[derivative(Default)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] + pub struct ENTITY_TYPE { + #[serde(rename = "@context")] + #[derivative(Default(value = "crate::sdv_v1::context()"))] + pub context: Vec, + #[serde(rename = "@id")] + pub instance_id: String, + #[serde(rename = "@type")] + #[derivative(Default(value = "crate::sdv_v1::hvac::ID.to_string()"))] + pub model_id: String, + } } pub mod obd { @@ -380,6 +422,20 @@ pub mod obd { pub type TYPE = i32; } + + #[derive(derivative::Derivative)] + #[derivative(Default)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] + pub struct ENTITY_TYPE { + #[serde(rename = "@context")] + #[derivative(Default(value = "crate::sdv_v1::context()"))] + pub context: Vec, + #[serde(rename = "@id")] + pub instance_id: String, + #[serde(rename = "@type")] + #[derivative(Default(value = "crate::sdv_v1::obd::ID.to_string()"))] + pub model_id: String, + } } pub mod premium_airbag_seat_massager { @@ -389,7 +445,7 @@ pub mod premium_airbag_seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct ENTITY_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -427,7 +483,7 @@ pub mod seat { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct ENTITY_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -449,20 +505,7 @@ pub mod seat_massager { pub const NAME: &str = "sequence_names"; pub const DESCRIPTION: &str = "The name of each of the stored sequences."; - #[derive(derivative::Derivative)] - #[derivative(Default)] - #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { - #[serde(rename = "@context")] - #[derivative(Default(value = "crate::sdv_v1::context()"))] - pub context: Vec, - #[serde(rename = "@type")] - #[derivative(Default( - value = "crate::sdv_v1::seat_massager::sequence_names::ID.to_string()" - ))] - pub model_id: String, - pub value: Vec, - } + pub type TYPE = Vec; } pub mod load_sequence { @@ -478,7 +521,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -499,7 +542,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -526,7 +569,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -546,7 +589,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -573,7 +616,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -593,7 +636,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -620,7 +663,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -640,7 +683,7 @@ pub mod seat_massager { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct PAYLOAD_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, @@ -684,18 +727,8 @@ pub mod vehicle { pub type TYPE = String; } - #[derive(derivative::Derivative)] - #[derivative(Default)] - #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug, Default)] pub struct TYPE { - #[serde(rename = "@context")] - #[derivative(Default(value = "crate::sdv_v1::context()"))] - pub context: Vec, - #[serde(rename = "@type")] - #[derivative(Default( - value = "crate::sdv_v1::vehicle::vehicle_identification::ID.to_string()" - ))] - pub model_id: String, pub vin: crate::sdv_v1::vehicle::vehicle_identification::vin::TYPE, } } @@ -719,7 +752,7 @@ pub mod vehicle { #[derive(derivative::Derivative)] #[derivative(Default)] #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)] - pub struct TYPE { + pub struct ENTITY_TYPE { #[serde(rename = "@context")] #[derivative(Default(value = "crate::sdv_v1::context()"))] pub context: Vec, diff --git a/samples/digital_twin_graph/consumer/src/main.rs b/samples/digital_twin_graph/consumer/src/main.rs index c3078d79..4a0f0d5f 100644 --- a/samples/digital_twin_graph/consumer/src/main.rs +++ b/samples/digital_twin_graph/consumer/src/main.rs @@ -150,7 +150,7 @@ async fn invoke( /// The vehicle instance. async fn find_vehicle( client: DigitalTwinGraphClient, -) -> Result { +) -> Result { // Find all vehicle instances. let find_vehicle_response: FindResponse = find(client, sdv::vehicle::ID.to_string()).await?; if find_vehicle_response.values.is_empty() { @@ -158,7 +158,7 @@ async fn find_vehicle( } // For now, we will just use the first vehicle instance. - let vehicle: sdv::vehicle::TYPE = + let vehicle: sdv::vehicle::ENTITY_TYPE = serde_json::from_str(&find_vehicle_response.values[0]).unwrap(); info!("The vehicle's instance id is: {}", vehicle.instance_id); @@ -175,8 +175,8 @@ async fn find_vehicle( /// The cabin instance. async fn find_cabin( client: DigitalTwinGraphClient, - vehicle: &sdv::vehicle::TYPE, -) -> Result { + vehicle: &sdv::vehicle::ENTITY_TYPE, +) -> Result { // Get the cabin instance id. if vehicle.cabin.is_empty() { return Err("The vehicle does not have a cabin".to_string()); @@ -192,7 +192,7 @@ async fn find_cabin( get(client.clone(), cabin_instance_id.clone(), "".to_string()).await?; // Deserialize the cabin instance. - let cabin: sdv::cabin::TYPE = serde_json::from_str(&get_cabin_response.value).unwrap(); + let cabin: sdv::cabin::ENTITY_TYPE = serde_json::from_str(&get_cabin_response.value).unwrap(); Ok(cabin) } @@ -208,10 +208,10 @@ async fn find_cabin( /// The seat instance. async fn find_seat( client: DigitalTwinGraphClient, - cabin: &sdv::cabin::TYPE, + cabin: &sdv::cabin::ENTITY_TYPE, seat_row: i32, seat_posotion: sdv::cabin::seat::SEAT_POSITION_TYPE, -) -> Result { +) -> Result { if cabin.seat.is_empty() { return Err("The cabin does not have any seats".to_string()); } @@ -226,7 +226,7 @@ async fn find_seat( get(client.clone(), seat_relationship.instance_id.clone(), "".to_string()).await?; // Deserialize the seat instance. - let seat: sdv::seat::TYPE = serde_json::from_str(&get_seat_response.value).unwrap(); + let seat: sdv::seat::ENTITY_TYPE = serde_json::from_str(&get_seat_response.value).unwrap(); info!("The seat's instance id is: {}", seat.instance_id); @@ -246,8 +246,8 @@ async fn find_seat( /// The premium airbag seat massager instance. async fn find_premium_airbag_seat_massager( client: DigitalTwinGraphClient, - seat: &sdv::seat::TYPE, -) -> Result { + seat: &sdv::seat::ENTITY_TYPE, +) -> Result { if seat.seat_massager.is_empty() { return Err("The seat does not have a seat massage".to_string()); } @@ -272,7 +272,7 @@ async fn find_premium_airbag_seat_massager( } // Deserialize the seat massager instance. - let seat_massager: sdv::premium_airbag_seat_massager::TYPE = + let seat_massager: sdv::premium_airbag_seat_massager::ENTITY_TYPE = serde_json::from_str(&get_seat_massager_response.value).unwrap(); info!("The seat massager's instance id is: {}", seat_massager.instance_id); @@ -292,14 +292,14 @@ async fn find_premium_airbag_seat_massager( /// An empty result if the operation is successful. async fn perform_step( client: DigitalTwinGraphClient, - seat_massager: sdv::premium_airbag_seat_massager::TYPE, + seat_massager: sdv::premium_airbag_seat_massager::ENTITY_TYPE, airbag_identifier: i32, inflation_level: i32, inflation_duration_in_seconds: i32, ) -> Result<(), String> { // Generate the perform_step operation's request payload. - let request_payload: sdv::airbag_seat_massager::perform_step::request::TYPE = - sdv::airbag_seat_massager::perform_step::request::TYPE { + let request_payload: sdv::airbag_seat_massager::perform_step::request::PAYLOAD_TYPE = + sdv::airbag_seat_massager::perform_step::request::PAYLOAD_TYPE { step: vec![sdv::airbag_seat_massager::airbag_adjustment::TYPE { airbag_identifier, inflation_level, @@ -337,19 +337,19 @@ async fn interact_with_digital_twin(invehicle_digital_twin_uri: String) -> Resul connect_to_digital_twin_graph_service(invehicle_digital_twin_uri.clone()).await?; // Find the vehicle instance. - let vehicle: sdv::vehicle::TYPE = find_vehicle(client.clone()).await.unwrap(); + let vehicle: sdv::vehicle::ENTITY_TYPE = find_vehicle(client.clone()).await.unwrap(); // Find the cabin instance. - let cabin: sdv::cabin::TYPE = find_cabin(client.clone(), &vehicle).await.unwrap(); + let cabin: sdv::cabin::ENTITY_TYPE = find_cabin(client.clone(), &vehicle).await.unwrap(); // Find the front left seat instance. - let front_left_seat: sdv::seat::TYPE = + let front_left_seat: sdv::seat::ENTITY_TYPE = find_seat(client.clone(), &cabin, 1, sdv::cabin::seat::SEAT_POSITION_TYPE::left) .await .unwrap(); // Find the premium airbag seat massager instance. - let seat_massager: sdv::premium_airbag_seat_massager::TYPE = + let seat_massager: sdv::premium_airbag_seat_massager::ENTITY_TYPE = find_premium_airbag_seat_massager(client.clone(), &front_left_seat).await.unwrap(); // Randomly generate the airbag adjustment field values. diff --git a/samples/digital_twin_graph/seat_massager_provider/src/main.rs b/samples/digital_twin_graph/seat_massager_provider/src/main.rs index f30a6cd9..e3ea6347 100644 --- a/samples/digital_twin_graph/seat_massager_provider/src/main.rs +++ b/samples/digital_twin_graph/seat_massager_provider/src/main.rs @@ -63,53 +63,38 @@ fn create_provider_state() -> ProviderState { // Create the seat massagers. - let front_left_airbag_seat_massager: sdv::premium_airbag_seat_massager::TYPE = - sdv::premium_airbag_seat_massager::TYPE { + let front_left_airbag_seat_massager: sdv::premium_airbag_seat_massager::ENTITY_TYPE = + sdv::premium_airbag_seat_massager::ENTITY_TYPE { instance_id: FRONT_LEFT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), - sequence_names: sdv::seat_massager::sequence_names::TYPE { - value: Vec::::new(), - ..Default::default() - }, + sequence_names: Vec::::new(), ..Default::default() }; - let front_right_airbag_seat_massager: sdv::premium_airbag_seat_massager::TYPE = - sdv::premium_airbag_seat_massager::TYPE { + let front_right_airbag_seat_massager: sdv::premium_airbag_seat_massager::ENTITY_TYPE = + sdv::premium_airbag_seat_massager::ENTITY_TYPE { instance_id: FRONT_RIGHT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), - sequence_names: sdv::seat_massager::sequence_names::TYPE { - value: Vec::::new(), - ..Default::default() - }, + sequence_names: Vec::::new(), ..Default::default() }; - let back_left_airbag_seat_massager: sdv::basic_airbag_seat_massager::TYPE = - sdv::basic_airbag_seat_massager::TYPE { + let back_left_airbag_seat_massager: sdv::basic_airbag_seat_massager::ENTITY_TYPE = + sdv::basic_airbag_seat_massager::ENTITY_TYPE { instance_id: BACK_LEFT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), - sequence_names: sdv::seat_massager::sequence_names::TYPE { - value: Vec::::new(), - ..Default::default() - }, + sequence_names: Vec::::new(), ..Default::default() }; - let back_center_airbag_seat_massager: sdv::basic_airbag_seat_massager::TYPE = - sdv::basic_airbag_seat_massager::TYPE { + let back_center_airbag_seat_massager: sdv::basic_airbag_seat_massager::ENTITY_TYPE = + sdv::basic_airbag_seat_massager::ENTITY_TYPE { instance_id: BACK_CENTER_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), - sequence_names: sdv::seat_massager::sequence_names::TYPE { - value: Vec::::new(), - ..Default::default() - }, + sequence_names: Vec::::new(), ..Default::default() }; - let back_right_airbag_seat_massager: sdv::basic_airbag_seat_massager::TYPE = - sdv::basic_airbag_seat_massager::TYPE { + let back_right_airbag_seat_massager: sdv::basic_airbag_seat_massager::ENTITY_TYPE = + sdv::basic_airbag_seat_massager::ENTITY_TYPE { instance_id: BACK_RIGHT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), - sequence_names: sdv::seat_massager::sequence_names::TYPE { - value: Vec::::new(), - ..Default::default() - }, + sequence_names: Vec::::new(), ..Default::default() }; diff --git a/samples/digital_twin_graph/seat_massager_provider/src/request_impl.rs b/samples/digital_twin_graph/seat_massager_provider/src/request_impl.rs index 71d345a9..024548d0 100644 --- a/samples/digital_twin_graph/seat_massager_provider/src/request_impl.rs +++ b/samples/digital_twin_graph/seat_massager_provider/src/request_impl.rs @@ -216,7 +216,7 @@ impl RequestImpl { targeted_payload.member_path, targeted_payload.instance_id ); - let response = sdv::airbag_seat_massager::perform_step::response::TYPE { + let response = sdv::airbag_seat_massager::perform_step::response::PAYLOAD_TYPE { status: sdv::airbag_seat_massager::status::TYPE { code: 200, message: "The step was performed successfully".to_string(), diff --git a/samples/digital_twin_graph/vehicle_core_provider/src/main.rs b/samples/digital_twin_graph/vehicle_core_provider/src/main.rs index 9b675894..2157e662 100644 --- a/samples/digital_twin_graph/vehicle_core_provider/src/main.rs +++ b/samples/digital_twin_graph/vehicle_core_provider/src/main.rs @@ -64,7 +64,7 @@ fn create_provider_state() -> ProviderState { // Create the seats. let front_left_seat_instance_id = format!("{}", uuid::Uuid::new_v4()); - let front_left_seat: sdv::seat::TYPE = sdv::seat::TYPE { + let front_left_seat: sdv::seat::ENTITY_TYPE = sdv::seat::ENTITY_TYPE { instance_id: front_left_seat_instance_id.clone(), seat_massager: vec![sdv::seat::seat_massager::RELATIONSHIP_TYPE { instance_id: FRONT_LEFT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), @@ -73,7 +73,7 @@ fn create_provider_state() -> ProviderState { }; let front_right_seat_instance_id = format!("{}", uuid::Uuid::new_v4()); - let front_right_seat: sdv::seat::TYPE = sdv::seat::TYPE { + let front_right_seat: sdv::seat::ENTITY_TYPE = sdv::seat::ENTITY_TYPE { instance_id: front_right_seat_instance_id.clone(), seat_massager: vec![sdv::seat::seat_massager::RELATIONSHIP_TYPE { instance_id: FRONT_RIGHT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), @@ -82,7 +82,7 @@ fn create_provider_state() -> ProviderState { }; let back_left_seat_instance_id = format!("{}", uuid::Uuid::new_v4()); - let back_left_seat: sdv::seat::TYPE = sdv::seat::TYPE { + let back_left_seat: sdv::seat::ENTITY_TYPE = sdv::seat::ENTITY_TYPE { instance_id: back_left_seat_instance_id.clone(), seat_massager: vec![sdv::seat::seat_massager::RELATIONSHIP_TYPE { instance_id: BACK_LEFT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), @@ -91,7 +91,7 @@ fn create_provider_state() -> ProviderState { }; let back_center_seat_instance_id = format!("{}", uuid::Uuid::new_v4()); - let back_center_seat: sdv::seat::TYPE = sdv::seat::TYPE { + let back_center_seat: sdv::seat::ENTITY_TYPE = sdv::seat::ENTITY_TYPE { instance_id: back_center_seat_instance_id.clone(), seat_massager: vec![sdv::seat::seat_massager::RELATIONSHIP_TYPE { instance_id: BACK_CENTER_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), @@ -100,7 +100,7 @@ fn create_provider_state() -> ProviderState { }; let back_right_seat_instance_id = format!("{}", uuid::Uuid::new_v4()); - let back_right_seat: sdv::seat::TYPE = sdv::seat::TYPE { + let back_right_seat: sdv::seat::ENTITY_TYPE = sdv::seat::ENTITY_TYPE { instance_id: back_right_seat_instance_id.clone(), seat_massager: vec![sdv::seat::seat_massager::RELATIONSHIP_TYPE { instance_id: BACK_RIGHT_AIRBAG_SEAT_MASSAGER_INSTANCE_ID.to_string(), @@ -110,7 +110,7 @@ fn create_provider_state() -> ProviderState { // Create the cabin. let cabin_instance_id = format!("{}", uuid::Uuid::new_v4()); - let cabin_value: sdv::cabin::TYPE = sdv::cabin::TYPE { + let cabin_value: sdv::cabin::ENTITY_TYPE = sdv::cabin::ENTITY_TYPE { instance_id: cabin_instance_id.clone(), seat: vec![ sdv::cabin::seat::RELATIONSHIP_TYPE { @@ -147,9 +147,8 @@ fn create_provider_state() -> ProviderState { let vehicle_identification: sdv::vehicle::vehicle_identification::TYPE = sdv::vehicle::vehicle_identification::TYPE { vin: "1M8GDM9AXKP042788".to_string(), - ..Default::default() }; - let vehicle_value: sdv::vehicle::TYPE = sdv::vehicle::TYPE { + let vehicle_value: sdv::vehicle::ENTITY_TYPE = sdv::vehicle::ENTITY_TYPE { instance_id: vehicle_instance_id.clone(), vehicle_identification, cabin: vec![sdv::vehicle::cabin::RELATIONSHIP_TYPE { diff --git a/samples/seat_massager/consumer/src/main.rs b/samples/seat_massager/consumer/src/main.rs index 132c9d06..385a58c9 100644 --- a/samples/seat_massager/consumer/src/main.rs +++ b/samples/seat_massager/consumer/src/main.rs @@ -61,8 +61,8 @@ fn start_seat_massage_steps( let inflation_level = rng.gen_range(1..=10); let inflation_duration_in_seconds = rng.gen_range(1..=5); - let request_payload: sdv::airbag_seat_massager::perform_step::request::TYPE = - sdv::airbag_seat_massager::perform_step::request::TYPE { + let request_payload: sdv::airbag_seat_massager::perform_step::request::PAYLOAD_TYPE = + sdv::airbag_seat_massager::perform_step::request::PAYLOAD_TYPE { step: vec![sdv::airbag_seat_massager::airbag_adjustment::TYPE { airbag_identifier, inflation_level, diff --git a/samples/seat_massager/provider/src/request_impl.rs b/samples/seat_massager/provider/src/request_impl.rs index b3c0b43c..147dccd8 100644 --- a/samples/seat_massager/provider/src/request_impl.rs +++ b/samples/seat_massager/provider/src/request_impl.rs @@ -74,7 +74,7 @@ impl Request for RequestImpl { // Extract the request from the request payload. let perform_step_request_opt: Option< - sdv::airbag_seat_massager::perform_step::request::TYPE, + sdv::airbag_seat_massager::perform_step::request::PAYLOAD_TYPE, > = serde_json::from_value(request_payload_json) .expect("Failed to deserialize the request."); if perform_step_request_opt.is_none() { @@ -86,8 +86,8 @@ impl Request for RequestImpl { info!("Performing the step: {:?}", perform_step_request.step); // Prepare the perform_step response payload. - let response_payload: sdv::airbag_seat_massager::perform_step::response::TYPE = - sdv::airbag_seat_massager::perform_step::response::TYPE { + let response_payload: sdv::airbag_seat_massager::perform_step::response::PAYLOAD_TYPE = + sdv::airbag_seat_massager::perform_step::response::PAYLOAD_TYPE { status: sdv::airbag_seat_massager::status::TYPE { code: status::ok::CODE, message: status::ok::MESSAGE.to_string(),