binex/message/record/ephemeris/
fid.rs

1//! Ephemeris Field ID
2
3/// [FieldID] describes the content to follow in Ephemeris frames
4#[derive(Debug, Clone, Copy, PartialEq)]
5pub enum FieldID {
6    /// Raw (non decoded) GPS Ephemeris message.
7    /// Streamed as is: it did not go through the decoding process.
8    ///   * uint1
9    ///   * sint4 ToW in seconds
10    ///   * 72 bytes: GPS ephemeris subframe
11    GPSRaw = 0,
12    /// Decoded GPS Ephemeris
13    GPS = 1,
14    /// Decoded GLO Ephemeris
15    GLO = 2,
16    /// Decoded SBAS Ephemeris
17    SBAS = 3,
18    /// Decoded GAL Ephemeris
19    GAL = 4,
20    /// Unknown / Invalid
21    Unknown = 0xffffffff,
22}
23
24impl From<u32> for FieldID {
25    fn from(val: u32) -> Self {
26        match val {
27            0 => Self::GPSRaw,
28            1 => Self::GPS,
29            2 => Self::GLO,
30            3 => Self::SBAS,
31            4 => Self::GAL,
32            _ => Self::Unknown,
33        }
34    }
35}
36
37impl From<FieldID> for u32 {
38    fn from(val: FieldID) -> u32 {
39        match val {
40            FieldID::GPSRaw => 0,
41            FieldID::GPS => 1,
42            FieldID::GLO => 2,
43            FieldID::SBAS => 3,
44            FieldID::GAL => 4,
45            FieldID::Unknown => 0xffffffff,
46        }
47    }
48}