#[cfg(feature = "serde")]
use super::SerializeUbxPacketFields;
#[cfg(feature = "serde")]
use crate::serde::ser::SerializeMap;
use crate::ubx_packets::types::{PositionLLA, ToLLA};
use crate::{error::ParserError, UbxPacketMeta};
use ublox_derive::ubx_packet_recv;
#[ubx_packet_recv]
#[ubx(class = 1, id = 2, fixed_payload_len = 28)]
struct NavPosLlh {
itow: u32,
#[ubx(map_type = f64, scale = 1e-7, alias = lon_degrees)]
lon: i32,
#[ubx(map_type = f64, scale = 1e-7, alias = lat_degrees)]
lat: i32,
#[ubx(map_type = f64, scale = 1e-3)]
height_meters: i32,
#[ubx(map_type = f64, scale = 1e-3)]
height_msl: i32,
#[ubx(map_type = f64, scale = 1e-3)]
h_ack: u32,
#[ubx(map_type = f64, scale = 1e-3)]
v_acc: u32,
}
macro_rules! impl_to_lla {
($type:ty) => {
impl ToLLA for $type {
fn to_lla(&self) -> PositionLLA {
PositionLLA {
lon: self.lon_degrees(),
lat: self.lat_degrees(),
alt: self.height_msl(),
}
}
}
};
}
impl_to_lla!(NavPosLlhRef<'_>);
impl_to_lla!(NavPosLlhOwned);