pub const RDA_PORT_I16: u16 = 51244;
pub const RDA_PORT_F32: u16 = 51234;
pub const ENVELOPE_LEN: usize = 20;
pub const GUID_START: [u8; 16] = [
0x45, 0x5C, 0xA4, 0xBD, 0xC5, 0x79, 0x4D, 0x08, 0xB3, 0x9E, 0x72, 0xA8, 0x89, 0xDA, 0x1D, 0x8E,
];
pub const GUID_DATA16: [u8; 16] = [
0x7A, 0x3A, 0x56, 0x0D, 0x30, 0x86, 0x4D, 0x2A, 0xA4, 0x14, 0x4A, 0xB9, 0xD5, 0x9A, 0xD5, 0x9F,
];
pub const GUID_DATA32: [u8; 16] = [
0x7A, 0x3A, 0x56, 0x0D, 0x30, 0x86, 0x4D, 0x2A, 0xA4, 0x14, 0x4A, 0xB9, 0xD5, 0x9A, 0xD5, 0xA0,
];
pub const GUID_STOP: [u8; 16] = [
0x49, 0xC0, 0xF5, 0xD1, 0xD6, 0x24, 0x4D, 0x2A, 0x9B, 0x63, 0x28, 0x6E, 0xE0, 0xE6, 0x7A, 0xA0,
];
#[derive(Debug, Clone, PartialEq)]
pub struct Marker {
pub position: u32,
pub points: u32,
pub channel: i32,
pub kind: String,
pub description: String,
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HeaderInfo {
pub channel_count: u32,
pub sampling_interval_us: f64,
pub resolutions_uv: Vec<f64>,
pub channel_names: Vec<String>,
}
impl HeaderInfo {
pub fn sampling_rate_hz(&self) -> f64 {
if self.sampling_interval_us <= 0.0 {
0.0
} else {
1_000_000.0 / self.sampling_interval_us
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct DataBlock {
pub block: u32,
pub points: u32,
pub samples_uv: Vec<f64>,
pub markers: Vec<Marker>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum RdaMessage {
Start(HeaderInfo),
Data16(DataBlock),
Data32(DataBlock),
Stop,
}