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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* Generated by cbindgen from crates/squitter-ffi/src/lib.rs. Do not edit by hand: run `cbindgen --config crates/squitter-ffi/cbindgen.toml --crate squitter-ffi --output crates/squitter-ffi/include/squitter.h` and commit the result. */
/**
* Error codes returned by [`squitter_decode_line`].
*/
if __STDC_VERSION__ >= 202311L
: uint8_t
// __STDC_VERSION__ >= 202311L
;
typedef enum SquitterError SquitterError;
typedef uint8_t SquitterError;
// __STDC_VERSION__ >= 202311L
/**
* Opaque handle to a decoded ADS-B message, owned by the caller until
* freed with [`squitter_message_free`].
*/
typedef struct SquitterMessage SquitterMessage;
/**
* Decodes a single hex-encoded DF17 frame (bare hex or dump1090's
* `*...;` framing).
*
* On success, returns a non-NULL handle (free it with
* [`squitter_message_free`] when done) and, if `out_error` is non-NULL,
* writes [`SquitterError::Ok`] through it. On failure, returns NULL and,
* if `out_error` is non-NULL, writes the reason through it.
*
* # Safety
* `line` must be NULL or a pointer to a NUL-terminated C string valid for
* reads for the duration of this call. `out_error` must be NULL or a
* pointer valid for a single `u8`-sized write.
*/
struct SquitterMessage *;
/**
* Frees a message handle returned by [`squitter_decode_line`]. Passing
* NULL is a no-op.
*
* # Safety
* `msg` must be NULL or a pointer previously returned by
* [`squitter_decode_line`] that has not already been freed.
*/
void ;
/**
* Which message family this handle holds: `1` = identification, `2` =
* surface position, `3` = airborne position, `4` = airborne velocity, `0`
* for a NULL handle.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from [`squitter_decode_line`].
*/
uint8_t ;
/**
* The transmitting aircraft's 24-bit ICAO address.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from [`squitter_decode_line`].
*/
uint32_t ;
/**
* Reads the aircraft callsign into `buf` as a NUL-terminated string.
*
* Returns `true` and fills `buf` if this is an identification message and
* `buf_len` is large enough (the callsign is always 8 characters or
* fewer, so a 9-byte buffer always suffices); returns `false` (leaving
* `buf` untouched) otherwise.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `buf` must be NULL or valid for writes of
* `buf_len` bytes.
*/
bool ;
/**
* Reads barometric altitude, in feet, off a message.
*
* Returns `true` and writes `*out_feet` if this is an airborne position
* message with a modern (non-Gillham) barometric altitude; returns
* `false` otherwise (including for the legacy Gillham encoding or GNSS
* height - see [`squitter_message_altitude_gnss_meters`]).
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `out_feet` must be a valid pointer to a
* writable `i32`.
*/
bool ;
/**
* Reads GNSS height, in meters, off a message.
*
* Returns `true` and writes `*out_meters` if this is an airborne position
* message with GNSS height (type codes 20-22); returns `false` otherwise.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `out_meters` must be a valid pointer to a
* writable `u16`.
*/
bool ;
/**
* Reads the raw CPR-encoded position fields off a message.
*
* Returns `true` and writes the outputs (`*out_odd`: `true` = odd-format,
* `false` = even-format; `*out_lat_cpr`/`*out_lon_cpr`: the raw 17-bit
* encoded values) if this is a position message (airborne or surface);
* returns `false` otherwise. These are *not* a resolved
* latitude/longitude - see the module-level docs.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `out_odd`, `out_lat_cpr`, and `out_lon_cpr`
* must each be a valid pointer to writable memory of the matching type.
*/
bool ;
/**
* Reads ground speed, in knots, off a message.
*
* Returns `true` and writes `*out_knots` if this message carries a
* resolvable ground speed (an airborne velocity message with both
* east-west and north-south components available, or a surface position
* message with movement information); returns `false` otherwise.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `out_knots` must be a valid pointer to a
* writable `f64`.
*/
bool ;
/**
* Reads vertical rate, in feet/minute (positive = climb), off a message.
*
* Returns `true` and writes `*out_fpm` if this is an airborne velocity
* message with a known vertical rate; returns `false` otherwise.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `out_fpm` must be a valid pointer to a
* writable `i32`.
*/
bool ;
/**
* True airspeed/indicated airspeed heading, in decimal degrees, off an
* airspeed-subtype airborne velocity message.
*
* Returns `true` and writes `*out_degrees` if this is an airborne
* velocity message reporting airspeed (not ground speed) with a known
* heading; returns `false` otherwise.
*
* # Safety
* `msg` must be NULL or a valid, non-freed handle from
* [`squitter_decode_line`]. `out_degrees` must be a valid pointer to a
* writable `f64`.
*/
bool ;
/**
* The `squitter` crate version, as a NUL-terminated, statically allocated
* string (e.g. `"0.1.1"`). Do not free.
*/
const char *;
/* SQUITTER_H */