#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
if(argc != 4 || 0 == strncmp(argv[1], "-h", 3) || 0 == strncmp(argv[1], "--help", 7)) {
printf("Usage: example_flight_read_raster [-h] <edb file> <raster number> <pulse number>\n");
printf("Example of reading pulse data using eaarlio_flight\n");
printf("\n");
printf(" -h, --help display this help and exit\n");
printf(" <edb file> EDB file for dataset\n");
printf(" <raster number> raster number to read\n");
printf(" <pulse number> pulse number to read\n");
return 1;
}
char const *edb_file = argv[1];
int raster_number = atoi(argv[2]);
uint16_t pulse_number = (uint16_t)atoi(argv[3]);
int failed;
int i, j;
int channels;
int include_pulses = 1;
int include_waveforms = 1;
if(failed)
return 1;
raster_number, include_pulses, include_waveforms);
if(failed)
return 1;
printf("raster_number: %d\n", raster_number);
printf(
"digitizer: %" PRIu8
"\n", raster.
digitizer);
printf(
"pulse_count: %" PRIu16
"\n", raster.
pulse_count);
printf("edb_time_offset: %" PRIi32 "\n", time_offset);
if(pulse_number < 1 || pulse_number > raster.
pulse_count) {
printf("Requested pulse number %d is out of range\n", pulse_number);
return 1;
}
printf("\n");
printf("pulse_number: %" PRIu16 "\n", pulse_number);
pulse = &raster.
pulse[pulse_number - 1];
printf(
"time_offset: %" PRIu32
"\n", pulse->
time_offset);
printf(
"range: %" PRIu16
"\n", pulse->
range);
printf(
"rx_count: %" PRIu8
"\n", pulse->
rx_count);
printf(
"thresh_tx: %" PRIu8
"\n", pulse->
thresh_tx);
printf(
"thresh_rx: %" PRIu8
"\n", pulse->
thresh_rx);
printf(
"bias_tx: %" PRIu8
"\n", pulse->
bias_tx);
printf("bias_rx: %" PRIu8 " %" PRIu8 " %" PRIu8 " %" PRIu8 "\n",
printf("\n");
printf("tx:");
for(i = 0; i < pulse->
tx_len; i++) {
printf(
" %d", pulse->
tx[i]);
}
printf("\n");
for(j = 0; j < channels; j++) {
printf("rx, channel %d:", j + 1);
for(i = 0; i < pulse->
rx_len[j]; i++) {
printf(
" %d", pulse->
rx[j][i]);
}
printf("\n");
}
pulse = NULL;
if(failed)
return 1;
failed =
if(failed)
return 1;
return 0;
}