Documentation
¶
Overview ¶
Package ubx decodes the u-blox UBX binary protocol — the native binary message format that u-blox GNSS receivers speak as the compact alternative to NMEA 0183 text. It is the binary counterpart to internal/nmea (gps_nmea_decode): a GPS / GNSS capture from a u-blox module (the dominant GNSS chip family — NEO-6/7/8/9, the modules in countless wardriving / drone / tracker rigs) may be UBX rather than NMEA, and UBX is undecodable as text.
Wrap-vs-native judgement ¶
Native. The UBX framing is a fixed, fully-public wire format (two sync bytes 0xB5 0x62, a class + id, a little-endian length, the payload, and an 8-bit Fletcher checksum) and the NAV-PVT payload is a fixed 92-byte little-endian struct documented in every u-blox receiver protocol spec. It is byte- field extraction plus a two-byte checksum loop — a Go port is a few hundred lines, so a runtime dependency on a UBX library would not be justified. stdlib only, no new go.mod dep.
What this package covers ¶
- UBX frame envelope: the 0xB5 0x62 sync, message class + id (named for the common NAV classes), little-endian length, and the 8-bit Fletcher checksum (CK_A / CK_B over class + id + length + payload), validated. A capture with several back-to-back frames decodes to a list; leading non-sync bytes are skipped so a mid-stream capture still parses.
- NAV-PVT (class 0x01 id 0x07) — the flagship "navigation position velocity time" message that bundles a complete fix into one record: iTOW, the UTC date/time with its validity flags and time accuracy, fix type (no-fix / dead- reckoning / 2D / 3D / GNSS+DR / time-only) and the gnssFixOK flag, satellites used, longitude / latitude (1e-7 deg), height above ellipsoid and above mean sea level, horizontal / vertical accuracy, the NED velocity vector, ground speed, heading of motion, and position DOP. Raw integer units (mm, mm/s, deg x 1e-7, deg x 1e-5, 0.01 DOP) are converted to metres / m·s⁻¹ / degrees.
- NAV-SAT (class 0x01 id 0x35) — per-satellite signal info: for each tracked SV the constellation (gnssId → GPS / SBAS / Galileo / BeiDou / QZSS / GLONASS / NavIC), the satellite id, carrier-to-noise C/N0, elevation / azimuth, pseudorange residual, the signal-quality indicator, whether the SV is used in the solution, and its health. Anomalous per-satellite C/N0 or geometry is a primary tell of GPS spoofing / jamming, so this is the UBX counterpart to the NMEA GSV decode.
- NAV-STATUS (class 0x01 id 0x03) — fix type + status flags (gpsFixOK, differential solution, week-number / time-of- week valid) + time-to-first-fix + receiver uptime.
What this package does NOT cover (deliberately out of scope) ¶
- Other UBX messages (NAV-POSLLH, NAV-VELNED, NAV-TIMEUTC, RXM-*, CFG-*, MON-*, etc.) — the frame envelope is decoded and the class/id named, but the body is surfaced as a raw hex payload rather than guessed. The messages that carry a full fix / satellite picture (NAV-PVT, NAV-SAT, NAV-STATUS) are bodied out; the others can land in a future change against a reference vector.
- UBX message *encoding* / polling (sending CFG-* to a live receiver) — this is an offline read-only decoder.
- The RTCM / SPARTN correction streams a u-blox module can also emit — separate protocols.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
ClassID int `json:"class"`
ClassHex string `json:"class_hex"`
MessageID int `json:"id"`
IDHex string `json:"id_hex"`
Name string `json:"name"`
Length int `json:"payload_length"`
ChecksumOK bool `json:"checksum_ok"`
PayloadHex string `json:"payload_hex,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Message is one decoded UBX frame.
type NavPVT ¶
type NavPVT struct {
}
NavPVT is the decoded NAV-PVT (Navigation Position Velocity Time) payload — a complete GNSS fix in a single message.
type NavSAT ¶ added in v0.546.0
type NavSAT struct {
}
NavSAT is the decoded NAV-SAT (satellite information) payload — per-satellite signal strength, elevation/azimuth, pseudorange residual and the quality / used / health flags. Anomalous per-satellite C/N0 or geometry is a primary tell of GPS spoofing / jamming, so this is the UBX counterpart to the NMEA GSV decode.
type NavSatInfo ¶ added in v0.546.0
type NavSatInfo struct {
}
NavSatInfo is one satellite row of a NAV-SAT message.