ukhasnet_parser/
packet.rs

1
2/* Store a Location, with latitude, longitude, and optional altitude. */
3#[derive(Debug, PartialEq)]
4pub struct Location {
5    pub latlng: Option<(f32, f32)>,
6    pub alt: Option<f32>,
7}
8
9/* Store a Wind Speed, with optional speed and optional bearing. */
10#[derive(Debug, PartialEq)]
11pub struct WindSpeed {
12    pub speed: Option<f32>,
13    pub bearing: Option<f32>,
14}
15
16/* Store one of any of the data types */
17#[derive(Debug, PartialEq)]
18pub enum DataField {
19    Temperature(Vec<f32>),
20    Voltage(Vec<f32>),
21    Current(Vec<f32>),
22    Humidity(Vec<f32>),
23    Pressure(Vec<f32>),
24    Sun(Vec<f32>),
25    Rssi(Vec<f32>),
26    Count(Vec<f32>),
27    Custom(Vec<f32>),
28    Location(Location),
29    WindSpeed(WindSpeed),
30    Zombie(u8),
31}
32
33/* Store a whole packet */
34#[derive(Debug, PartialEq)]
35pub struct Packet {
36    pub repeat: u8,
37    pub sequence: char,
38    pub data: Vec<DataField>,
39    pub comment: Option<String>,
40    pub path: Vec<String>
41}