use bitflags::bitflags;
#[cfg(feature = "serde")]
use super::SerializeUbxPacketFields;
#[cfg(feature = "serde")]
use crate::serde::ser::SerializeMap;
use crate::{error::ParserError, GnssFixType, UbxPacketMeta};
use ublox_derive::{ubx_extend_bitflags, ubx_packet_recv};
#[ubx_packet_recv]
#[ubx(class = 1, id = 6, fixed_payload_len = 52)]
struct NavSol {
itow: u32,
ftow_ns: i32,
week: i16,
#[ubx(map_type = GnssFixType)]
fix_type: u8,
#[ubx(map_type = NavSolFlags)]
flags: u8,
#[ubx(map_type = f64, scale = 1e-2)]
ecef_x: i32,
#[ubx(map_type = f64, scale = 1e-2)]
ecef_y: i32,
#[ubx(map_type = f64, scale = 1e-2)]
ecef_z: i32,
#[ubx(map_type = f64, scale = 1e-2)]
position_accuracy_estimate: u32,
#[ubx(map_type = f64, scale = 1e-2)]
ecef_vx: i32,
#[ubx(map_type = f64, scale = 1e-2)]
ecef_vy: i32,
#[ubx(map_type = f64, scale = 1e-2)]
ecef_vz: i32,
#[ubx(map_type = f64, scale = 1e-2)]
speed_accuracy_estimate: u32,
#[ubx(map_type = f32, scale = 1e-2)]
pdop: u16,
reserved1: u8,
num_sv: u8,
reserved2: [u8; 4],
}
#[ubx_extend_bitflags]
#[ubx(from, rest_reserved)]
bitflags! {
#[derive(Debug)]
pub struct NavSolFlags: u8 {
const GPS_FIX_OK = 1;
const DIFF_SOLN = 2;
const WKN_SET = 4;
const TOW_SET = 8;
}
}