summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-21 11:34:00 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-21 11:34:00 +0100
commit0a07b6c5cb772d09a2a50ff6a7f1ae0bfef657a0 (patch)
tree24268ff6cd05c8a81fa0061cb7670fe51cbe8d07
parentfcd2de2abf3fab7573f8e430ebf90822c6eb4bb9 (diff)
downloaddabmod-0a07b6c5cb772d09a2a50ff6a7f1ae0bfef657a0.tar.gz
dabmod-0a07b6c5cb772d09a2a50ff6a7f1ae0bfef657a0.tar.bz2
dabmod-0a07b6c5cb772d09a2a50ff6a7f1ae0bfef657a0.zip
Add file format to command line options
-rw-r--r--src/ConfigParser.cpp14
-rw-r--r--src/Utils.cpp5
2 files changed, 16 insertions, 3 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index e0bf6dc..33e6219 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -214,7 +214,8 @@ static void parse_configfile(
}
mod_settings.useFileOutput = true;
- mod_settings.fileOutputFormat = pt.get("fileoutput.format", mod_settings.fileOutputFormat);
+ mod_settings.fileOutputFormat = pt.get("fileoutput.format",
+ mod_settings.fileOutputFormat);
}
#if defined(HAVE_OUTPUT_UHD)
else if (output_selected == "uhd") {
@@ -409,9 +410,18 @@ void parse_args(int argc, char **argv, mod_settings_t& mod_settings)
mod_settings.useFileOutput = true;
break;
case 'F':
+ if (mod_settings.useFileOutput) {
+ mod_settings.fileOutputFormat = optarg;
+ }
#if defined(HAVE_OUTPUT_UHD)
- mod_settings.sdr_device_config.frequency = strtof(optarg, NULL);
+ else if (mod_settings.useUHDOutput) {
+ mod_settings.sdr_device_config.frequency = strtof(optarg, NULL);
+ }
#endif
+ else {
+ fprintf(stderr, "Cannot use -F before setting output!\n");
+ throw std::invalid_argument("Invalid command line options");
+ }
break;
case 'g':
mod_settings.gainMode = parse_gainmode(optarg);
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 3efef7f..dd63862 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -75,12 +75,14 @@ void printUsage(const char* progName)
fprintf(out, "Usage with command line options:\n");
fprintf(out, "\t%s"
" input"
- " (-f filename | -u uhddevice -F frequency) "
+ " (-f filename -F format | -u uhddevice -F frequency)"
+ "\n\t"
" [-G txgain]"
" [-o offset]"
" [-T filter_taps_file]"
" [-a gain]"
" [-c clockrate]"
+ "\n\t"
" [-g gainMode]"
" [-h]"
" [-l]"
@@ -93,6 +95,7 @@ void printUsage(const char* progName)
fprintf(out, " zmq+tcp://source:port for ZMQ input.\n");
fprintf(out, " udp://:port for EDI input.\n");
fprintf(out, "-f name: Use file output with given filename. (use /dev/stdout for standard output)\n");
+ fprintf(out, "-F format: Set the output format (see doc/example.ini for formats) for the file output.\n");
fprintf(out, "-u device: Use UHD output with given device string. (use "" for default device)\n");
fprintf(out, "-F frequency: Set the transmit frequency when using UHD output. (mandatory option when using UHD)\n");
fprintf(out, "-G txgain: Set the transmit gain for the UHD driver (default: 0)\n");