1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use bitflags::bitflags;
#[cfg(feature = "serde")]
use super::SerializeUbxPacketFields;
#[cfg(feature = "serde")]
use crate::serde::ser::SerializeMap;
use crate::{error::ParserError, UbxPacketMeta};
use ublox_derive::{ubx_extend_bitflags, ubx_packet_recv};
/// GPS time solution
#[ubx_packet_recv]
#[ubx(class = 1, id = 0x20, fixed_payload_len = 16)]
struct NavTimeGps {
/// GPS time of week of the navigation epoch (ms).
itow: u32,
/// Fractional part of iTOW (range: +/- 500000) (ns).
ftow: i32,
/// GPS week number of the navigation epoch.
week: i16,
/// GPS leap seconds (GPS-UTC) (s).
leap_s: i8,
/// Validity Flags.
#[ubx(map_type = NavTimeGpsFlags)]
valid: u8,
/// Time Accuracy Estimate (ns).
t_acc: u32,
}
#[ubx_extend_bitflags]
#[ubx(from, rest_reserved)]
bitflags! {
/// Validity flags of `NavTimeGps`
#[derive(Default, Debug)]
pub struct NavTimeGpsFlags: u8 {
/// Valid GPS time of week (itow + ftow).
const VALID_TOW = 1;
/// Valid GPS week number.
const VALID_WKN = 2;
/// Valid GPS leap seconds.
const VALID_LEAP_S = 4;
}
}