datarecord.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
28
29#ifndef LIBASTERIX_DATARECORD_H
30#define LIBASTERIX_DATARECORD_H
31
32#include "category.h"
33#include "uap.h"
34#include "fspec.h"
35#include "dataitem.h"
36#include "match.h"
37#include "type.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
55
57#define AST_MAX_DATAITEMS 32
58
60typedef struct _ast_datarecord_t
61{
62 const unsigned char* data;
63 size_t size;
64
67
70 size_t n_dataitems;
71
72 bool valid;
74
84
86typedef struct _ast_datarecord_modifier_t
87{
89 size_t n_dataitems;
91
104AST_API ast_datarecord_t ast_datarecord_decode(const unsigned char* buffer, const size_t bufsize, const ast_category_t category, const ast_uap_t uap);
105
119AST_API ast_datarecord_t ast_datarecord_encode(unsigned char* const buffer, const size_t bufsize, const ast_datarecord_ex_t xdr);
120
132AST_API ast_datarecord_t ast_datarecord_copy(unsigned char* buffer, const size_t bufsize, const ast_datarecord_t src);
133
147AST_API ast_datarecord_t ast_datarecord_modify(unsigned char* buffer, const size_t bufsize, const ast_datarecord_t src, const ast_datarecord_modifier_t mod);
148
150#define AST_DATARECORD_HEX_HTML_PREFERED_CHARS (AST_MAX_DATAITEMS * AST_MAX_DATAITEM_SIZE * 12 + 128)
151
157AST_API void ast_datarecord_get_hex_html(char* html, const size_t html_size, const ast_datarecord_t dr);
158
160#define AST_DATARECORD_DETAIL_HTML_PREFERED_CHARS 20480
161
175AST_API void ast_datarecord_get_detail_html(char* detail, const size_t detail_size, const ast_datarecord_t dr);
176
185
195AST_API bool ast_datarecord_match_keyword(const ast_datarecord_t dr, const ast_keyword_t keyword, const char* challenge, bool case_sensitive);
196
198#define AST_KEYWORD_VALUE_PREFERRED_CHARS 32
199
215AST_API bool ast_datarecord_get_keyword(char* keystr, const size_t keystr_size, const ast_datarecord_t dr, const ast_keyword_t keyword, const ast_keyword_format_t format);
216
224
232
240
248
256
264
272
280
288
296
304
312
320
328
336
344
352
360 /* end of group dr_datarecord */
362
363#ifdef __cplusplus
364 }
365#endif // extern "C"
366
367#endif //LIBASTERIX_DATARECORD_H
368
369// vim:set ft=c.doxygen sw=2 sts=2 fenc=utf8:
This file includes the common used data items shares by different categories.
ast_category_t
Definition of category ID.
Definition category.h:38
ASTERIX data item.
ASTERIX Field Specification (FSPEC).
ast_datarecord_t ast_datarecord_encode(unsigned char *const buffer, const size_t bufsize, const ast_datarecord_ex_t xdr)
Datarecord encode function.
ast_polar_coordinate_t ast_datarecord_get_polarcoord(const ast_datarecord_t dr)
Get polar coordinate from specified datarecord.
bool ast_datarecord_contain_keyword(const ast_datarecord_t dr, const ast_keyword_t keyword)
Check if datarecord contains specified keyword type.
ast_datarecord_t ast_datarecord_decode(const unsigned char *buffer, const size_t bufsize, const ast_category_t category, const ast_uap_t uap)
Datarecord decode function.
bool ast_datarecord_match_keyword(const ast_datarecord_t dr, const ast_keyword_t keyword, const char *challenge, bool case_sensitive)
Match a specified keyword in the datarecord.
void ast_datarecord_get_hex_html(char *html, const size_t html_size, const ast_datarecord_t dr)
Function to get a html snippet of the raw datarecord data in hexadecimal format.
ast_squawk_t ast_datarecord_get_squawk(const ast_datarecord_t dr)
Get Mode-3/A code from specified datarecord.
#define AST_MAX_DATAITEMS
Maximum number of data items in a data record.
Definition datarecord.h:57
ast_timeofday_t ast_datarecord_get_timeofday(const ast_datarecord_t dr)
Get time of day from specified datarecord.
ast_altitude_t ast_datarecord_get_selaltitude(const ast_datarecord_t dr)
Get FMS/MCP/FCU selected altitude from specified datarecord.
ast_sacsic_t ast_datarecord_get_sacsic(const ast_datarecord_t dr)
Get SAC/SIC from specified datarecord.
void ast_datarecord_get_detail_html(char *detail, const size_t detail_size, const ast_datarecord_t dr)
Function to get a html snippet of detailed description of data record.
ast_speed_t ast_datarecord_get_speed(const ast_datarecord_t dr)
Get speed from specified datarecord.
ast_heading_t ast_datarecord_get_heading(const ast_datarecord_t dr)
Get heading from specified datarecord.
ast_azimuth_t ast_datarecord_get_azimuth(const ast_datarecord_t dr)
Get azimuth from specified datarecord.
ast_callsign_t ast_datarecord_get_callsign(const ast_datarecord_t dr)
Get callsign from specified datarecord.
ast_datarecord_t ast_datarecord_copy(unsigned char *buffer, const size_t bufsize, const ast_datarecord_t src)
Datarecord copy function.
ast_wgs84coord_t ast_datarecord_get_wgs84coord(const ast_datarecord_t dr)
Get WGS-84 coordinate from specified datarecord.
ast_tracknum_t ast_datarecord_get_tracknum(const ast_datarecord_t dr)
Get track number from specified datarecord.
ast_icaoaddr_t ast_datarecord_get_icaoaddr(const ast_datarecord_t dr)
Get ICAO 24-bit address from specified datarecord.
ast_range_t ast_datarecord_get_range(const ast_datarecord_t dr)
Get range from specified datarecord.
ast_vertical_rate_t ast_datarecord_get_vrate(const ast_datarecord_t dr)
Get vertical rate from specified datarecord.
ast_cartesian_velocity_t ast_datarecord_get_cartesianvel(const ast_datarecord_t dr)
Get cartesian velocity from specified datarecord.
ast_doppler_velocity_t ast_datarecord_get_dopplervel(const ast_datarecord_t dr)
Get doppler velocity from specified datarecord.
ast_altitude_t ast_datarecord_get_flightlevel(const ast_datarecord_t dr)
Get flight level from specified datarecord.
ast_datarecord_t ast_datarecord_modify(unsigned char *buffer, const size_t bufsize, const ast_datarecord_t src, const ast_datarecord_modifier_t mod)
Datarecord modify function.
bool ast_datarecord_get_keyword(char *keystr, const size_t keystr_size, const ast_datarecord_t dr, const ast_keyword_t keyword, const ast_keyword_format_t format)
Get keyword summary string from specified datarecord.
ast_msgtype_t ast_datarecord_get_msgtype(const ast_datarecord_t dr)
Get message type from specified datarecord.
Utility functions to match dataitem, datarecord, datablock by keywords.
ast_keyword_format_t
Definition match.h:63
ast_keyword_t
Definition match.h:35
#define AST_API
Definition platform.h:63
Altitude.
Definition type.h:117
Azimuth.
Definition type.h:150
Callsign.
Definition type.h:95
Cartesian Velocity.
Definition type.h:177
Extracted dataitem.
Definition dataitem.h:526
Dataitem.
Definition dataitem.h:515
Extracted datarecord.
Definition datarecord.h:77
ast_uap_t uap
UAP of data record.
Definition datarecord.h:79
ast_dataitem_ex_t dataitems[32]
Data items.
Definition datarecord.h:81
size_t n_dataitems
Number of data items.
Definition datarecord.h:82
ast_category_t category
Category of data record.
Definition datarecord.h:78
Datarecord modifier.
Definition datarecord.h:87
ast_dataitem_ex_t dataitems[32]
Data items to be modified.
Definition datarecord.h:88
size_t n_dataitems
Number of data items.
Definition datarecord.h:89
Datarecord.
Definition datarecord.h:61
ast_fspec_t fspec
Field specification.
Definition datarecord.h:68
bool valid
True, if data record is correctly decoded.
Definition datarecord.h:72
size_t size
Size of data record.
Definition datarecord.h:63
ast_dataitem_t dataitems[32]
Data items.
Definition datarecord.h:69
ast_category_t category
Category of data record.
Definition datarecord.h:65
const unsigned char * data
Address of data record.
Definition datarecord.h:62
size_t n_dataitems
Number of data items.
Definition datarecord.h:70
ast_uap_t uap
UAP of data record.
Definition datarecord.h:66
Doppler Velocity.
Definition type.h:186
Field Specification (FSPEC).
Definition fspec.h:56
Heading.
Definition type.h:157
ICAO 24-bit Address.
Definition type.h:102
Definition type.h:72
Polar Coordinate.
Definition type.h:135
Range.
Definition type.h:143
Data Source Identifier (aka SAC/SIC).
Definition type.h:36
Speed.
Definition type.h:169
Squawk (aka Mode-3/A Code).
Definition type.h:86
Time of day.
Definition type.h:44
Track Number.
Definition type.h:79
Definition uap.h:42
Vertical Rate.
Definition type.h:194
WGS-84 2D Coordinate.
Definition type.h:109
Type defination for general data types.
ASTERIX User Application Profile (UAP).