cat240.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
29
62
63#ifndef LIBASTERIX_CAT240_H
64#define LIBASTERIX_CAT240_H
65
66#include "dataitem.h"
67#include "datarecord.h"
68#include "cat_generic.h"
69
70#ifdef __cplusplus
71extern "C" {
72#endif
73
74// Data Item
75
82
103
107typedef enum _ast_video_message_type_t
108{
112
115
117#define ast_dataitem_240_000_get_size ast_dataitem_message_type_get_size
118
120#define ast_dataitem_240_000_decode ast_dataitem_message_type_decode
121
123#define ast_dataitem_240_000_encode ast_dataitem_message_type_encode
124
131AST_API void ast_dataitem_240_000_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
132
134#define ast_dataitem_240_000_get_detail_html ast_dataitem_get_detail_html_dummy
135 /* end of group di_240_000 */
137
138
157
160
162#define ast_dataitem_240_010_get_size ast_dataitem_data_source_identifier_get_size
163
165#define ast_dataitem_240_010_decode ast_dataitem_data_source_identifier_decode
166
168#define ast_dataitem_240_010_encode ast_dataitem_data_source_identifier_encode
169
171#define ast_dataitem_240_010_get_summary ast_dataitem_data_source_identifier_get_summary
172
174#define ast_dataitem_240_010_get_detail_html ast_dataitem_data_source_identifier_get_detail_html
175 /* end of group di_240_010 */
177
178
196
200typedef struct _ast_dataitem_240_020_t
201{
202 bool valid;
203 unsigned int msg_index;
205
207#define ast_dataitem_240_020_get_size ast_dataitem_get_size_fixed_4_byte
208
215
217
224AST_API void ast_dataitem_240_020_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
225
227#define ast_dataitem_240_020_get_detail_html ast_dataitem_get_detail_html_dummy
228 /* end of group di_240_020 */
230
231
251
253#define AST_VIDEO_SUMMARY_MAX_CHARS 257
254
258typedef struct _ast_dataitem_240_030_t
259{
260 bool valid;
261 unsigned int num_chars;
264
266#define ast_dataitem_240_030_get_size ast_dataitem_get_size_rep_1_byte
267
274
276
283AST_API void ast_dataitem_240_030_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
284
291AST_API void ast_dataitem_240_030_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
292 /* end of group di_240_030 */
294
295
317
320
322#define ast_dataitem_240_040_get_size ast_dataitem_video_header_get_size
323
330
337AST_API void ast_dataitem_240_040_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
338
345AST_API void ast_dataitem_240_040_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
346 /* end of group di_240_040 */
348
349
371
374
376#define ast_dataitem_240_041_get_size ast_dataitem_video_header_get_size
377
384
391AST_API void ast_dataitem_240_041_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
392
399AST_API void ast_dataitem_240_041_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
400 /* end of group di_240_041 */
402
403
423
440
447
451typedef struct _ast_dataitem_240_048_t
452{
453 bool valid;
457
459#define ast_dataitem_240_048_get_size ast_dataitem_get_size_fixed_2_byte
460
467
474AST_API void ast_dataitem_240_048_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
475
482AST_API void ast_dataitem_240_048_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
483 /* end of group di_240_048 */
485
486
506
510typedef struct _ast_dataitem_240_049_t
511{
512 bool valid;
513 unsigned int num_valid_octets;
514 unsigned int num_valid_cells;
516
518#define ast_dataitem_240_049_get_size ast_dataitem_get_size_fixed_5_byte
519
526
533AST_API void ast_dataitem_240_049_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
534
541AST_API void ast_dataitem_240_049_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
542 /* end of group di_240_049 */
544
545
565
569typedef struct _ast_dataitem_240_050_t
570{
571 bool valid;
572 size_t video_size;
573 const unsigned char* video;
575
577#define ast_dataitem_240_050_get_size ast_dataitem_get_size_rep_4_byte
578
585
592AST_API void ast_dataitem_240_050_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
593
600AST_API void ast_dataitem_240_050_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
601 /* end of group di_240_050 */
603
604
624
628typedef struct _ast_dataitem_240_051_t
629{
630 bool valid;
631 size_t video_size;
632 const unsigned char* video;
634
636#define ast_dataitem_240_051_get_size ast_dataitem_get_size_rep_64_byte
637
644
651AST_API void ast_dataitem_240_051_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
652
659AST_API void ast_dataitem_240_051_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
660 /* end of group di_240_051 */
662
663
683
687typedef struct _ast_dataitem_240_052_t
688{
689 bool valid;
690 size_t video_size;
691 const unsigned char* video;
693
695#define ast_dataitem_240_052_get_size ast_dataitem_get_size_rep_256_byte
696
703
710AST_API void ast_dataitem_240_052_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
711
718AST_API void ast_dataitem_240_052_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
719 /* end of group di_240_052 */
721
722
740
743
745#define ast_dataitem_240_140_get_size ast_dataitem_time_of_day_get_size
746
748#define ast_dataitem_240_140_decode ast_dataitem_time_of_day_decode
749
751#define ast_dataitem_240_140_encode ast_dataitem_time_of_day_encode
752
754#define ast_dataitem_240_140_get_summary ast_dataitem_time_of_day_get_summary
755
757#define ast_dataitem_240_140_get_detail_html ast_dataitem_time_of_day_get_detail_html
758 /* end of group di_240_140 */
760
761
772
774#define ast_dataitem_240_REF_get_size ast_dataitem_reserved_expansion_field_get_size
775
777//ast_dataitem_240_REF_t ast_dataitem_240_REF_decode(const ast_dataitem_t di);
778
780#define ast_dataitem_240_REF_get_summary ast_dataitem_reserved_expansion_field_get_summary
781
783#define ast_dataitem_240_REF_get_detail_html ast_dataitem_reserved_expansion_field_get_detail_html
784 /* end of group di_240_REF */
786
787
800
802#define ast_dataitem_240_SPF_get_size ast_dataitem_special_purpose_field_get_size
803
805//ast_dataitem_240_SPF_t ast_dataitem_240_SPF_decode(const ast_dataitem_t di);
806
808#define ast_dataitem_240_SPF_get_summary ast_dataitem_special_purpose_field_get_summary
809
811#define ast_dataitem_240_SPF_get_detail_html ast_dataitem_special_purpose_field_get_detail_html
812 /* end of group di_240_SPF */
814
815
816// Data Record
817
825
844
851
852// Assemble function
853//AST_API ast_datarecord_t ast_datarecord_240_assemble(unsigned char* const buffer, const size_t bufsize, const ast_datarecord_240_t dr, const ast_uap_t uap);
854
879
888typedef struct _ast_videovector_t
889{
890 bool valid;
892
893 double start_angle;
894 double end_angle;
896 double cell_length;
897 double start_range;
898 unsigned int start_range_cells;
899 unsigned int msg_index;
901
903 unsigned int max_amplitude;
904 size_t n_cells;
905 unsigned int* amplitudes;
907
940AST_API ast_videovector_t ast_datarecord_240_get_vector(const ast_datarecord_240_t dr, unsigned int* amplitude_buffer, const size_t amplitude_buffer_size);
941
948
955
962
964#define ast_datarecord_240_get_tracknum 0
965
967#define ast_datarecord_240_get_squawk 0
968
970#define ast_datarecord_240_get_callsign 0
971
973#define ast_datarecord_240_get_icaoaddr 0
974
976#define ast_datarecord_240_get_coordinate 0
977
979#define ast_datarecord_240_get_flightlevel 0
980
982#define ast_datarecord_240_get_polarcoord 0
983
985#define ast_datarecord_240_get_heading 0
986
988#define ast_datarecord_240_get_speed 0
989
991#define ast_datarecord_240_get_selaltitude 0
992
994#define ast_datarecord_240_get_cartesianvel 0
995
997#define ast_datarecord_240_get_vrate 0
998 /* end of group dr_240 */
1000
1001#ifdef __cplusplus
1002 }
1003#endif // extern "C"
1004
1005#endif //LIBASTERIX_CAT240_H
1006
1007// vim:set ft=c.doxygen sw=2 sts=2 fenc=utf8:
const char * ast_dataitem_240_get_name(const ast_dataitem_type_t type)
Get name of a CAT240 data item type.
ASTERIX generic data items shared by multiple categories.
ASTERIX data item.
ASTERIX data record.
void ast_dataitem_240_000_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/000.
ast_video_message_type_t
Video message type enumeration.
Definition cat240.h:108
ast_dataitem_message_type_t ast_dataitem_240_000_t
Data Item I240/000 - Message Type.
Definition cat240.h:114
@ AST_VIDEO_SUMMARY
Video Summary message.
Definition cat240.h:109
@ AST_VIDEO_MESSAGE
Video Message containing radar video data.
Definition cat240.h:110
ast_dataitem_data_source_identifier_t ast_dataitem_240_010_t
Data Item I240/010 - Data Source Identifier.
Definition cat240.h:159
ast_dataitem_240_020_t ast_dataitem_240_020_decode(const ast_dataitem_t di)
Decode I240/020 Video Record Header.
void ast_dataitem_240_020_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Encode function (not implemented).
void ast_dataitem_240_030_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Encode function (not implemented).
void ast_dataitem_240_030_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/030.
#define AST_VIDEO_SUMMARY_MAX_CHARS
Maximum number of characters in video summary.
Definition cat240.h:253
ast_dataitem_240_030_t ast_dataitem_240_030_decode(const ast_dataitem_t di)
Decode I240/030 Video Summary.
ast_dataitem_video_header_t ast_dataitem_240_040_t
Data Item I240/040 - Video Header Nano.
Definition cat240.h:319
ast_dataitem_video_header_t ast_dataitem_240_040_decode(const ast_dataitem_t di)
Decode I240/040 Video Header Nano.
void ast_dataitem_240_040_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/040.
void ast_dataitem_240_040_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/040.
void ast_dataitem_240_041_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/041.
void ast_dataitem_240_041_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/041.
ast_dataitem_video_header_t ast_dataitem_240_041_t
Data Item I240/041 - Video Header Femto.
Definition cat240.h:373
ast_dataitem_video_header_t ast_dataitem_240_041_decode(const ast_dataitem_t di)
Decode I240/041 Video Header Femto.
ast_video_resolution_type_t
Video Resolution Type enumeration.
Definition cat240.h:431
void ast_dataitem_240_048_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/048.
unsigned int ast_video_resolution_bits(const ast_video_resolution_type_t t)
Get number of bits for a video resolution type.
ast_dataitem_240_048_t ast_dataitem_240_048_decode(const ast_dataitem_t di)
Decode I240/048 Video Cells Resolution.
void ast_dataitem_240_048_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/048.
@ AST_VIDEO_RES_MONO
Monochrome (1 bit per cell).
Definition cat240.h:433
@ AST_VIDEO_RES_MEDIUM
Medium resolution (4 bits per cell).
Definition cat240.h:435
@ AST_VIDEO_RES_ULTRA_HIGH
Ultra high resolution (32 bits per cell).
Definition cat240.h:438
@ AST_VIDEO_RES_VERY_HIGH
Very high resolution (16 bits per cell).
Definition cat240.h:437
@ AST_VIDEO_RES_UNDEFINED
Undefined resolution.
Definition cat240.h:432
@ AST_VIDEO_RES_HIGH
High resolution (8 bits per cell).
Definition cat240.h:436
@ AST_VIDEO_RES_LOW
Low resolution (2 bits per cell).
Definition cat240.h:434
void ast_dataitem_240_049_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/049.
ast_dataitem_240_049_t ast_dataitem_240_049_decode(const ast_dataitem_t di)
Decode I240/049 Video Counters.
void ast_dataitem_240_049_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/049.
ast_dataitem_240_050_t ast_dataitem_240_050_decode(const ast_dataitem_t di)
Decode I240/050 Video Block Low.
void ast_dataitem_240_050_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/050.
void ast_dataitem_240_050_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/050.
void ast_dataitem_240_051_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/051.
void ast_dataitem_240_051_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/051.
ast_dataitem_240_051_t ast_dataitem_240_051_decode(const ast_dataitem_t di)
Decode I240/051 Video Block Medium.
void ast_dataitem_240_052_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detailed HTML for I240/052.
ast_dataitem_240_052_t ast_dataitem_240_052_decode(const ast_dataitem_t di)
Decode I240/052 Video Block High.
void ast_dataitem_240_052_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary string for I240/052.
ast_dataitem_time_of_day_t ast_dataitem_240_140_t
Data Item I240/140 - Time of Day.
Definition cat240.h:742
ast_dataitem_type_t
Definition of data item type in each category.
Definition dataitem.h:86
ast_sacsic_t ast_datarecord_240_get_sacsic(const ast_datarecord_t dr)
Get SAC/SIC from CAT240 data record.
ast_timeofday_t ast_datarecord_240_get_timeofday(const ast_datarecord_t dr)
Get time of day from CAT240 data record.
ast_datarecord_240_t ast_datarecord_240_disassemble(const ast_datarecord_t dr)
Disassemble CAT240 data record.
ast_videovector_t ast_datarecord_240_get_vector(const ast_datarecord_240_t dr, unsigned int *amplitude_buffer, const size_t amplitude_buffer_size)
Get the fully decoded video vector of a CAT240 data record.
ast_msgtype_t ast_datarecord_240_get_msgtype(const ast_datarecord_t dr)
Get message type from CAT240 data record.
ast_videovector_error_t
Video vector error codes.
Definition cat240.h:862
@ AST_VIDEOVECTOR_ERR_RESOLUTION_INVALID
I240/048 resolution is not a standard value [1-6].
Definition cat240.h:870
@ AST_VIDEOVECTOR_ERR_MSGTYPE_UNKNOWN
I240/000 absent or unknown message type.
Definition cat240.h:866
@ AST_VIDEOVECTOR_ERR_TRUNCATED_BLOCK
Video block REP claims more bytes than the item carries.
Definition cat240.h:875
@ AST_VIDEOVECTOR_ERR_BUFFER_TOO_SMALL
Caller cell buffer too small, n_cells holds the needed size.
Definition cat240.h:877
@ AST_VIDEOVECTOR_ERR_NO_VIDEO_HEADER
Neither I240/040 nor I240/041 present/valid.
Definition cat240.h:867
@ AST_VIDEOVECTOR_ERR_MSGTYPE_SUMMARY
I240/000 is a Video Summary message, no video payload.
Definition cat240.h:865
@ AST_VIDEOVECTOR_ERR_AMBIGUOUS_HEADER
Both I240/040 and I240/041 present (ICD allows only one).
Definition cat240.h:868
@ AST_VIDEOVECTOR_ERR_NO_RESOLUTION
I240/048 absent/invalid.
Definition cat240.h:869
@ AST_VIDEOVECTOR_OK
Vector decoded successfully.
Definition cat240.h:863
@ AST_VIDEOVECTOR_ERR_COMPRESSED
Compression indicator set, decompression not implemented.
Definition cat240.h:872
@ AST_VIDEOVECTOR_ERR_REP_EXCEEDED
I240/052 REP exceeds the maximum 254.
Definition cat240.h:876
@ AST_VIDEOVECTOR_ERR_RESOLUTION_UNSUPPORTED
Resolution is standard but not implemented (16/32-bits).
Definition cat240.h:871
@ AST_VIDEOVECTOR_ERR_NO_VIDEO_BLOCK
None of I240/050, I240/051, I240/052 present.
Definition cat240.h:873
@ AST_VIDEOVECTOR_ERR_RECORD_INVALID
Record is not a valid CAT240 data record.
Definition cat240.h:864
@ AST_VIDEOVECTOR_ERR_AMBIGUOUS_BLOCK
More than one video block item present.
Definition cat240.h:874
#define AST_API
Definition platform.h:63
Data Item I240/020 - Video Record Header structure.
Definition cat240.h:201
bool valid
Data validity flag.
Definition cat240.h:202
unsigned int msg_index
Message index for sequence tracking.
Definition cat240.h:203
Data Item I240/030 - Video Summary structure.
Definition cat240.h:259
char summary[257]
Summary text buffer.
Definition cat240.h:262
bool valid
Data validity flag.
Definition cat240.h:260
unsigned int num_chars
Number of characters in summary.
Definition cat240.h:261
Data Item I240/048 - Video Cells Resolution & Data Compression Indicator.
Definition cat240.h:452
ast_video_resolution_type_t resolution
Video resolution type.
Definition cat240.h:455
bool valid
Data validity flag.
Definition cat240.h:453
bool compression
Compression enabled flag.
Definition cat240.h:454
Data Item I240/049 - Video Octets & Video Cells Counters.
Definition cat240.h:511
bool valid
Data validity flag.
Definition cat240.h:512
unsigned int num_valid_cells
Number of valid video cells.
Definition cat240.h:514
unsigned int num_valid_octets
Number of valid octets in video data.
Definition cat240.h:513
Data Item I240/050 - Video Block Low Data Volume.
Definition cat240.h:570
const unsigned char * video
Video data, points into the source data block.
Definition cat240.h:573
size_t video_size
Size of video data in bytes.
Definition cat240.h:572
bool valid
Data validity flag.
Definition cat240.h:571
Data Item I240/051 - Video Block Medium Data Volume.
Definition cat240.h:629
size_t video_size
Size of video data in bytes.
Definition cat240.h:631
const unsigned char * video
Video data, points into the source data block.
Definition cat240.h:632
bool valid
Data validity flag.
Definition cat240.h:630
Data Item I240/052 - Video Block High Data Volume.
Definition cat240.h:688
size_t video_size
Size of video data in bytes.
Definition cat240.h:690
const unsigned char * video
Video data, points into the source data block.
Definition cat240.h:691
bool valid
Data validity flag.
Definition cat240.h:689
Data Item - Data Source Identifier.
Definition cat_generic.h:133
Data Item - Message Type.
Definition cat_generic.h:80
Dataitem.
Definition dataitem.h:515
Data Item - Time of Day.
Definition cat_generic.h:282
Data Item - Video Header.
Definition cat_generic.h:1211
Data Record I240 - Radar Video Transmission.
Definition cat240.h:828
ast_dataitem_240_140_t dataitem_240_140
I240/140 - Time of Day.
Definition cat240.h:842
ast_dataitem_240_040_t dataitem_240_040
I240/040 - Video Header Nano.
Definition cat240.h:835
ast_dataitem_240_000_t dataitem_240_000
I240/000 - Message Type.
Definition cat240.h:831
ast_dataitem_240_049_t dataitem_240_049
I240/049 - Video Octets & Video Cells Counters.
Definition cat240.h:838
ast_dataitem_240_051_t dataitem_240_051
I240/051 - Video Block Medium Data Volume.
Definition cat240.h:840
ast_dataitem_240_010_t dataitem_240_010
I240/010 - Data Source Identifier.
Definition cat240.h:832
ast_dataitem_240_030_t dataitem_240_030
I240/030 - Video Summary.
Definition cat240.h:834
bool valid
Data record validity flag.
Definition cat240.h:829
ast_dataitem_240_041_t dataitem_240_041
I240/041 - Video Header Femto.
Definition cat240.h:836
ast_dataitem_240_050_t dataitem_240_050
I240/050 - Video Block Low Data Volume.
Definition cat240.h:839
ast_dataitem_240_052_t dataitem_240_052
I240/052 - Video Block High Data Volume.
Definition cat240.h:841
ast_dataitem_240_020_t dataitem_240_020
I240/020 - Video Record Header.
Definition cat240.h:833
ast_dataitem_240_048_t dataitem_240_048
I240/048 - Video Cells Resolution & Data Compression Indicator.
Definition cat240.h:837
Datarecord.
Definition datarecord.h:61
Definition type.h:72
Data Source Identifier (aka SAC/SIC).
Definition type.h:36
Time of day.
Definition type.h:44
Fully decoded video vector of a CAT240 data record.
Definition cat240.h:889
unsigned int * amplitudes
Caller-provided amplitude buffer, points to amplitude_buffer on success.
Definition cat240.h:905
double cell_duration
Video cell duration, in seconds.
Definition cat240.h:895
unsigned int max_amplitude
Maximum amplitude value at the current resolution (2^bits - 1).
Definition cat240.h:903
ast_videovector_error_t error
Error code.
Definition cat240.h:891
double end_angle
End angle of the vector, in degrees; may be smaller than start_angle across north.
Definition cat240.h:894
double start_angle
Start angle of the vector, in degrees [0,360).
Definition cat240.h:893
ast_video_resolution_type_t resolution
Video resolution of the cells.
Definition cat240.h:902
unsigned int msg_index
I240/020 message index, 0 when absent.
Definition cat240.h:899
bool valid
True when error == AST_VIDEOVECTOR_OK.
Definition cat240.h:890
double cell_length
Video cell length, in meters (cell_duration * c / 2).
Definition cat240.h:896
double start_range
Start range of the first cell, in meters.
Definition cat240.h:897
unsigned int start_range_cells
Raw I240/040 start range, in number of cells.
Definition cat240.h:898
ast_timeofday_t tod
I240/140 time of day, tod.valid is false when absent.
Definition cat240.h:900
size_t n_cells
Number of cells in the vector, one entry per amplitudes buffer element.
Definition cat240.h:904