Implement UART I/O protocol
This commit is contained in:
parent
ba71e718df
commit
4d7bef58a1
11 changed files with 610 additions and 36 deletions
|
|
@ -300,20 +300,23 @@ impl crate::v2x_tx::GnItsPayload for CamState {
|
|||
own_position: &crate::applogic::PositionState,
|
||||
time: chrono::DateTime<chrono::Utc>,
|
||||
_seq_no: &mut u16,
|
||||
) -> (
|
||||
geonetworking::en302636_4_1::ExtendedHeader,
|
||||
Option<geonetworking::en302636_4_1::AreaType>,
|
||||
u8,
|
||||
) {
|
||||
) -> Result<
|
||||
(
|
||||
geonetworking::en302636_4_1::ExtendedHeader,
|
||||
Option<geonetworking::en302636_4_1::AreaType>,
|
||||
u8,
|
||||
),
|
||||
alloc::string::String,
|
||||
> {
|
||||
let station_type = geonetworking::en302636_4_1::StationType::try_from(self.station_type.0)
|
||||
.unwrap_or_default();
|
||||
|
||||
// CAM always uses SHB, hop-limit 1
|
||||
(
|
||||
Ok((
|
||||
crate::v2x_tx::gn::make_shb_eh(address, station_type, own_position, time),
|
||||
None,
|
||||
1,
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
fn make_payload(
|
||||
|
|
|
|||
|
|
@ -639,6 +639,11 @@ impl State {
|
|||
pub fn time(&self) -> chrono::prelude::NaiveDateTime {
|
||||
self.time
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn pos(&self) -> &PositionState {
|
||||
&self.pos
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue