bds.h
Go to the documentation of this file.
1 // vim:set ft=c.doxygen sw=2 sts=2 fenc=utf8:
2 
3 /*
4  * libasterix
5  * Copyright [2013-2020] SinoATC <http://www.sinoatc.com>.
6  * All Rights Reserved.
7  *
8  * NOTICE: All information contained herein is, and remains
9  * the property of SinoATC and its suppliers, if any.
10  * The intellectual and technical concepts contained herein
11  * are proprietary to Aerosys Corporation and its suppliers and may be
12  * covered by U.S. and Foreign Patents, patents in process,
13  * and are protected by trade secret or copyright law.
14  * Dissemination of this information or reproduction of this material
15  * is strictly forbidden unless prior written permission is obtained
16  * from SinoATC.
17  */
18 
26 #ifndef LIBASTERIX_BDS_H
27 #define LIBASTERIX_BDS_H
28 
29 #include <stddef.h>
30 #include <stdbool.h>
31 #include "platform.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
48 #define AST_MAP_BDS_TYPE(msb, lsb) \
49  BDS ## msb ## lsb = 0x ## msb ## lsb,
50 
54 typedef enum _ast_bds_type_t
55 {
65 
67 
73 AST_API const char* ast_bds_type_to_str(const ast_bds_type_t type);
74 
80 AST_API const char* ast_bds_type_to_str_simple(const ast_bds_type_t type);
81 
83 #define AST_MAX_BDS 8
84 
86 typedef struct _ast_bds_t
87 {
88  const unsigned char* data;
89  size_t size;
90 
92 
93  bool valid;
94 } ast_bds_t;
95 
97 #define AST_BDS_SIZE 7
98 
100 AST_API ast_bds_t ast_bds_decode(const unsigned char* buffer, const size_t bufsize, const ast_bds_type_t type);
101 
106 AST_API const char* ast_bds_get_name(const ast_bds_type_t type);
107 
109 #define AST_BDS_DETAIL_HTML_PREFERED_CHARS 20480
110 
124 AST_API void ast_bds_get_detail_html(char* detail, const size_t detail_size, const ast_bds_t bds);
125 
132 AST_API void ast_bds_get_detail_html_dummy(char* detail, const size_t detail_size, const ast_bds_t bds);
133 
141 typedef enum _ast_bds_uelm_capability_t
143 {
153 
155 typedef enum _ast_bds_delm_capability_t
156 {
166 
168 typedef struct _ast_bds_10_t
169 {
170  bool valid;
171 
174 
177 
180 
183 
186 
189 
192 
195 
198 
201 
204 } ast_bds_10_t;
205 
208 
210 AST_API void ast_bds_10_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
211 
220 typedef struct _ast_bds_20_t
222 {
223  bool valid;
224 
225  char aircraft_id[9];
226 
227 } ast_bds_20_t;
228 
231 
233 AST_API void ast_bds_20_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
234 
243 typedef enum _ast_bds_threat_type_t
245 {
250 
252 typedef struct _ast_bds_30_t
253 {
254  bool valid;
255 
256  //Active Resolution Advisories (ARA)
257  bool ra_active;
258 
259  //Resolution Advisory Complements (RAC)
261 
262  //Resolution Advisory Terminated Indicator (RAT)
264 
265  //Multiple Threat Encounter (MTE)
267 
268  //Threat Type Indicator (TTI)
270 
271  //Threat Identity Data (TID)
272  unsigned char threat_addr[3];
276 
277 } ast_bds_30_t;
278 
281 
283 AST_API void ast_bds_30_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
284 
293 typedef enum _ast_bds_target_altitude_source_t
295 {
301 
303 typedef struct _ast_bds_40_t
304 {
305  bool valid;
306 
310 
314 
318 
324 
328 } ast_bds_40_t;
329 
332 
334 AST_API void ast_bds_40_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
335 
344 typedef struct _ast_bds_50_t
346 {
347  bool valid;
348 
353 
356  bool tta_west;
358 
362 
366 
370 } ast_bds_50_t;
371 
374 
376 AST_API void ast_bds_50_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
377 
386 typedef struct _ast_bds_60_t
388 {
389  bool valid;
390 
393  bool mnh_west;
395 
399 
402  double mch_mach;
403 
407 
411 } ast_bds_60_t;
412 
415 
417 AST_API void ast_bds_60_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
418 
422 #ifdef __cplusplus
423  }
424 #endif // extern "C"
425 
426 #endif //LIBASTERIX_BDS_H
427 
bool valid
True if data item is correctlly decoded.
Definition: bds.h:93
Definition: bds.h:160
ast_bds_10_t ast_bds_10_decode(const ast_bds_t bds)
Decode function.
bool ra_terminated
Definition: bds.h:263
ast_bds_t ast_bds_decode(const unsigned char *buffer, const size_t bufsize, const ast_bds_type_t type)
Decode BDS from binary data.
int fms_selected_altitude
Definition: bds.h:313
bool gsd_status
Ground Speed.
Definition: bds.h:360
ast_bds_20_t ast_bds_20_decode(const ast_bds_t bds)
Decode function.
bool tta_status
True Track Angle.
Definition: bds.h:355
bool mnh_status
Magnetic Heading.
Definition: bds.h:392
Definition: bds.h:147
int tas_true_airspeed
Definition: bds.h:369
bool ra_complements
Definition: bds.h:260
size_t size
Size of data item.
Definition: bds.h:89
ast_bds_threat_type_t threat_type
Definition: bds.h:269
bool mcp_status
MCP/FCU Selected Altitude.
Definition: bds.h:308
int threat_range
Definition: bds.h:274
void ast_bds_get_detail_html_dummy(char *detail, const size_t detail_size, const ast_bds_t bds)
Dummy get detail function.
bool fms_status
FMS Selected Altitude.
Definition: bds.h:312
BDS 1,0 - Data Link Capability Report.
Definition: bds.h:168
bool bar_status
Barometric Altitude Rate.
Definition: bds.h:405
Definition: bds.h:161
#define AST_API
Definition: platform.h:63
bool mmb_alt_hold_mode
Definition: bds.h:322
void ast_bds_50_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
double mch_mach
Definition: bds.h:402
double bar_barometric_altitude_rate
Definition: bds.h:406
BDS 6,0 - Heading and Speed Report.
Definition: bds.h:387
ast_bds_50_t ast_bds_50_decode(const ast_bds_t bds)
Decode function.
bool mmb_vnav_mode
Definition: bds.h:321
bool rla_status
Roll Angle.
Definition: bds.h:350
bool sic_capability
Surveillance Identifier Code (SIC)
Definition: bds.h:200
Binary Data Source (BDS)
Definition: bds.h:86
This file includes platform specific definitions.
int threat_bearing
Definition: bds.h:275
bool multi_threat
Definition: bds.h:266
Definition: bds.h:150
Definition: bds.h:164
const char * ast_bds_type_to_str_simple(const ast_bds_type_t type)
Convert from ast_bds_type_t to C string simple version.
ast_bds_40_t ast_bds_40_decode(const ast_bds_t bds)
Decode function.
bool squitter_capability_updated
Squitter Capability Subfield (SCS)
Definition: bds.h:197
bool acid_capability
Aircraft Identification Capability.
Definition: bds.h:194
double mnh_magnetic_heading
Definition: bds.h:394
bool tas_status
True Airspeed.
Definition: bds.h:368
bool tcas_interface_operational
TCAS Interface operational.
Definition: bds.h:176
bool valid
Definition: bds.h:389
Definition: bds.h:146
ast_bds_type_t
Definition of BDS type.
Definition: bds.h:54
BDS 4,0 - Selected Vertical Intention.
Definition: bds.h:303
double rla_roll_angle
Definition: bds.h:352
Definition: bds.h:157
void ast_bds_30_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
double bps_barometric_pressure_setting
Definition: bds.h:317
int mcp_selected_altitude
Definition: bds.h:309
void ast_bds_10_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
Definition: bds.h:151
Definition: bds.h:145
ast_bds_30_t ast_bds_30_decode(const ast_bds_t bds)
Decode function.
Definition: bds.h:148
const char * ast_bds_type_to_str(const ast_bds_type_t type)
Convert from ast_bds_type_t to C string.
bool mnh_west
Definition: bds.h:393
bool tas_status
Target Altitude Source Bits.
Definition: bds.h:326
bool ias_status
Indicated Airspeed.
Definition: bds.h:397
ast_bds_delm_capability_t delm_capability
Downlink ELM Throughput Capability.
Definition: bds.h:191
double tta_true_track_angle
Definition: bds.h:357
double ivv_intertial_vertical_velocity
Definition: bds.h:410
bool tar_status
Track Angle Rate.
Definition: bds.h:364
BDS 2,0 - Aircraft Identification.
Definition: bds.h:221
bool valid
Definition: bds.h:347
bool modes_specific_service
Mode-S Specific Services Capability.
Definition: bds.h:185
int threat_altitude
Definition: bds.h:273
bool transponder_enhanced_protocol
Transponder Enhanced Protocol Indicator.
Definition: bds.h:182
bool bps_status
Barometric Pressure Setting.
Definition: bds.h:316
ast_bds_target_altitude_source_t tas_target_alt_source
Definition: bds.h:327
void ast_bds_20_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
Definition: bds.h:162
bool ra_active
Definition: bds.h:257
ast_bds_target_altitude_source_t
Target Altitude Source.
Definition: bds.h:294
ast_bds_threat_type_t
Threat Type.
Definition: bds.h:244
bool valid
Definition: bds.h:223
#define AST_MAP_BDS_TYPE(msb, lsb)
Macro used to map BDS type.
Definition: bds.h:48
bool rla_left_wing_down
Definition: bds.h:351
void ast_bds_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Function to get a html snippet of detailed description of dataitem.
const char * ast_bds_get_name(const ast_bds_type_t type)
Function to get name of one BDS.
ast_bds_uelm_capability_t
Uplink ELM Average Throughput Capability.
Definition: bds.h:142
void ast_bds_40_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
double gsd_ground_speed
Definition: bds.h:361
ast_bds_60_t ast_bds_60_decode(const ast_bds_t bds)
Decode function.
BDS 5,0 - Track and Turn Report.
Definition: bds.h:345
bool mmb_status
MCP/FCU Mode Bits.
Definition: bds.h:320
Definition: bds.h:247
Definition: bds.h:159
Definition: bds.h:144
ast_bds_type_t type
Type of data item.
Definition: bds.h:91
bool valid
Definition: bds.h:305
bool ivv_status
Intertial Vertical Velocity.
Definition: bds.h:409
bool mch_status
Mach.
Definition: bds.h:401
bool valid
Definition: bds.h:254
bool mmb_approach_mode
Definition: bds.h:323
double tar_track_angle_rate
Definition: bds.h:365
bool gicb_capability_updated
Common Usage GICB Capability Report.
Definition: bds.h:203
Definition: bds.h:163
Definition: bds.h:246
Definition: bds.h:248
void ast_bds_60_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
int modes_subnetwork_version
Mode-S Subnetwork Version Number.
Definition: bds.h:179
bool valid
Definition: bds.h:170
const unsigned char * data
Address of data item.
Definition: bds.h:88
int ias_indicated_airspeed
Definition: bds.h:398
bool continuation_flag
Continuation Flag.
Definition: bds.h:173
Definition: bds.h:149
Definition: bds.h:158
BDS 3,0 - TCAS/ACAS Active Resolution Advisory.
Definition: bds.h:252
ast_bds_uelm_capability_t uelm_capability
Uplink ELM Average Throughput Capability.
Definition: bds.h:188
ast_bds_delm_capability_t
Downlink ELM Throughput Capability.
Definition: bds.h:155
bool tta_west
Definition: bds.h:356