binex/message/
mid.rs

1//! Message ID from and to binary
2
3/// MessageID stands for Record ID byte
4/// and follows the Sync Byte
5#[derive(Debug, Copy, Clone, Default, PartialEq)]
6pub enum MessageID {
7    /// Geodetic Marker, Site and Refenrece point info:
8    /// Geodetic metadata
9    SiteMonumentMarker = 0,
10    /// Decode Ephemeris frame
11    Ephemeris = 1,
12    /// Observation, time tag and receiver info
13    Observation = 2,
14    /// Local Meteorological and Geophysical information
15    Meteo = 3,
16    /// Receiver info: BINEX specific
17    ReceiverInfo = 4,
18    /// Processed Solutions like PVT
19    ProcessedSolutions = 5,
20    // Receiver info prototype: BINEX specific
21    ReceiverInfoPrototype = 125,
22    /// Meteo prototype: BINEX specific
23    MeteoPrototype = 126,
24    /// Observation, time tag and receiver info prototype
25    ObservationPrototype = 127,
26    // Unknown / unsupported message
27    #[default]
28    Unknown = 0xffffffff,
29}
30
31impl From<u32> for MessageID {
32    fn from(val: u32) -> Self {
33        match val {
34            0 => Self::SiteMonumentMarker,
35            1 => Self::Ephemeris,
36            2 => Self::Observation,
37            3 => Self::Meteo,
38            4 => Self::ReceiverInfo,
39            5 => Self::ProcessedSolutions,
40            125 => Self::ReceiverInfoPrototype,
41            126 => Self::MeteoPrototype,
42            127 => Self::ObservationPrototype,
43            _ => Self::Unknown,
44        }
45    }
46}
47
48impl From<MessageID> for u32 {
49    fn from(val: MessageID) -> u32 {
50        match val {
51            MessageID::SiteMonumentMarker => 0,
52            MessageID::Ephemeris => 1,
53            MessageID::Observation => 2,
54            MessageID::Meteo => 3,
55            MessageID::ReceiverInfo => 4,
56            MessageID::ProcessedSolutions => 5,
57            MessageID::ReceiverInfoPrototype => 125,
58            MessageID::MeteoPrototype => 126,
59            MessageID::ObservationPrototype => 127,
60            _ => 0xff,
61        }
62    }
63}