Expand description
RTCM 3 differential-GNSS stream decoding and encoding.
RTCM 10403.x (“RTCM Standard for Differential GNSS Services, Version 3”) is the dominant wire format for real-time GNSS correction and observation streams: base-station observations, reference coordinates, antenna metadata, and broadcast ephemerides flow from a caster to a rover as a sequence of framed binary messages. This module is a sans-I/O codec for that stream, built to the same shape as the crate’s RINEX / SP3 / IONEX parsers:
- a forgiving byte-level frame layer ([
framing]) that syncs on the0xD3preamble, reads the 10-bit length, and verifies the 24-bit CRC-24Q; - a format-agnostic canonical IR (
Messageand its typed variants) that stores each field as its raw transmitted integer; and - an encoder that turns the IR back into bytes, so a decode followed by an encode round-trips byte-for-byte.
§Message coverage
Decoded and encoded:
| Message | Numbers | IR type |
|---|---|---|
| MSM4 observations | 1074 / 1084 / 1094 / 1104 / 1114 / 1124 / 1134 | MsmMessage |
| MSM7 observations | 1077 / 1087 / 1097 / 1107 / 1117 / 1127 / 1137 | MsmMessage |
| Station coordinates | 1005 / 1006 | StationCoordinates |
| Antenna / receiver | 1007 / 1008 / 1033 | AntennaDescriptor |
| GPS ephemeris | 1019 | GpsEphemeris |
| GLONASS ephemeris | 1020 | GlonassEphemeris |
Any other message number is preserved losslessly as Message::Unsupported
(its raw body is kept so the frame still round-trips). Deferred message types
include the other MSM variants (MSM1/2/3/5/6), the legacy L1/L1-L2
observation messages (1001-1004, 1009-1012), the network-RTK and SSR
correction families, and the Galileo / BeiDou / QZSS ephemerides
(1042-1046). They decode as Unsupported rather than erroring.
§Quick start
use sidereon_core::rtcm::{self, Message, StationCoordinates};
// Build a 1006 reference-coordinate message and frame it.
let station = StationCoordinates {
message_number: 1006,
reference_station_id: 2003,
itrf_realization_year: 0,
gps_indicator: true,
glonass_indicator: true,
galileo_indicator: false,
reference_station_indicator: false,
ecef_x: 11_446_021_400,
single_receiver_oscillator: false,
reserved: false,
ecef_y: -7_415_136_500,
quarter_cycle_indicator: 0,
ecef_z: 12_602_528_900,
antenna_height: Some(15_000),
};
// A constructed message encodes either directly on the typed value or
// through the [`Message`] wrapper; both produce the same body bytes.
let body = station.encode();
assert_eq!(body, Message::StationCoordinates(station).encode());
let frame = rtcm::encode_frame(&body).unwrap();
// Decode it back out of the framed stream.
let decoded = rtcm::decode_messages(&frame);
assert_eq!(decoded.len(), 1);
match &decoded[0] {
Message::StationCoordinates(s) => assert_eq!(s.reference_station_id, 2003),
_ => panic!("expected station coordinates"),
}Structs§
- Antenna
Descriptor - A decoded antenna / receiver descriptor message (1007, 1008, or 1033).
- CellLli
- Derived RINEX LLI for one MSM signal cell.
- Decoded
Frame - A single decoded frame: the borrowed message body plus the full frame size.
- Frame
Scanner - A forgiving iterator that yields every CRC-valid frame in a byte buffer.
- Frame
Skip - One CRC-valid frame that could not be decoded.
- Glonass
Ephemeris - A decoded GLONASS broadcast ephemeris (message 1020).
- GpsEphemeris
- A decoded GPS broadcast ephemeris (message 1019).
- Lock
Time Tracker - Tracks per-signal MSM lock history and derives RINEX LLI values.
- MsmHeader
- The MSM message header, common to every MSM type (RTCM 10403.3 Table 3.5-78).
- MsmMessage
- A decoded MSM4 or MSM7 observation message.
- MsmSatellite
- Per-satellite data for one MSM satellite.
- MsmSignal
- Per-cell signal data for one active (satellite, signal) pair.
- Previous
Lock - The tracked previous observation of one RTCM MSM signal cell.
- Rtcm
Stream - A decoded RTCM byte stream plus diagnostics for skipped frames.
- SsrClock
Record - One satellite clock-correction record.
- SsrCode
Bias Record - One satellite code-bias record.
- SsrHeader
- Common header for RTCM SSR messages.
- SsrMessage
- A decoded RTCM SSR message body.
- SsrOrbit
Record - One satellite orbit-correction record.
- SsrPhase
Bias Record - One satellite phase-bias record.
- SsrPhase
Bias Signal - One signal in a phase-bias record.
- SsrStream
Assembler - Owns an RTCM carry buffer for chunked stream decoding.
- Station
Coordinates - A decoded message 1005 or 1006 antenna reference point.
- Stream
Diagnostics - Diagnostics collected while scanning an RTCM byte stream.
- Unsupported
Message - A message whose number is recognized but whose body this codec does not decode. The raw body is preserved so the frame still round-trips.
Enums§
- Frame
Skip Reason - Typed reason for a skipped CRC-valid frame.
- Message
- The canonical, format-agnostic RTCM 3 message IR.
- MsmKind
- Which MSM variant a message is.
- SsrKind
- The SSR message group derived from the message number.
Constants§
- FRAME_
OVERHEAD - Overhead a frame adds around its body: 3 header bytes plus 3 CRC bytes.
- LLI_
HALF_ CYCLE - RINEX LLI bit 1: half-cycle ambiguity or half-cycle slip is possible.
- LLI_
LOSS_ OF_ LOCK - RINEX LLI bit 0: loss of lock, so a cycle slip is possible.
- MAX_
BODY_ LEN - Maximum message-body length, in bytes (the length field is 10 bits).
- PREAMBLE
- The RTCM 3 frame preamble byte.
Functions§
- decode_
frame - Decode the single frame that begins at the start of
bytes. - decode_
messages - Decode every CRC-valid frame in a byte buffer into the message IR.
- decode_
stream - Decode every CRC-valid frame while recording forgiving stream diagnostics.
- derive_
lli - Derive the RINEX LLI digit for one signal cell.
- encode_
frame - Wrap a message body in an RTCM 3 transport frame with a fresh CRC-24Q.
- message_
number - Read the 12-bit RTCM message number from the start of a message body.
- minimum_
lock_ time_ ms - Minimum continuous-lock time encoded by an MSM lock-time indicator.
- msm_
epoch_ dt_ ms - Elapsed milliseconds between two raw MSM epoch-time fields of one system.
- msm_
signal_ rinex_ code - RINEX 3 observation-code suffix for an MSM signal-mask id.