use bitflags::bitflags;
#[cfg(feature = "serde")]
use serde::Serialize;
#[derive(Default, Debug, Clone, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct GpsQzssl1l2l5Health(pub(crate) u32);
impl From<u32> for GpsQzssl1l2l5Health {
fn from(value: u32) -> Self {
Self(value)
}
}
impl Into<u32> for GpsQzssl1l2l5Health {
fn into(self) -> u32 {
self.0
}
}
impl GpsQzssl1l2l5Health {
pub fn healthy(&self) -> bool {
self.0 == 0
}
pub fn l1_unhealthy(&self) -> bool {
self.0 & 0x00000001 > 0
}
pub fn l2_unhealthy(&self) -> bool {
self.0 & 0x00000002 > 0
}
pub fn l5_unhealthy(&self) -> bool {
self.0 & 0x00000004 > 0
}
}
bitflags! {
#[derive(Default, Debug, Clone)]
#[derive(PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct GpsQzssl1cHealth : u32 {
const UNHEALTHY = 0x00000001;
}
}