Skip to main content

Module rtcm

Module rtcm 

Source
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:

  1. a forgiving byte-level frame layer ([framing]) that syncs on the 0xD3 preamble, reads the 10-bit length, and verifies the 24-bit CRC-24Q;
  2. a format-agnostic canonical IR (Message and its typed variants) that stores each field as its raw transmitted integer; and
  3. 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:

MessageNumbersIR type
MSM4 observations1074 / 1084 / 1094 / 1104 / 1114 / 1124 / 1134MsmMessage
MSM7 observations1077 / 1087 / 1097 / 1107 / 1117 / 1127 / 1137MsmMessage
Station coordinates1005 / 1006StationCoordinates
Antenna / receiver1007 / 1008 / 1033AntennaDescriptor
GPS ephemeris1019GpsEphemeris
GLONASS ephemeris1020GlonassEphemeris

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§

AntennaDescriptor
A decoded antenna / receiver descriptor message (1007, 1008, or 1033).
CellLli
Derived RINEX LLI for one MSM signal cell.
DecodedFrame
A single decoded frame: the borrowed message body plus the full frame size.
FrameScanner
A forgiving iterator that yields every CRC-valid frame in a byte buffer.
FrameSkip
One CRC-valid frame that could not be decoded.
GlonassEphemeris
A decoded GLONASS broadcast ephemeris (message 1020).
GpsEphemeris
A decoded GPS broadcast ephemeris (message 1019).
LockTimeTracker
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.
PreviousLock
The tracked previous observation of one RTCM MSM signal cell.
RtcmStream
A decoded RTCM byte stream plus diagnostics for skipped frames.
SsrClockRecord
One satellite clock-correction record.
SsrCodeBiasRecord
One satellite code-bias record.
SsrHeader
Common header for RTCM SSR messages.
SsrMessage
A decoded RTCM SSR message body.
SsrOrbitRecord
One satellite orbit-correction record.
SsrPhaseBiasRecord
One satellite phase-bias record.
SsrPhaseBiasSignal
One signal in a phase-bias record.
SsrStreamAssembler
Owns an RTCM carry buffer for chunked stream decoding.
StationCoordinates
A decoded message 1005 or 1006 antenna reference point.
StreamDiagnostics
Diagnostics collected while scanning an RTCM byte stream.
UnsupportedMessage
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§

FrameSkipReason
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.