This example program shows how to use libasterix.In this example we use decode, match, modify and encode functions to manipulate ASTERIX data. More details about this example.
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef WINDOWS
#include <windows.h>
#endif
unsigned char cat048_sample_data[] =
{
0x30, 0x00, 0x43, 0xff, 0xf7, 0x02, 0x20, 0x1b, 0x24, 0xd9, 0x35, 0xa0, 0x45, 0x18, 0x8e, 0x44,
0x20, 0xa3, 0x04, 0x69, 0xe0, 0x28, 0x05, 0xb8, 0x8a, 0x03, 0x80, 0x30, 0xe2, 0x77, 0xc7, 0x38,
0x20, 0x03, 0xbe, 0x80, 0x00, 0x30, 0xa8, 0x00, 0x00, 0x40, 0xff, 0xd8, 0xb7, 0x39, 0x60, 0x04,
0xe7, 0x50, 0xc5, 0xea, 0x51, 0x2f, 0x22, 0x1c, 0x45, 0x60, 0x00, 0x10, 0x07, 0xeb, 0x8b, 0x09,
0x46, 0x20, 0xf6
};
unsigned char cat062_sample_data[] =
{
0x3E, 0x09, 0x4F, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x4C, 0xFF, 0xAB,
0x2B, 0x7D, 0xFF, 0x6E, 0x16, 0x29, 0x00, 0x98, 0xDE, 0xF7, 0x03, 0x47, 0xFF, 0x20, 0xFD, 0xD1,
0x00, 0x01, 0x07, 0xC1, 0x0F, 0xEC, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00, 0x00, 0x08, 0x00, 0xC8,
0x00, 0xC8, 0xFF, 0x20, 0x84, 0xE8, 0xAB, 0x60, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03,
0x5D, 0xDE, 0x4E, 0xFF, 0xB4, 0x88, 0x5B, 0xFF, 0x74, 0x5F, 0xBE, 0x07, 0x56, 0xB5, 0x02, 0x14,
0x0D, 0xFF, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x01, 0x9A, 0x01, 0x01, 0x01, 0x50, 0x20,
0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x84, 0xE8, 0xAE, 0x48, 0xBF, 0xCF, 0xAD, 0x03,
0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x4F, 0xFF, 0xBE, 0x4A, 0x58, 0xFF, 0x84, 0x50, 0xD3, 0x19,
0x1C, 0x69, 0x0D, 0x01, 0x40, 0x00, 0xD0, 0xFF, 0xEF, 0x00, 0xFD, 0x05, 0x6A, 0x03, 0x8B, 0x01,
0x01, 0x01, 0x10, 0x60, 0x03, 0x00, 0x40, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x84, 0xE8, 0xAA,
0x40, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x50, 0xFF, 0xB5, 0xC0, 0x6E,
0xFF, 0x73, 0x86, 0x65, 0x06, 0x74, 0x66, 0x03, 0x8B, 0x30, 0xFE, 0xD3, 0xFC, 0xA2, 0x02, 0xFF,
0x07, 0xF0, 0x06, 0xC7, 0x01, 0x01, 0x01, 0x10, 0x60, 0x09, 0x00, 0x00, 0x05, 0xA0, 0x05, 0xA0,
0x00, 0x00, 0x84, 0xE8, 0xFB, 0x40, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE,
0x51, 0xFF, 0xB7, 0xD9, 0xB3, 0xFF, 0x78, 0x39, 0x0C, 0x0B, 0x92, 0x1D, 0x05, 0xEC, 0x90, 0x02,
0x15, 0x02, 0x93, 0x00, 0xFE, 0x06, 0xCA, 0x11, 0xE4, 0x01, 0x01, 0x01, 0x10, 0x60, 0x07, 0x00,
0x00, 0x04, 0xD8, 0x04, 0xD8, 0x00, 0x00, 0x84, 0xE8, 0x90, 0x40, 0xBF, 0xCF, 0xAD, 0x03, 0x00,
0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x52, 0xFF, 0xBE, 0x0B, 0x44, 0xFF, 0x7A, 0x86, 0x02, 0x0E, 0x4F,
0xA8, 0x0D, 0x36, 0xAF, 0xFF, 0xFC, 0x00, 0xC2, 0xFD, 0x00, 0x04, 0x00, 0x00, 0x38, 0x01, 0x01,
0x01, 0x10, 0x60, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0xFF, 0xF4, 0x84, 0xE8, 0xE3, 0x60,
0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x52, 0xFF, 0xC3, 0xDB, 0x8C, 0xFF,
0x66, 0x16, 0xA1, 0xF7, 0xB4, 0xF0, 0x14, 0x4C, 0x0D, 0xFE, 0x76, 0x00, 0x2B, 0x01, 0x02, 0x07,
0x5F, 0x06, 0x29, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xA4, 0xE8, 0xE6, 0x00, 0x6E, 0x60, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D,
0xDE, 0x54, 0xFF, 0xB1, 0x8A, 0xB5, 0xFF, 0x75, 0x76, 0xDB, 0x08, 0x6D, 0x12, 0xFE, 0x7F, 0x89,
0x01, 0x37, 0xFF, 0x44, 0x00, 0x01, 0x07, 0x01, 0x08, 0xA1, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00,
0x00, 0x00, 0x00, 0x74, 0x00, 0x74, 0xFF, 0xCB, 0x84, 0xE8, 0xB4, 0x60, 0xBF, 0xCF, 0xAD, 0x03,
0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x57, 0xFF, 0xBF, 0x52, 0x5E, 0xFF, 0x79, 0x7A, 0x0D, 0x0D,
0x34, 0xE2, 0x0E, 0xC5, 0x98, 0xFF, 0x62, 0x00, 0x0C, 0x01, 0x00, 0x04, 0x00, 0x0B, 0x56, 0x01,
0x01, 0x01, 0x10, 0x60, 0x00, 0x00, 0x00, 0x00, 0x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 0x4C, 0xFF, 0x51, 0x00, 0xB4, 0x02, 0xFE,
0x00, 0x40, 0x05, 0xEB, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x84,
0x00, 0x00, 0x84, 0xE8, 0xE2, 0x60, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE,
0x60, 0xFF, 0xC0, 0x37, 0x11, 0xFF, 0x79, 0xCA, 0x8E, 0x0D, 0x96, 0x5F, 0x0F, 0xD3, 0x18, 0xFE,
0xFD, 0x02, 0x3D, 0xFB, 0x03, 0x09, 0xA5, 0x0A, 0xD1, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00, 0x00,
0x00, 0x03, 0x64, 0x03, 0x64, 0x00, 0x13, 0x84, 0xE8, 0xE3, 0x60, 0xBF, 0xCF, 0xAD, 0x03, 0x00,
0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x61, 0xFF, 0xB2, 0xC6, 0xAC, 0xFF, 0x5A, 0x32, 0x7B, 0xEB, 0x73,
0x64, 0xFF, 0x81, 0x91, 0x03, 0xF6, 0x01, 0xB4, 0xFF, 0x01, 0x0A, 0xFB, 0x0A, 0xCA, 0x01, 0x01,
0x01, 0x10, 0x60, 0x07, 0x00, 0x00, 0x06, 0x18, 0x06, 0x18, 0x00, 0x00, 0xA4, 0xE8, 0xAC, 0x06,
0x37, 0x40, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x61, 0xFF, 0xB2, 0xFD,
0x1A, 0xFF, 0x75, 0x78, 0x27, 0x08, 0x78, 0x3E, 0x00, 0x37, 0xF4, 0x00, 0xDC, 0xFF, 0xC9, 0xFF,
0x05, 0x04, 0x00, 0x12, 0xBB, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00, 0x0D, 0x80, 0x00, 0x54, 0x00,
0x54, 0x00, 0x00, 0x84, 0xE8, 0xAD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2, 0xFA, 0x02, 0x08, 0x42, 0x0A, 0xBE, 0x01, 0x01, 0x01, 0x10, 0x60, 0x00, 0x00, 0x00, 0x06,
0x40, 0x06, 0x40, 0x00, 0x00, 0x84, 0xE8, 0xA0, 0x60, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C,
0x03, 0x5D, 0xDE, 0x64, 0xFF, 0xCF, 0xE7, 0xFD, 0xFF, 0x69, 0x8C, 0xE3, 0xFB, 0x70, 0x38, 0x22,
0xBB, 0x17, 0x02, 0x9F, 0xFD, 0x6F, 0x09, 0xFA, 0x0C, 0xD7, 0x08, 0x22, 0x01, 0x01, 0x01, 0x10,
0x60, 0x0C, 0x00, 0x10, 0x05, 0x78, 0x05, 0x78, 0x00, 0x00, 0x84, 0xE8, 0xB1, 0x40, 0xBF, 0xCF,
0xAD, 0x33, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x66, 0xFF, 0xB7, 0xE3, 0xDF, 0xFF, 0x68, 0xF9,
0x44, 0xFB, 0x19, 0x46, 0x06, 0x1B, 0xD6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x6F, 0x09,
0x24, 0x41, 0x01, 0x01, 0x50, 0x20, 0x00, 0x40, 0x06, 0x78, 0x06, 0x78, 0x00, 0x00, 0x08, 0x0E,
0xC0, 0x04, 0x92, 0x84, 0xE8, 0x90, 0x44, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D,
0xDE, 0x66, 0xFF, 0xC4, 0x7B, 0xB9, 0xFF, 0x6E, 0xA5, 0x54, 0x01, 0x45, 0x0F, 0x15, 0x1E, 0x0F,
0x01, 0x19, 0xFF, 0xA0, 0x00, 0x00, 0x04, 0x00, 0x08, 0x60, 0x01, 0x01, 0x01, 0x10, 0x60, 0x18,
0x18, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0x00, 0x84, 0xE8, 0xA1, 0x60, 0xBF, 0xCF, 0xAD, 0x03,
0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x66, 0xFF, 0xC5, 0x41, 0x00, 0xFF, 0x8C, 0xC4, 0xE5, 0x23,
0x1A, 0xE4, 0x14, 0xAC, 0x87, 0xFF, 0x15, 0xFF, 0x2F, 0x00, 0x00, 0x00, 0x6B, 0x04, 0x75, 0x01,
0x01, 0x01, 0x10, 0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x84, 0x00, 0x41, 0x84, 0xE8, 0x9D,
0x60, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE, 0x67, 0xFF, 0xB5, 0x41, 0x88,
0xFF, 0x6D, 0xE0, 0xE8, 0x00, 0x64, 0xCC, 0x03, 0x01, 0xE3, 0xFD, 0x2E, 0xFE, 0x45, 0x0A, 0xE5,
0x07, 0xBF, 0x01, 0x9B, 0x01, 0x01, 0x01, 0x10, 0x60, 0x16, 0x00, 0x90, 0x06, 0x40, 0x06, 0x40,
0x00, 0x00, 0x84, 0xE8, 0x90, 0x40, 0xBF, 0x8F, 0x8D, 0x03, 0x00, 0xE8, 0x3C, 0x03, 0x5D, 0xDE,
0x67, 0xFF, 0xA6, 0x49, 0x1C, 0xFF, 0x6B, 0x18, 0xE2, 0xFD, 0x89, 0x59, 0xF1, 0x30, 0x33, 0x00,
0x32, 0xFF, 0xCD, 0x00, 0x00, 0x01, 0x74, 0x01, 0x01, 0x01, 0x30, 0x40, 0x14, 0x0C, 0x00, 0x28,
0x00, 0x00, 0xA4, 0xE8, 0xB2, 0x01, 0x41, 0x20, 0xBF, 0xCF, 0xAD, 0x03, 0x00, 0xE8, 0x3C, 0x03,
0x5D, 0xDE, 0x67, 0xFF, 0xB3, 0xCA, 0x8B, 0xFF, 0x69, 0xFD, 0x66, 0xFC, 0x3E, 0x4A, 0x01, 0x3F,
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x92, 0x05, 0x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, 0xA3, 0x07, 0x11, 0x2A,
0x04, 0x6C, 0x29, 0x00, 0x69, 0xFF, 0x0D, 0x03, 0xFF, 0x00, 0xC1, 0x08, 0xAE, 0x01, 0x01, 0x01,
0x10, 0x60, 0x07, 0x00, 0x00, 0x00, 0xC8, 0x00, 0xC8, 0xFF, 0xFF, 0x84, 0xE8, 0x90, 0x40,
};
void example_decode(void)
{
{
{
printf("Data record: %i\n", i);
{
printf(" Data item: %2i\n", j);
printf(
" SIZE: %02zu\n", di.
size);
printf(" DESC: %s\n", summary);
printf(" DATA: %s\n", hexstr);
printf("\n");
}
}
}
else
{
printf("Failed to decode datablock!\n");
}
}
void example_match(void)
{
{
{
printf("Data record: %i\n", i);
{
printf(" Key:%s\t", key);
printf("Value:%s\n", value);
else
printf("Value:NOT_EXIST\n");
}
}
}
else
{
printf("Failed to decode datablock!\n");
}
}
void example_modify(void)
{
{
printf("New SAC\\SIC = 109\\250\n");
printf("Original Data:\n");
for(
size_t i = 0; i < db.
size; ++i)
{
printf(
"%.2X ", db.
data[i]);
if((i + 1) % 16 == 0)
printf("\n");
}
printf("\n");
{
.sac = 109,
.sic = 250,
};
{
.data = (void*) &ddi,
};
{
};
unsigned char buffer[256];
{
printf("Modified Data:\n");
for(
size_t i = 0; i < db_new.
size; ++i)
{
printf(
"%.2X ", db_new.
data[i]);
if((i + 1) % 16 == 0)
printf("\n");
}
printf("\n");
}
else
{
printf("Failed to modify datablcok\n");
}
}
else
{
printf("Failed to decode datablock!\n");
}
}
void example_encode(void)
{
{
.sac = 109,
.sic = 250,
};
{
.data = (void*) &ddi_021_010,
};
time_t now;
time(&now);
struct tm * tm_now = gmtime(&now);
{
.raw_time = 0,
.hour = tm_now->tm_hour,
.min = tm_now->tm_min,
.sec = tm_now->tm_sec,
.msec = 0,
};
{
.data = (void*) &ddi_021_030,
};
{
.diff_correction = false,
.ground = false,
.simulated = false,
.test = false,
.fixed_transponder = false,
.selected_altitude_capability = true,
.spi = false,
};
{
.data = (void*) &ddi_021_040,
};
{
.icao_address = 0x7E7E7E,
};
{
.data = (void*) &ddi_021_080,
};
{
.latitude = 38.02,
.longitude = 105.57,
};
{
.data = (void*) &ddi_021_130,
};
{
.raw_level = 310 * 4,
};
{
.data = (void*) &ddi_021_145,
};
unsigned char buffer[256];
{
printf("New Data Block:\n");
for(
size_t i = 0; i < db.
size; ++i)
{
printf(
"%.2X ", db.
data[i]);
if((i + 1) % 16 == 0)
printf("\n");
}
printf("\n");
}
else
{
printf("Failed to encode datablock!\n");
}
}
int main(void)
{
printf("libasterix Example Program Start\n");
char key [256];
printf ("Input your license key: ");
fgets(key, sizeof(key), stdin);
printf("\n");
example_decode();
example_match();
example_modify();
example_encode();
return 0;
}