bds.h
Go to the documentation of this file.
1/*
2 * $COPYRIGHT-BEGIN$
3 * libasterix
4 * Copyright [2013-2026] SinoATC <http://www.sinoatc.com>.
5 * All Rights Reserved.
6 *
7 * NOTICE: All information contained herein is, and remains
8 * the property of SinoATC and its suppliers, if any.
9 * The intellectual and technical concepts contained herein
10 * are proprietary to SinoATC and its suppliers and may be
11 * covered by U.S. and Foreign Patents, patents in process,
12 * and are protected by trade secret or copyright law.
13 * Dissemination of this information or reproduction of this material
14 * is strictly forbidden unless prior written permission is obtained
15 * from SinoATC.
16 * $COPYRIGHT-END$
17 */
18
30
31#ifndef LIBASTERIX_BDS_H
32#define LIBASTERIX_BDS_H
33
34#include <stddef.h>
35#include <stdbool.h>
36#include "platform.h"
37#include "global_enum.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
50
57#define AST_MAP_BDS_TYPE(msb, lsb) \
58 BDS ## msb ## lsb = 0x ## msb ## lsb,
59
85
92
99
101#define AST_MAX_BDS 8
102
104typedef struct _ast_bds_t
105{
106 const unsigned char* data;
107 size_t size;
108
110
111 bool valid;
112} ast_bds_t;
113
115#define AST_BDS_SIZE 7
116
118AST_API ast_bds_t ast_bds_decode(const unsigned char* buffer, const size_t bufsize, const ast_bds_type_t type);
119
125
127#define AST_BDS_DETAIL_HTML_PREFERED_CHARS 20480
128
142AST_API void ast_bds_get_detail_html(char* detail, const size_t detail_size, const ast_bds_t bds);
143
150AST_API void ast_bds_get_detail_html_dummy(char* detail, const size_t detail_size, const ast_bds_t bds);
151 /* end of group bds_generic */
153
161
163typedef struct _ast_bds_05_t
164{
165 bool valid;
166
169
172
175
180
183
186
191
194
197
199
202
204AST_API void ast_bds_05_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
205 /* end of group bds_05 */
207
215
217typedef struct _ast_bds_08_t
218{
219 bool valid;
220
223
226
228 char aircraft_id[9];
229
231
234
236AST_API void ast_bds_08_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
237 /* end of group bds_08 */
239
247
249typedef struct _ast_bds_09_t
250{
251 bool valid;
252
255
258
261
263 int nacv;
264
267
272
277
281
285
290
295
298
302
307
310
314
316
319
321AST_API void ast_bds_09_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
322 /* end of group bds_09 */
324
332
345
358
397
400
402AST_API void ast_bds_10_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
403 /* end of group bds_10 */
405
406
414
416typedef struct _ast_bds_20_t
417{
418 bool valid;
419
420 char aircraft_id[9];
421
423
426
428AST_API void ast_bds_20_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
429 /* end of group bds_20 */
431
432
440
448
450typedef struct _ast_bds_30_t
451{
452 bool valid;
453
456
459
462
465
468
470 unsigned char threat_addr[3];
471
474
477
480
482
485
487AST_API void ast_bds_30_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
488 /* end of group bds_30 */
490
491
499
541
544
546AST_API void ast_bds_40_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
547 /* end of group bds_40 */
549
550
558
560typedef struct _ast_bds_50_t
561{
562 bool valid;
563
566
571
574
577
582
585
588
591
594
597
600
604
607
609AST_API void ast_bds_50_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
610 /* end of group bds_50 */
612
613
621
623typedef struct _ast_bds_60_t
624{
625 bool valid;
626
629
634
637
640
643
646
648 double mch_mach;
649
652
655
658
662
665
667AST_API void ast_bds_60_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds);
668 /* end of group bds_60 */
670
671
672#ifdef __cplusplus
673 }
674#endif // extern "C"
675
676#endif //LIBASTERIX_BDS_H
677
678// vim:set ft=c.doxygen sw=2 sts=2 fenc=utf8:
Global enumeration definitions.
void ast_bds_05_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_05_t ast_bds_05_decode(const ast_bds_t bds)
Decode function.
ast_bds_08_t ast_bds_08_decode(const ast_bds_t bds)
Decode function.
void ast_bds_08_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_09_t ast_bds_09_decode(const ast_bds_t bds)
Decode function.
void ast_bds_09_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_uelm_capability_t
Uplink ELM Average Throughput Capability.
Definition bds.h:335
void ast_bds_10_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_delm_capability_t
Downlink ELM Throughput Capability.
Definition bds.h:348
ast_bds_10_t ast_bds_10_decode(const ast_bds_t bds)
Decode function.
@ AST_BDS_UELM_CAP_UNASSIGNED
Definition bds.h:343
@ AST_BDS_UELM_CAP_60MS
Definition bds.h:341
@ AST_BDS_UELM_CAP_NO
Definition bds.h:336
@ AST_BDS_UELM_CAP_1S
Definition bds.h:337
@ AST_BDS_UELM_CAP_500MS
Definition bds.h:338
@ AST_BDS_UELM_CAP_125MS
Definition bds.h:340
@ AST_BDS_UELM_CAP_30MS
Definition bds.h:342
@ AST_BDS_UELM_CAP_250MS
Definition bds.h:339
@ AST_BDS_DELM_CAP_16SEG_125MS
Definition bds.h:355
@ AST_BDS_DELM_CAP_16SEG_250MS
Definition bds.h:354
@ AST_BDS_DELM_CAP_16SEG_500MS
Definition bds.h:353
@ AST_BDS_DELM_CAP_8SEG_1S
Definition bds.h:351
@ AST_BDS_DELM_CAP_NO
Definition bds.h:349
@ AST_BDS_DELM_CAP_4SEG_1S
Definition bds.h:350
@ AST_BDS_DELM_CAP_16SEG_1S
Definition bds.h:352
@ AST_BDS_DELM_CAP_UNASSIGNED
Definition bds.h:356
void ast_bds_20_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_20_t ast_bds_20_decode(const ast_bds_t bds)
Decode function.
void ast_bds_30_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_30_t ast_bds_30_decode(const ast_bds_t bds)
Decode function.
ast_bds_threat_type_t
Threat Type.
Definition bds.h:443
@ AST_BDS_THREAT_TYPE_MODES
Definition bds.h:445
@ AST_BDS_THREAT_TYPE_MODEAC
Definition bds.h:446
@ AST_BDS_THREAT_TYPE_UNKNOWN
Definition bds.h:444
ast_bds_40_t ast_bds_40_decode(const ast_bds_t bds)
Decode function.
void ast_bds_40_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_50_t ast_bds_50_decode(const ast_bds_t bds)
Decode function.
void ast_bds_50_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
ast_bds_60_t ast_bds_60_decode(const ast_bds_t bds)
Decode function.
void ast_bds_60_get_detail_html(char *detail, const size_t detail_size, const ast_bds_t bds)
Get detail function.
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.
const char * ast_bds_type_to_str(const ast_bds_type_t type)
Convert from ast_bds_type_t to C string.
#define AST_MAP_BDS_TYPE(msb, lsb)
Macro used to map BDS type.
Definition bds.h:57
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.
const char * ast_bds_get_name(const ast_bds_type_t type)
Function to get name of one BDS.
void ast_bds_get_detail_html_dummy(char *detail, const size_t detail_size, const ast_bds_t bds)
Dummy get detail function.
ast_bds_type_t
Definition of BDS type.
Definition bds.h:64
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.
ast_selected_altitude_source_t
Selected Altitude Source.
Definition global_enum.h:307
This file includes platform specific definitions.
#define AST_API
Definition platform.h:63
BDS 0,5 - Extended Squitter Airborne Position.
Definition bds.h:164
int cpr_latitude
CPR latitude.
Definition bds.h:193
bool altitude_gnss
Altitude Source true - GNSS false - Baro.
Definition bds.h:179
bool cpr_odd
CPR Format true - Odd false - Even.
Definition bds.h:190
int type_code
Format Type Code.
Definition bds.h:168
bool valid
Definition bds.h:165
bool nic_sup_b
NIC Supplement-B.
Definition bds.h:174
int cpr_longitude
CPR longitude.
Definition bds.h:196
bool time_applicability
Time of applicability.
Definition bds.h:185
int altitude
Altitude.
Definition bds.h:182
int sur_status
Surveillance Status.
Definition bds.h:171
BDS 0,8 - Extended Squitter Identification and Category.
Definition bds.h:218
int emitter_category
Aircraft Emitter Category.
Definition bds.h:225
bool valid
Definition bds.h:219
char aircraft_id[9]
Aircraft Identification.
Definition bds.h:228
int type_code
Format Type Code.
Definition bds.h:222
BDS 0,9 - Extended Squitter Airborne Position.
Definition bds.h:250
bool ground_speed_west
Ground speed east-west sign true - west false - east.
Definition bds.h:271
bool intent_change
Intent Change Flag.
Definition bds.h:260
bool geo_height_below_baro
Geometric height difference sign true - below baro alt false - above baro.
Definition bds.h:306
bool ground_speed_south
Ground speed north-south sign true - south false - north.
Definition bds.h:276
int geo_height_diff
Geometric height difference from baro altitude LSB = feet.
Definition bds.h:313
bool valid
Definition bds.h:251
bool ground_speed_valid
Ground speed valid.
Definition bds.h:266
int subtype
Subtype.
Definition bds.h:257
int ground_speed_ew
Ground speed east-west component LSB = knot.
Definition bds.h:280
int ground_speed_ns
Ground speed north-south component LSB = knot.
Definition bds.h:284
int type_code
Format Type Code.
Definition bds.h:254
bool vertical_rate_down
Vertical rate sign true - down false - up.
Definition bds.h:294
bool vertical_rate_valid
Vertical rate valid.
Definition bds.h:297
bool vertical_rate_baro
Vertical rate source true - Baro false - Geometric.
Definition bds.h:289
int nacv
NACv.
Definition bds.h:263
bool geo_height_diff_valid
Geometric height difference valid.
Definition bds.h:309
int vertical_rate
Vertical rate LSB = feet/min.
Definition bds.h:301
BDS 1,0 - Data Link Capability Report.
Definition bds.h:361
bool gicb_capability_updated
Common Usage GICB Capability Report.
Definition bds.h:395
bool continuation_flag
Continuation Flag.
Definition bds.h:365
bool modes_specific_service
Mode-S Specific Services Capability.
Definition bds.h:377
bool valid
Definition bds.h:362
bool acid_capability
Aircraft Identification Capability.
Definition bds.h:386
bool transponder_enhanced_protocol
Transponder Enhanced Protocol Indicator.
Definition bds.h:374
bool sic_capability
Surveillance Identifier Code (SIC).
Definition bds.h:392
ast_bds_delm_capability_t delm_capability
Downlink ELM Throughput Capability.
Definition bds.h:383
bool squitter_capability_updated
Squitter Capability Subfield (SCS).
Definition bds.h:389
ast_bds_uelm_capability_t uelm_capability
Uplink ELM Average Throughput Capability.
Definition bds.h:380
int modes_subnetwork_version
Mode-S Subnetwork Version Number.
Definition bds.h:371
bool tcas_interface_operational
TCAS Interface operational.
Definition bds.h:368
BDS 2,0 - Aircraft Identification.
Definition bds.h:417
char aircraft_id[9]
Definition bds.h:420
bool valid
Definition bds.h:418
BDS 3,0 - TCAS/ACAS Active Resolution Advisory.
Definition bds.h:451
ast_bds_threat_type_t threat_type
Threat Type Indicator (TTI).
Definition bds.h:467
bool ra_terminated
Resolution Advisory Terminated Indicator (RAT).
Definition bds.h:461
bool ra_active
Active Resolution Advisories (ARA).
Definition bds.h:455
bool valid
Definition bds.h:452
unsigned char threat_addr[3]
Threat Identity Data (TID) - ICAO 24-bit address.
Definition bds.h:470
int threat_altitude
Threat Identity Data (TID) - altitude.
Definition bds.h:473
int threat_bearing
Threat Identity Data (TID) - bearing.
Definition bds.h:479
bool multi_threat
Multiple Threat Encounter (MTE).
Definition bds.h:464
bool ra_complements
Resolution Advisory Complements (RAC).
Definition bds.h:458
int threat_range
Threat Identity Data (TID) - range.
Definition bds.h:476
BDS 4,0 - Selected Vertical Intention.
Definition bds.h:502
bool mmb_vnav_mode
MCP/FCU VNAV mode.
Definition bds.h:527
bool mcp_status
MCP/FCU selected altitude status.
Definition bds.h:506
bool fms_status
FMS selected altitude status.
Definition bds.h:512
bool tas_status
Target altitude source bits status.
Definition bds.h:536
int mcp_selected_altitude
MCP/FCU selected altitude.
Definition bds.h:509
bool mmb_status
MCP/FCU mode bits status.
Definition bds.h:524
bool mmb_approach_mode
MCP/FCU approach mode.
Definition bds.h:533
bool mmb_alt_hold_mode
MCP/FCU altitude hold mode.
Definition bds.h:530
bool valid
Definition bds.h:503
ast_selected_altitude_source_t tas_target_alt_source
Target altitude source.
Definition bds.h:539
bool bps_status
Barometric pressure setting status.
Definition bds.h:518
double bps_barometric_pressure_setting
Barometric pressure setting.
Definition bds.h:521
int fms_selected_altitude
FMS selected altitude.
Definition bds.h:515
BDS 5,0 - Track and Turn Report.
Definition bds.h:561
int tas_true_airspeed
True airspeed.
Definition bds.h:602
bool tar_status
Track angle rate status.
Definition bds.h:593
bool tta_west
True track angle sign true - west false - east.
Definition bds.h:581
bool rla_left_wing_down
Roll angle sign true - left wing down false - right wing down.
Definition bds.h:570
bool tta_status
True track angle status.
Definition bds.h:576
double rla_roll_angle
Roll angle.
Definition bds.h:573
double tar_track_angle_rate
Track angle rate.
Definition bds.h:596
bool valid
Definition bds.h:562
bool rla_status
Roll angle status.
Definition bds.h:565
double tta_true_track_angle
True track angle.
Definition bds.h:584
double gsd_ground_speed
Ground speed.
Definition bds.h:590
bool tas_status
True airspeed status.
Definition bds.h:599
bool gsd_status
Ground speed status.
Definition bds.h:587
BDS 6,0 - Heading and Speed Report.
Definition bds.h:624
bool ivv_status
Inertial vertical velocity status.
Definition bds.h:657
double bar_barometric_altitude_rate
Barometric altitude rate.
Definition bds.h:654
bool mnh_status
Magnetic heading status.
Definition bds.h:628
bool mch_status
Mach status.
Definition bds.h:645
bool mnh_west
Magnetic heading sign true - west false - east.
Definition bds.h:633
int ias_indicated_airspeed
Indicated airspeed.
Definition bds.h:642
bool bar_status
Barometric altitude rate status.
Definition bds.h:651
double mch_mach
Mach.
Definition bds.h:648
bool ias_status
Indicated airspeed status.
Definition bds.h:639
bool valid
Definition bds.h:625
double ivv_intertial_vertical_velocity
Inertial vertical velocity.
Definition bds.h:660
double mnh_magnetic_heading
Magnetic heading.
Definition bds.h:636
Binary Data Source (BDS).
Definition bds.h:105
bool valid
True if data item is correctlly decoded.
Definition bds.h:111
const unsigned char * data
Address of data item.
Definition bds.h:106
size_t size
Size of data item.
Definition bds.h:107
ast_bds_type_t type
Type of data item.
Definition bds.h:109