#ads-b #deku #radar #protocols #airplane #aerorust

no-std adsb_deku

Decoder for ADS-B(Automatic Depedent Surveillance-Broadcast) - written with deku

13 unstable releases

0.7.1 Sep 2, 2024
0.7.0 Nov 23, 2023
0.6.3 Feb 4, 2023
0.6.2 Dec 30, 2022
0.3.0 Oct 31, 2021

#389 in Parser implementations

Download history 72/week @ 2024-07-13 31/week @ 2024-07-20 129/week @ 2024-07-27 41/week @ 2024-08-03 48/week @ 2024-08-10 16/week @ 2024-08-17 64/week @ 2024-08-24 293/week @ 2024-08-31 70/week @ 2024-09-07 44/week @ 2024-09-14 138/week @ 2024-09-21 87/week @ 2024-09-28 63/week @ 2024-10-05 37/week @ 2024-10-12 48/week @ 2024-10-19 48/week @ 2024-10-26

204 downloads per month
Used in rsadsb_common

MIT license

1MB
2K SLoC

adsb_deku library

Minimum required rust version: 1.64.

Add the following lines to your Cargo.toml file:

adsb_deku = "0.7.0"

Support

DF Name Section
0 Short Air-Air Surveillance 3.1.2.8.2
4 Surveillance Altitude Reply 3.1.2.6.5
5 Surveillance Identity Reply 3.1.2.6.7
11 All Call Reply 2.1.2.5.2.2
16 Long Air-Air Surveillance 3.1.2.8.3
17 Extended Squitter(ADS-B) 3.1.2.8.6
18 Extended Squitter(TIS-B) 3.1.2.8.7
19 Extended Squitter(Military) 3.1.2.8.8
20 Comm-B Altitude Reply 3.1.2.6.6
21 Comm-B Identity Reply 3.1.2.6.8
24 Comm-D 3.1.2.7.3

Comm-B support

BDS Name Table
(0,0) Empty
(1,0) Data Link Capability A-2-16
(2,0) Aircraft Identification A-2-32

ME support for ADSB Messages

ME(Type Code) Name
0 NoPosition
1..=4 AircraftIdentification
5..=8 SurfacePosition
9..=18 AirbornePositionBaroAltitude
19 AirborneVelocity
20..=22 AirbornePositionGNSSAltitude
23 Reserved0
24 SurfaceSystemStatus
25..=27 Reserved1
28 AircraftStatus
29 TargetStateAndStatusInformation
30 AircraftOperationalCoordination
31 AircraftOperationStatus

Example

The following example shows off reading from ADS-B bytes from a demodulation server into our Frame struct and then executing the fmt::Display Trait for display of information.

use hexlit::hex;
use adsb_deku::Frame;
use adsb_deku::deku::DekuContainerRead;

let bytes = hex!("8da2c1bd587ba2adb31799cb802b");
let frame = Frame::from_bytes((&bytes, 0)).unwrap().1;
assert_eq!(
        r#" Extended Squitter Airborne position (barometric altitude)
  Address:       a2c1bd (Mode S / ADS-B)
  Air/Ground:    airborne
  Altitude:      23650 ft barometric
  CPR type:      Airborne
  CPR odd flag:  even
  CPR latitude:  (87769)
  CPR longitude: (71577)
"#,
    frame.to_string()
);

Build the docs(> cargo doc), or see docs.rs for complete public API documentation.

Contributing

Testing

Test data was generated using a rtl-sdr with dump1090-fa.

> cargo test

For testing this library, you can run our app 1090 with the following options for exiting program on missing fmt::Display or bytes protocol decode.

> cd ../apps
> cargo r --release --bin 1090 -- --debug --disable-airplanes --panic-decode --panic-display

This library is also fuzzed, ensuring no panic when parsing from demodulated bytes.

> cargo fuzz run fuzz_target_1

fmt

> cargo +nightly fmt

Benchmark

Benchmarking is done against a file containing 215606 ADS-B messages: lax-messages.txt. Quick math (215606 / 692.80) says the average speed of decoding is ~311.21 ms a message. A ~3% speedup can be gained on some systems by using RUSTFLAGS="-C target-cpu=native"

> cargo bench
lax_messsages           time:   [680.70 ms 692.82 ms 704.99 ms]

Derivation

Derived from Aeronautical Telecommunications Volume IV: Surveillance and Collision Avoidance Systems, Fifth Edition and ICAO 9871.

no_std support

Add the following to your Cargo.toml file to enable no_std code only:

default-features = false
features = ["alloc"]

Dependencies

~4MB
~85K SLoC