package ublox type Message interface { ClassID() uint16 } //type UbxMessage interface { // Timestamp() (time.Time, error) // Position() ([3]float64, error) // Orientation() ([3]float64, error) //} type RawMessage struct { classID uint16 Data []byte } func (msg *RawMessage) ClassID() uint16 { return msg.classID } type NavPvt struct { ITOW_ms uint32 // - GPS time of week of the navigation epoch. See the description of iTOW for details. Year_y uint16 // - Year (UTC) Month_month byte // - Month, range 1..12 (UTC) Day_d byte // - Day of month, range 1..31 (UTC) Hour_h byte // - Hour of day, range 0..23 (UTC) Min_min byte // - Minute of hour, range 0..59 (UTC) Sec_s byte // - Seconds of minute, range 0..60 (UTC) Valid NavPVTValid // - Validity flags (see graphic below) TAcc_ns uint32 // - Time accuracy estimate (UTC) Nano_ns int32 // - Fraction of second, range -1e9 .. 1e9 (UTC) FixType NavPVTFixType // - GNSSfix Type Flags NavPVTFlags // - Fix status flags (see graphic below) Flags2 NavPVTFlags2 // - Additional flags (see graphic below) NumSV byte // - Number of satellites used in Nav Solution Lon_dege7 int32 // 1e-7 Longitude Lat_dege7 int32 // 1e-7 Latitude Height_mm int32 // - Height above ellipsoid HMSL_mm int32 // - Height above mean sea level HAcc_mm uint32 // - Horizontal accuracy estimate VAcc_mm uint32 // - Vertical accuracy estimate VelN_mm_s int32 // - NED north velocity VelE_mm_s int32 // - NED east velocity VelD_mm_s int32 // - NED down velocity GSpeed_mm_s int32 // - Ground Speed (2-D) HeadMot_dege5 int32 // 1e-5 Heading of motion (2-D) SAcc_mm_s uint32 // - Speed accuracy estimate HeadAcc_dege5 uint32 // 1e-5 Heading accuracy estimate (both motion and vehicle) PDOPe2 uint16 // 0.01 Position DOP Flags3 NavPVTFlags3 // - Additional flags (see graphic below) Reserved1 [5]byte // - Reserved HeadVeh_dege5 int32 // 1e-5 Heading of vehicle (2-D), this is only valid when headVehValid is set, otherwise the output is set to the heading of motion MagDec_dege2 int16 // 1e-2 Magnetic declination. Only supported in ADR 4.10 and later. MagAcc_deg2e uint16 // 1e-2 Magnetic declination accuracy. Only supported in ADR 4.10 and later. } func (NavPvt) ClassID() uint16 { return 0x0701 } type HnrPvt struct { ITOW_ms uint32 // - GPS time of week of the navigation epoch. See the description of iTOW for details. Year_y uint16 // - Year (UTC) Month_month byte // - Month, range 1..12 (UTC) Day_d byte // - Day of month, range 1..31 (UTC) Hour_h byte // - Hour of day, range 0..23 (UTC) Min_min byte // - Minute of hour, range 0..59 (UTC) Sec_s byte // - Seconds of minute, range 0..60 (UTC) Valid byte // - Validity flags (see graphic below) Nano_ns int32 // - Fraction of second, range -1e9 .. 1e9 (UTC) FixType byte // - GNSSfix Type Flags byte // - Fix status flags (see graphic below) Reserved [2]byte Lon_dege7 int32 // 1e-7 Longitude Lat_dege7 int32 // 1e-7 Latitude Height_mm int32 // - Height above ellipsoid HMSL_mm int32 // - Height above mean sea level GSpeed_mm_s int32 // - Ground Speed (2-D) Speed_mm_s int32 // Speed (3-D) HeadMot_dege5 int32 // 1e-5 Heading of motion (2-D) HeadVeh_dege5 int32 // 1e-5 Heading of vehicle (2-D), this is only valid when headVehValid is set, otherwise the output is set to the heading of motion HAcc uint32 // 1e-5 Heading accuracy estimate (both motion and vehicle) VAcc uint32 // 1e-5 Heading accuracy estimate (both motion and vehicle) SAcc uint32 // 1e-5 Heading accuracy estimate (both motion and vehicle) HeadAcc_dege5 uint32 // 1e-5 Heading accuracy estimate (both motion and vehicle) Reserved1 [4]byte // - Reserved } func (HnrPvt) ClassID() uint16 { return 0x0028 } type NavAtt struct { ITOW_ms uint32 // - GPS time of week of the navigation epoch. See the description of iTOW for details. Version byte Reserved1 [3]byte Roll_deg int32 Pitch_deg int32 Heading_deg int32 AccRoll_deg uint32 AccPitch_deg uint32 AccHeading_deg uint32 } func (NavAtt) ClassID() uint16 { return 0x0501 } //go:generate stringer -output=strings_navpvt.go -trimprefix NavPVT -type=NavPVTFixType,NavPVTValid,NavPVTFlags,NavPVTFlags2,NavPVTFlags3 type NavPVTFixType byte const ( NavPVTNoFix NavPVTFixType = iota NavPVTDeadReckoning NavPVTFix2D NavPVTFix3D NavPVTGNSS NavPVTTimeOnly ) type NavPVTValid byte const ( NavPVTValidDate NavPVTValid = (1 << iota) // valid UTC Date (see Time Validity section for details) NavPVTValidTime // valid UTC time of day (see Time Validity section for details) NavPVTFullyResolved // UTC time of day has been fully resolved (no seconds uncertainty). Cannot be used to check if time is completely solved. NavPVTValidMag // valid magnetic declination ) type NavPVTFlags byte const ( NavPVTGnssFixOK NavPVTFlags = 1 << 0 // valid fix (i.e within DOP & accuracy masks) NavPVTDiffSoln NavPVTFlags = 1 << 1 // differential corrections were applied NavPVTHeadVehValid NavPVTFlags = 1 << 5 // heading of vehicle is valid, only set if the receiver is in sensor fusion mode NavPVTCarrSolnFloat NavPVTFlags = 1 << 6 // carrier phase range solution with floating ambiguities NavPVTCarrSolnFixed NavPVTFlags = 1 << 7 // carrier phase range solution with fixed ambiguities ) type NavPVTFlags2 byte const ( NavPVTConfirmedAvai NavPVTFlags2 = 1 << 5 // information about UTC Date and Time of Day validity confirmation is available (see Time Validity section for details) NavPVTConfirmedDate NavPVTFlags2 = 1 << 6 // UTC Date validity could be confirmed (see Time Validity section for details) NavPVTConfirmedTime NavPVTFlags2 = 1 << 7 // UTC Time of Day could be confirmed (see Time Validity section for details) ) type NavPVTFlags3 byte const ( NavPVTInvalidLlh NavPVTFlags3 = (1 << iota) // 1 = Invalid lon, lat, height and hMSL )