use bitflags::bitflags;
#[cfg(feature = "serde")]
use super::SerializeUbxPacketFields;
#[cfg(feature = "serde")]
use crate::serde::ser::SerializeMap;
use crate::{error::ParserError, UbxPacketMeta};
use ublox_derive::{ubx_extend_bitflags, ubx_packet_recv};
#[ubx_packet_recv]
#[ubx(class = 0x28, id = 0x02, fixed_payload_len = 36)]
struct HnrIns {
#[ubx(map_type = HnrInsBitFlags)]
bitfield: u32,
reserved: [u8; 4],
itow: u32,
#[ubx(map_type = f64, scale = 1e-3, alias = x_angular_rate)]
x_ang_rate: i32,
#[ubx(map_type = f64, scale = 1e-3, alias = y_angular_rate)]
y_ang_rate: i32,
#[ubx(map_type = f64, scale = 1e-3, alias = z_angular_rate)]
z_ang_rate: i32,
#[ubx(map_type = f64, scale = 1e-2, alias = x_acceleration)]
x_accel: i32,
#[ubx(map_type = f64, scale = 1e-2, alias = y_acceleration)]
y_accel: i32,
#[ubx(map_type = f64, scale = 1e-2, alias = z_acceleration)]
z_accel: i32,
}
#[ubx_extend_bitflags]
#[ubx(from, rest_reserved)]
bitflags! {
#[derive(Debug)]
pub struct HnrInsBitFlags: u32 {
const VERSION = 1;
const X_ANG_RATE_VALID = 0x100;
const Y_ANG_RATE_VALID = 0x200;
const Z_ANG_RATE_VALID = 0x400;
const X_ACCEL_VALID = 0x800;
const Y_ACCEL_VALID = 0x1000;
const Z_ACCEL_VALID = 0x2000;
}
}