Skip to main content

Crate arinc424

Crate arinc424 

Source
Expand description

ARINC 424 navigation data parser.

This crate provides parser for ARINC 424 records with their fields. Each record is parsed from 132 bytes and references those. The parser tries to copy as little as possible and the fields provide methods to copy or clone values when needed.

§Examples

Lets parse John F Kennedy Intl airport and print its coordinates:

use arinc424::records::Airport;

let data = b"SUSAP KJFKK6AJFK     0     145YHN40382374W073464329W013000013         1800018000C    MNAR    JOHN F KENNEDY INTL           300671912";
let airport = Airport::try_from(data.as_slice())?;

// now we can print the ICAO code and the position as decimals
let icao = airport.icao_code.as_str();
let lat = airport.latitude.as_decimal()?;
let lon = airport.longitude.as_decimal()?;
println!("{icao} at {lat:.4}, {lon:.4}"); // => "KJFK at 40.6399, -73.7786"

You can also read an entire navigation database obtained from your authorities or other data provider. The following uses the Records iterator to print all airports of the FAA’s Coded Instrument Flight Procedures (CIFP):

// read the navigation database from file
let data = std::fs::read("FAACIFP18").expect("file should be readable");

// iterate over all records but print only airports
for (kind, bytes) in Records::new(&data) {
    match kind {
        RecordKind::Airport => {
            // Airport only references the bytes and gives us access to the fields
            let arpt = Airport::try_from(bytes)?;
            println!("Airport {} ({})", arpt.arpt_ident, arpt.airport_name);
        }
        _ => {}
    }
}

Modules§

fields
records

Enums§

Error