int main(int argc, char* argv[]) { int frequency; int gain = AUTO_GAIN; struct dab_state_t* dab; if ((argc < 3) || (argc > 5)) { usage(); return 1; } frequency = atoi(argv[2]); std::string device_arg(argv[1]); if (device_arg == "-w") { if (wf_open(&wf,"/dev/wavefinder0") >= 0) { init_dab_state(&dab,&wf,eti_callback); dab->device_type = DAB_DEVICE_WAVEFINDER; do_wf_decode(dab,frequency); } else { fprintf(stderr, "Could not open wavefinder\n"); } } else if (device_arg == "-r") { if (argc > 3) { gain = atoi(argv[3]); } init_dab_state(&dab,&sdr,eti_callback); dab->device_type = DAB_DEVICE_RTLSDR; do_sdr_decode(dab,frequency,gain); } else if (device_arg == "-h") { if (argc > 3) { hackrf_vga_gain = atoi(argv[3]); } if (argc > 4) { hackrf_lna_gain = atoi(argv[4]); } init_dab_state(&dab,&sdr,eti_callback); dab->device_type = DAB_DEVICE_HACKRF; do_sdr_decode(dab,frequency,gain); } else { usage(); return 1; } }
int main(int argc, char* argv[]) { int frequency; int gain = AUTO_GAIN; struct dab_state_t* dab; if ((argc < 2) || (argc > 3)) { usage(); return 1; } frequency = atoi(argv[1]); if (argc > 2) { gain = atoi(argv[2]); } if (wf_open(&wf,"/dev/wavefinder0") >= 0) { init_dab_state(&dab,&wf,eti_callback); dab->device_type = DAB_DEVICE_WAVEFINDER; do_wf_decode(dab,frequency); } else { init_dab_state(&dab,&sdr,eti_callback); dab->device_type = DAB_DEVICE_RTLSDR; do_sdr_decode(dab,frequency,gain); } }