use crate::messages::primitive_aliases::Code2;
use std::fmt::Debug;
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct DataTransmissionEnabled(Code2);
impl DataTransmissionEnabled {
pub(crate) fn new(value: Code2) -> Self {
Self(value)
}
pub fn none(&self) -> bool {
self.0 & 0b0001 != 0
}
pub fn reflectivity(&self) -> bool {
self.0 & 0b0010 != 0
}
pub fn velocity(&self) -> bool {
self.0 & 0b0100 != 0
}
pub fn spectrum_width(&self) -> bool {
self.0 & 0b1000 != 0
}
}
impl Debug for DataTransmissionEnabled {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("DataTransmissionEnabled")
.field("none", &self.none())
.field("reflectivity", &self.reflectivity())
.field("velocity", &self.velocity())
.field("spectrum_width", &self.spectrum_width())
.finish()
}
}