Skip to main content

Crate sdr_acars

Crate sdr_acars 

Source
Expand description

ACARS (Aircraft Communications Addressing and Reporting System) decoder. Faithful Rust port of acarsdec — pure DSP + parsing, no GTK, no SDR-driver dependency.

§Example: multi-channel decode from a 2.5 MSps complex IQ stream

use num_complex::Complex32;
use sdr_acars::ChannelBank;

const US_ACARS: &[f64] = &[
    129_125_000.0, 130_025_000.0, 130_425_000.0,
    130_450_000.0, 131_525_000.0, 131_550_000.0,
];

// Center on the midpoint of the channel extremes (130.3375 MHz)
// so the 2.425 MHz cluster fits inside the 2.5 MHz Nyquist window.
let mut bank =
    ChannelBank::new(2_500_000.0, 130_337_500.0, US_ACARS)?;
loop {
    let iq: Vec<Complex32> = read_iq_block();
    if iq.is_empty() { break; }
    bank.process(&iq, |msg| {
        let label = String::from_utf8_lossy(&msg.label);
        println!("{} {label} {}", msg.aircraft, msg.text);
    });
}

For pre-decimated 12.5 kHz IF input (e.g. WAV files written by acarsdec’s --save mode, one channel per WAV channel), drive msk::MskDemod + frame::FrameParser directly instead — see bin/sdr-acars-cli.rs for the WAV path.

Re-exports§

pub use channel::ChannelBank;
pub use channel::ChannelLockState;
pub use channel::ChannelStats;
pub use error::AcarsError;
pub use frame::AcarsMessage;
pub use frame::FrameParser;
pub use json::serialize_message as serialize_acars_json;
pub use label::lookup as lookup_label;
pub use label_parsers::Oooi;
pub use label_parsers::decode_label;
pub use msk::IF_RATE_HZ;
pub use msk::MskDemod;
pub use reassembly::MessageAssembler;
pub use reassembly::REASSEMBLY_TIMEOUT;

Modules§

channel
Multi-channel ACARS decoder. Source-rate complex IQ feeds N parallel per-channel pipelines (oscillator + decimator → AM detect → MSK demod → frame parser).
crc
CRC-CCITT-16 (KERMIT variant) for ACARS frames.
error
Error type for the sdr-acars crate.
frame
ACARS frame parser. Bit-by-bit streaming state machine that consumes the output of crate::msk::MskDemod and emits AcarsMessages when complete frames pass parity + CRC (with optional FEC recovery via crate::syndrom).
json
JSON serializer for AcarsMessage. Pure data → string, no I/O. Schema mirrors acarsdec’s output.c::buildjson verbatim where fields overlap, plus one extension field (reassembled_blocks) carrying this crate’s multi-block reassembly count.
label
Label name lookup. Each ACARS message carries a 2-byte label code identifying its category (Q0 = link test, H1 = crew message, B1 = weather, etc.).
label_parsers
ACARS label parsers — faithful port of acarsdec’s label.c. For each ACARS message that carries one of ~40 known label codes, extract the Out-Off- On-In (OOOI) metadata embedded in the text body at fixed byte offsets — origin/destination airport codes plus the timestamps for the four OOOI events (gate-out, wheels-off, wheels-on, gate-in) and ETA.
msk
MSK (minimum-shift keying) demodulator at 2400 baud over 1200/2400 Hz tones. Faithful port of acarsdec’s msk.c.
reassembly
Multi-block ACARS message reassembly.
syndrom
Single- and double-bit error correction for ACARS frames.