1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! Drone Remote ID in pure Rust.
//!
//! `remoteid` decodes and encodes the broadcast Remote ID messages defined by
//! ASTM F3411-22a and ASD-STAN EN 4709-002 (the format the
//! [Open Drone ID](https://github.com/opendroneid) project implements in C),
//! and pulls them out of the frames receivers actually see:
//!
//! * Bluetooth 4 legacy advertising and Bluetooth 5 extended / long range
//! advertising ([`ble`]),
//! * Wi-Fi Beacon vendor elements and Wi-Fi NAN service discovery frames
//! ([`wifi`]), with or without a radiotap header,
//! * the French "signalement electronique" beacon format ([`france`]).
//!
//! Decoded messages can be merged into one record per aircraft ([`UasData`]),
//! and with the `std` feature a [`Tracker`] keeps those records per
//! transmitter, counts duplicate and missed frames from the message counters,
//! and expires aircraft that went quiet.
//!
//! The crate has no dependencies and works in `no_std` (turn off the default
//! `std` feature). It never allocates outside the `std`-only [`Tracker`].
//!
//! # Example
//!
//! ```
//! use remoteid::{ble, Frame, Message, UasData};
//!
//! // Bluetooth advertising data from a scanner (one AD structure, BT4 legacy).
//! let adv = [
//! 0x1e, 0x16, 0xfa, 0xff, 0x0d, 0x07, // length, service data, UUID 0xFFFA, app code, counter
//! 0x02, 0x12, b'1', b'5', b'9', b'6', b'F', b'3', b'5', b'0', b'7', b'4', b'5', b'2',
//! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//! ];
//! let rid = ble::find_in_advertising_data(&adv).expect("Remote ID service data");
//! let mut uas = UasData::default();
//! match rid.frame().unwrap() {
//! Frame::Message(Message::BasicId(id)) => {
//! assert_eq!(id.uas_id_str(), Some("1596F3507452"));
//! uas.update(&Message::BasicId(id));
//! }
//! other => panic!("unexpected {other:?}"),
//! }
//! assert!(uas.basic_id[0].is_some());
//! ```
//!
//! # Accuracy and limits
//!
//! Decoding follows the reference C library bit for bit; the test suite
//! compares every message in the public Open Drone ID sample captures against
//! that library's output. Encoding quantizes the same way the C library does,
//! so `decode(encode(x))` is exact for values on the transmitted grid.
//! Authentication signatures are reassembled but not verified: verification
//! depends on the key scheme the operator uses, which the standard leaves open.
pub use Error;
pub use *;
pub use ;
pub use ;
pub use UasData;
;
/// Size in bytes of every single Remote ID message.
pub const MESSAGE_SIZE: usize = 25;
/// Protocol version this crate writes when encoding (2 = ASTM F3411-22a).
///
/// Decoding accepts every version: the standard keeps newer versions
/// backward compatible, so fields added later simply read as unset.
pub const PROTOCOL_VERSION: u8 = 2;
/// A decoded Remote ID payload: either one message or a message pack.