remoteid
Drone Remote ID for Rust. It decodes and encodes the broadcast messages of ASTM F3411-22a and ASD-STAN EN 4709-002 (the FAA and EU Remote ID formats, implemented in C by Open Drone ID), and pulls them out of real radio frames:
| Transport | Function |
|---|---|
| Bluetooth 4 legacy advertising | ble::find_in_advertising_data, ble::parse_service_data |
| Bluetooth 5 extended / long range | same functions; the payload is a message pack |
| Wi-Fi Beacon vendor element | wifi::parse_frame, wifi::find_in_elements |
| Wi-Fi NAN service discovery | wifi::parse_frame, wifi::parse_nan_action |
| Monitor mode captures | wifi::strip_radiotap (drops the FCS too) |
| French beacon (pre-EU format) | france::find_in_elements |
Pure Rust, no dependencies, no_std, no allocation outside the optional
Tracker, #![forbid(unsafe_code)]. It builds for microcontrollers
(thumbv7em-none-eabihf) and for the browser (wasm32-unknown-unknown).
Why
Rust Remote ID receivers on GitHub (detectors, ground stations, SDR tools) each hand-roll their own decoder, or link the C library through FFI, which needs a C toolchain and bindgen and does not build for wasm. This crate is the decoder they can share, checked field by field against the C reference.
Use
[]
= "0.1"
Bluetooth (for example service data from btleplug for UUID 0xFFFA):
use ;
Wi-Fi monitor mode (radiotap frames from pcap, libpcap, or an ESP32):
use ;
Transmitting (for example from a Bluetooth 4 beacon):
use ;
let id = new?;
let mut adv = ;
let n = write_advertising_data?;
assert_eq!;
# Ok::
A complete program that reads a capture and prints every aircraft is in
examples/pcap_tracker.rs:
$ cargo run --example pcap_tracker -- tests/data/odid_wifi_bcn_sample.pcap
Wifi([132, 204, 168, 96, 67, 36])
id: Some("MFG1A0123456789")
operator: Some("GBR-OP-123ABCD")
self id: Some("Recreational")
status: Undeclared
position: Some((45.5470818, -122.9668346))
alt geo: Some(237.0) m, height Some(100.0) m
speed: Some(20.5) m/s, track Some(280.0) deg
operator position: Some((45.5443876, -122.9726866))
frames: 21 received, 2 est. missed, 0 duplicates, 0 undecodable
What you get
- All six message types (Basic ID, Location, Auth, Self ID, System,
Operator ID) and message packs, decode and encode. Unknown values
("no value" sentinels such as direction 361 or altitude -1000 m) decode to
None; reserved enum codes are kept asOther(u8)so nothing is lost. Location::check()reports out of range values. The decoder accepts any bit pattern, as the C library does, so corrupted or spoofed frames still decode; callcheck()before you plot them.BasicId::serial_number()splits and validates ANSI/CTA-2063-A serial numbers (manufacturer code, length character, serial).UasDatamerges messages into one record per aircraft and joins multi-page authentication data (auth_data). Signatures are not verified: the key scheme is operator specific.Tracker(with the defaultstdfeature) keys aircraft by radio address, counts duplicate and missed frames from the message counters, and expires aircraft that went quiet. It takes timestamps from the caller, so a replayed capture behaves the same as a live receiver.serdefeature forSerialize/Deserializeon the decoded types.
How it is tested
- Against the reference C library. Every distinct message in the three
public Open Drone ID sample captures (82 messages, some of them corrupted
in the air) was decoded by
opendroneid-core-c; the test suite checks that this crate produces the same value for every field. Every one of the 336 message packs is accepted or rejected exactly as the C library does. CI rebuilds the C library and regenerates these files on every push. - On real captures, end to end. Wi-Fi Beacon, Wi-Fi NAN and Bluetooth 5
long range captures go through
strip_radiotap/parse_frame/find_in_advertising_datainto the tracker. In the long range capture, the 28 frames the sniffer marked with a bad CRC are exactly the 28 frames the tracker reports as missed from counter gaps. - Round trips. Values on the transmitted grid survive encode then decode exactly, and the Wi-Fi sample messages re-encode to the bytes that were on the air.
- Random input. 200,000 random and header-biased buffers through every parser, with no panic.
See docs/testing.md for how to regenerate the reference data, and docs/format.md for the byte layouts.
Status
0.1: the message layer and transports are complete and checked against the
reference. Not included yet: MAVLink OPEN_DRONE_ID_* conversion (the
MAVLink messages carry the same 25 byte payloads, so Message::decode works
on their data fields directly) and Network Remote ID (ASTM F3411 NetRID
JSON).
License
MIT. The sample captures in tests/data come from
opendroneid/wireshark-dissector
under the Apache License 2.0 (tests/data/LICENSE-APACHE-opendroneid); they
are not part of the published crate.