From 935b6e155a0bc7acd9c1c08166b0fe96de2e8719 Mon Sep 17 00:00:00 2001 From: Nicolas Buffon Date: Mon, 4 Nov 2024 11:57:52 +0100 Subject: [PATCH] WIP Signed-off-by: Nicolas Buffon --- rust/src/client/application.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rust/src/client/application.rs b/rust/src/client/application.rs index e54e1c8a..92ea8e2a 100644 --- a/rust/src/client/application.rs +++ b/rust/src/client/application.rs @@ -18,6 +18,8 @@ use crate::exchange::etsi::decentralized_environmental_notification_message::{ }; use crate::exchange::etsi::reference_position::ReferencePosition; use crate::exchange::etsi::{etsi_now, heading_to_etsi, speed_to_etsi, timestamp_to_etsi}; +use crate::exchange::etsi::collective_perception_message::{CollectivePerceptionMessage, ManagementContainer}; +use crate::exchange::etsi::perceived_object::PerceivedObject; use crate::exchange::sequence_number::SequenceNumber; use crate::exchange::PathElement; use crate::mobility::mobile::Mobile; @@ -58,6 +60,26 @@ pub fn create_cam( } } +pub fn create_cpm( + station_id: u32, + station_type: u8, + position: Position, + object_list: &[&dyn Mobile] +) -> CollectivePerceptionMessage { + let perceived_object_list: Vec = Vec::new(); + + CollectivePerceptionMessage { + station_id, + management_container: ManagementContainer { + station_type, + reference_position: ReferencePosition::from(position), + ..Default::default() + }, + perceived_object_container: perceived_object_list, + ..Default::default() + } +} + // FIXME use custom errors pub fn create_denm( detection_time: u64,