56 lines
1.9 KiB
Rust
56 lines
1.9 KiB
Rust
//! C-ITS CAM Evaluation
|
|
|
|
use c_its_parser::standards::cam_1_4_1::cam_pdu_descriptions::{self, HighFrequencyContainer};
|
|
use log::info;
|
|
|
|
pub fn handle_cam(etsi: &cam_pdu_descriptions::CAM) {
|
|
// only POC output
|
|
match &etsi.cam.cam_parameters.high_frequency_container {
|
|
HighFrequencyContainer::basicVehicleContainerHighFrequency(obu) => {
|
|
info!(
|
|
"Got CAM from {} at {:.3}°N, {:.3}°E, speed {:.2} km/h",
|
|
etsi.header.station_id.0,
|
|
etsi.cam
|
|
.cam_parameters
|
|
.basic_container
|
|
.reference_position
|
|
.latitude
|
|
.as_deg(),
|
|
etsi.cam
|
|
.cam_parameters
|
|
.basic_container
|
|
.reference_position
|
|
.longitude
|
|
.as_deg(),
|
|
obu.speed.speed_value.as_kmh()
|
|
);
|
|
}
|
|
HighFrequencyContainer::rsuContainerHighFrequency(rsu) => {
|
|
info!(
|
|
"Got RSU from {} at {:.3}°N, {:.3}°E, {} protected zones",
|
|
etsi.header.station_id.0,
|
|
etsi.cam
|
|
.cam_parameters
|
|
.basic_container
|
|
.reference_position
|
|
.latitude
|
|
.as_deg(),
|
|
etsi.cam
|
|
.cam_parameters
|
|
.basic_container
|
|
.reference_position
|
|
.longitude
|
|
.as_deg(),
|
|
rsu.protected_communication_zones_rsu
|
|
.as_ref()
|
|
.map(|d| d.0.len())
|
|
.unwrap_or_default()
|
|
);
|
|
}
|
|
|
|
_ => {
|
|
// enum is non-exhaustive, so we need a default case
|
|
// but this should never be reached in pactical applications
|
|
}
|
|
}
|
|
}
|