Implementation of Datarecord concept defined by ASTERIX. More...
#include "category.h"
#include "uap.h"
#include "fspec.h"
#include "dataitem.h"
#include "match.h"
#include "type.h"
Go to the source code of this file.
Data Structures | |
struct | ast_datarecord_t |
Datarecord. More... | |
struct | ast_datarecord_ex_t |
Extracted datarecord. More... | |
struct | ast_datarecord_modifier_t |
Datarecord modifier. More... | |
Macros | |
#define | AST_MAX_DATAITEMS 32 |
#define | AST_DATARECORD_HEX_HTML_PREFERED_CHARS (AST_MAX_DATAITEMS * AST_MAX_DATAITEM_SIZE * 12 + 128) |
Prefered number of chars of datarecord hexadecimal HTML snippet. More... | |
#define | AST_DATARECORD_DETAIL_HTML_PREFERED_CHARS 20480 |
Prefered number of chars of data item detail description HTML snippet. More... | |
#define | AST_KEYSTR_PREFERRED_CHARS 25 |
Prefered number of chars of keyword string. More... | |
Functions | |
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. More... | |
ast_datarecord_t | ast_datarecord_encode (unsigned char *const buffer, const size_t bufsize, const ast_datarecord_ex_t xdr) |
Datarecord encode function. More... | |
ast_datarecord_t | ast_datarecord_copy (unsigned char *buffer, const size_t bufsize, const ast_datarecord_t src) |
Datarecord copy function. More... | |
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 modiy function. More... | |
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. More... | |
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 dataitem. More... | |
bool | ast_datarecord_contain_keyword (const ast_datarecord_t dr, const ast_keyword_t keyword) |
Check if datarecord contains specified keywork type. More... | |
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. More... | |
bool | ast_datarecord_get_keyword (char *keystr, const size_t keystr_size, const ast_datarecord_t dr, const ast_keyword_t keyword) |
Get keyword summary string from specified datarecord. More... | |
ast_sacsic_t | ast_datarecord_get_sacsic (const ast_datarecord_t dr) |
Get SAC/SIC from specified datarecord. More... | |
ast_timeofday_t | ast_datarecord_get_timeofday (const ast_datarecord_t dr) |
Get time of day from specified datarecord. More... | |
ast_msgtype_t | ast_datarecord_get_msgtype (const ast_datarecord_t dr) |
Get message type from specified datarecord. More... | |
ast_tracknum_t | ast_datarecord_get_tracknum (const ast_datarecord_t dr) |
Get track number from specified datarecord. More... | |
ast_squawk_t | ast_datarecord_get_squawk (const ast_datarecord_t dr) |
Get Mode-3/A code from specified datarecord. More... | |
ast_callsign_t | ast_datarecord_get_callsign (const ast_datarecord_t dr) |
Get callsign from specified datarecord. More... | |
ast_icaoaddr_t | ast_datarecord_get_icaoaddr (const ast_datarecord_t dr) |
Get ICAO 24-bit address from specified datarecord. More... | |
ast_coordinate_t | ast_datarecord_get_coordinate (const ast_datarecord_t dr) |
Get WGS-84 coordinate from specified datarecord. More... | |
ast_altitude_t | ast_datarecord_get_flightlevel (const ast_datarecord_t dr) |
Get flight level from specified datarecord. More... | |
ast_polar_coordinate_t | ast_datarecord_get_polarcoord (const ast_datarecord_t dr) |
Get polar coordinate from specified datarecord. More... | |
ast_heading_t | ast_datarecord_get_heading (const ast_datarecord_t dr) |
Get heading from specified datarecord. More... | |
ast_speed_t | ast_datarecord_get_speed (const ast_datarecord_t dr) |
Get speed from specified datarecord. More... | |
Implementation of Datarecord concept defined by ASTERIX.
#define AST_DATARECORD_DETAIL_HTML_PREFERED_CHARS 20480 |
Prefered number of chars of data item detail description HTML snippet.
#define AST_DATARECORD_HEX_HTML_PREFERED_CHARS (AST_MAX_DATAITEMS * AST_MAX_DATAITEM_SIZE * 12 + 128) |
Prefered number of chars of datarecord hexadecimal HTML snippet.
#define AST_KEYSTR_PREFERRED_CHARS 25 |
Prefered number of chars of keyword string.
#define AST_MAX_DATAITEMS 32 |
bool ast_datarecord_contain_keyword | ( | const ast_datarecord_t | dr, |
const ast_keyword_t | keyword | ||
) |
Check if datarecord contains specified keywork type.
dr | datarecord to check |
keyword | keyword type |
ast_datarecord_t ast_datarecord_copy | ( | unsigned char * | buffer, |
const size_t | bufsize, | ||
const ast_datarecord_t | src | ||
) |
Datarecord copy function.
buffer | Buffer to write destination datarecord data |
bufsize | Buffer size |
src | Original data record, must be valid |
This function will copy original data record, to specified buffer. If all fields in data record has been successfully copied, the returned datarecord will be marked as "valid". If any error occurs, the returned datarecord will be marked as "invalid".
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.
buffer | Buffer to read datarecord data |
bufsize | Buffer size |
category | Data category |
uap | User application profile (UAP) used to decode data |
This function will read and check data against specified uap, and return decoded datarecord. If data can be successfully decoded, the returned datarecord will be marked as "valid". If any error occurs, the returned datarecord will be marked as "invalid".
ast_datarecord_t ast_datarecord_encode | ( | unsigned char *const | buffer, |
const size_t | bufsize, | ||
const ast_datarecord_ex_t | xdr | ||
) |
Datarecord encode function.
buffer | Buffer to write encoded datarecord data |
bufsize | Buffer size |
xdr | Extracted datarecord container |
This function will check dataitems contained in xdr, encode them and write encoded data to buffer. If all data items are successfully encoded, the returned datarecord will be marked as "valid". If any error occurs, the returned datarecord will be marked as "invalid".
ast_callsign_t ast_datarecord_get_callsign | ( | const ast_datarecord_t | dr | ) |
Get callsign from specified datarecord.
dr | datarecord to get |
ast_coordinate_t ast_datarecord_get_coordinate | ( | const ast_datarecord_t | dr | ) |
Get WGS-84 coordinate from specified datarecord.
dr | datarecord to get |
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 dataitem.
detail | Buffer to save the html snippet |
detail_size | Buffer size |
dr | Datarecord |
The returned html fragment contains only basic elements used in html body, such as <br/> <h> <table>....
This function will return only semantics markups, some elements will cantaion class name, and it's recomanded the libary user to use CSS to format the html style.
ast_altitude_t ast_datarecord_get_flightlevel | ( | const ast_datarecord_t | dr | ) |
Get flight level from specified datarecord.
dr | datarecord to get |
ast_heading_t ast_datarecord_get_heading | ( | const ast_datarecord_t | dr | ) |
Get heading from specified datarecord.
dr | datarecord to get |
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.
The returned text will be an html table with data in the cells.
ast_icaoaddr_t ast_datarecord_get_icaoaddr | ( | const ast_datarecord_t | dr | ) |
Get ICAO 24-bit address from specified datarecord.
dr | datarecord to get |
bool ast_datarecord_get_keyword | ( | char * | keystr, |
const size_t | keystr_size, | ||
const ast_datarecord_t | dr, | ||
const ast_keyword_t | keyword | ||
) |
Get keyword summary string from specified datarecord.
keystr | the summary string of specified keyword value |
keystr_size | the buffer size of keystr |
dr | datarecord to get |
keyword | keyword type |
For different keyword, the summary string will include:
ast_msgtype_t ast_datarecord_get_msgtype | ( | const ast_datarecord_t | dr | ) |
Get message type from specified datarecord.
dr | datarecord to get |
ast_polar_coordinate_t ast_datarecord_get_polarcoord | ( | const ast_datarecord_t | dr | ) |
Get polar coordinate from specified datarecord.
dr | datarecord to get |
ast_sacsic_t ast_datarecord_get_sacsic | ( | const ast_datarecord_t | dr | ) |
Get SAC/SIC from specified datarecord.
dr | datarecord to get |
ast_speed_t ast_datarecord_get_speed | ( | const ast_datarecord_t | dr | ) |
Get speed from specified datarecord.
dr | datarecord to get |
ast_squawk_t ast_datarecord_get_squawk | ( | const ast_datarecord_t | dr | ) |
Get Mode-3/A code from specified datarecord.
dr | datarecord to get |
ast_timeofday_t ast_datarecord_get_timeofday | ( | const ast_datarecord_t | dr | ) |
Get time of day from specified datarecord.
dr | datarecord to get |
ast_tracknum_t ast_datarecord_get_tracknum | ( | const ast_datarecord_t | dr | ) |
Get track number from specified datarecord.
dr | datarecord to get |
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.
dr | datarecord to match |
keyword | type of keyword |
challenge | c string of keyword |
case_sensitive | case sensitive |
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 modiy function.
buffer | Buffer to write modified datarecord data |
bufsize | Buffer size |
src | Original data record, must be valid |
mod | Data item modifier |
This function will modify the original data record, according to data item modifier, and write modified data into buffer. For data items not specified by data modifier, the original one will be copied as is. If all data items can be successfully modifed, the returned datarecord will be marked as "valid". If any error occurs, the returned datarecord will be marked as "invalid".