Пример #1
0
int main(int argc, char **argv)
{
    make_atan2_table();
    init_fec();
    read_from_stdin();
    return 0;
}
Пример #2
0
int main(int argc, char **argv)
{
    int i;
    uint8_t input[LONG_FRAME_BYTES];
    uint8_t expected[LONG_FRAME_DATA_BYTES];
    int all_ok = 1;

    init_fec();
    
    for (i = 0; downlink_tests[i].testname; ++i) {
        int rs_errors;
        int frametype;
        int ok = 1;

        fprintf(stderr, "%s: ", downlink_tests[i].testname);

        hex_to_bytes(downlink_tests[i].input, input);
        frametype = correct_adsb_frame(input, &rs_errors);
        if (frametype != downlink_tests[i].frametype) {
            fprintf(stderr, "FAIL: expected frametype %d, got frametype %d\n", downlink_tests[i].frametype, frametype);
            ok = 0;
        } else if (downlink_tests[i].expected) {
            hex_to_bytes(downlink_tests[i].expected, expected);
            if (memcmp(expected, input, (frametype == 2) ? LONG_FRAME_DATA_BYTES : SHORT_FRAME_DATA_BYTES) != 0) {
                fprintf(stderr, "FAIL: wrong corrected output\n");
                ok = 0;
            }
        }

        if (ok)
            fprintf(stderr, "PASS\n");
        else
            all_ok = 0;
    }
    
    return all_ok ? 0 : 1;
}
Пример #3
0
void init(CallBack cb)
{
    make_atan2_table();
    init_fec();
    userCB = cb;
}