From 7f5faf87e6373d27ae6709a1185154ca8e98276b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 1 Nov 2014 13:45:25 +0100 Subject: Add new ZeroMQ IQ output --- src/DabMod.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 67ad12d..f27d720 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -38,6 +38,7 @@ #if defined(HAVE_OUTPUT_UHD) # include "OutputUHD.h" #endif +#include "OutputZeroMQ.h" #include "InputReader.h" #include "PcDebug.h" #include "TimestampDecoder.h" @@ -166,6 +167,7 @@ int main(int argc, char* argv[]) std::string inputTransport = "file"; std::string outputName; + int useZeroMQOutput = 0; int useFileOutput = 0; int useUHDOutput = 0; @@ -399,7 +401,7 @@ int main(int argc, char* argv[]) clockRate = pt.get("modulator.dac_clk_rate", (size_t)0); digitalgain = pt.get("modulator.digital_gain", digitalgain); outputRate = pt.get("modulator.rate", outputRate); - + // FIR Filter parameters: if (pt.get("firfilter.enabled", 0) == 1) { try { @@ -530,6 +532,12 @@ int main(int argc, char* argv[]) useUHDOutput = 1; } +#endif +#if defined(HAVE_OUTPUT_ZEROMQ) + else if (output_selected == "zmq") { + outputName = pt.get("zmqoutput.listen"); + useZeroMQOutput = 1; + } #endif else { std::cerr << "Error: Invalid output defined.\n"; @@ -612,7 +620,7 @@ int main(int argc, char* argv[]) goto END_MAIN; } - if (!useFileOutput && !useUHDOutput) { + if (!useFileOutput && !useUHDOutput && !useZeroMQOutput) { logger.level(error) << "Output not specified"; fprintf(stderr, "Must specify output !"); goto END_MAIN; @@ -623,8 +631,12 @@ int main(int argc, char* argv[]) fprintf(stderr, " Type: %s\n", inputTransport.c_str()); fprintf(stderr, " Source: %s\n", inputName.c_str()); fprintf(stderr, "Output\n"); + + if (useFileOutput) { + fprintf(stderr, " Name: %s\n", outputName.c_str()); + } #if defined(HAVE_OUTPUT_UHD) - if (useUHDOutput) { + else if (useUHDOutput) { fprintf(stderr, " UHD\n" " Device: %s\n" " Type: %s\n" @@ -633,12 +645,13 @@ int main(int argc, char* argv[]) outputuhd_conf.usrpType.c_str(), outputuhd_conf.masterClockRate); } - else if (useFileOutput) { -#else - if (useFileOutput) { #endif - fprintf(stderr, " Name: %s\n", outputName.c_str()); + else if (useZeroMQOutput) { + fprintf(stderr, " ZeroMQ\n" + " Listening on: %s\n", + outputName.c_str()); } + fprintf(stderr, " Sampling rate: "); if (outputRate > 1000) { if (outputRate > 1000000) { @@ -713,6 +726,12 @@ int main(int argc, char* argv[]) } } #endif + else if (useZeroMQOutput) { + /* We normalise the same way as for the UHD output */ + normalise = 1.0f/50000.0f; + + output = new OutputZeroMQ(outputName); + } flowgraph = new Flowgraph(); data.setLength(6144); -- cgit v1.2.3 From 014e35d73f80cef14895bc9c0dad5d35213e8aab Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 1 Nov 2014 16:48:13 +0100 Subject: Fix compilation without zmq output --- src/DabMod.cpp | 2 ++ src/OutputZeroMQ.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index f27d720..a4ef228 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -726,12 +726,14 @@ int main(int argc, char* argv[]) } } #endif +#if defined(HAVE_OUTPUT_ZEROMQ) else if (useZeroMQOutput) { /* We normalise the same way as for the UHD output */ normalise = 1.0f/50000.0f; output = new OutputZeroMQ(outputName); } +#endif flowgraph = new Flowgraph(); data.setLength(6144); diff --git a/src/OutputZeroMQ.h b/src/OutputZeroMQ.h index a3ac060..1c48fe7 100644 --- a/src/OutputZeroMQ.h +++ b/src/OutputZeroMQ.h @@ -52,8 +52,6 @@ class OutputZeroMQ : public ModOutput // tcp://*:58300 std::string m_name; - - Buffer* m_data_out; }; #endif // HAVE_OUTPUT_ZEROMQ_H -- cgit v1.2.3 From cf46de6e9faa6628650217f53bae72059475c63e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 2 Nov 2014 21:07:08 +0100 Subject: Change UHD txgain to double --- doc/example.ini | 2 +- src/DabMod.cpp | 4 ++-- src/OutputUHD.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/doc/example.ini b/doc/example.ini index 9cdfe03..38a856c 100644 --- a/doc/example.ini +++ b/doc/example.ini @@ -107,7 +107,7 @@ filename=/dev/stdout ; ; Settings for a USRP B100: device=master_clock_rate=32768000,type=b100 -txgain=2 +txgain=2.0 ; Try first with small gain values ; Also set rate to 2048000 diff --git a/src/DabMod.cpp b/src/DabMod.cpp index a4ef228..b0a7a2c 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -259,7 +259,7 @@ int main(int argc, char* argv[]) break; case 'G': #if defined(HAVE_OUTPUT_UHD) - outputuhd_conf.txgain = (int)strtol(optarg, NULL, 10); + outputuhd_conf.txgain = strtod(optarg, NULL); #endif break; case 'l': @@ -453,7 +453,7 @@ int main(int argc, char* argv[]) "setting type in [uhd] device is deprecated !\n"; } - outputuhd_conf.txgain = pt.get("uhdoutput.txgain", 0); + outputuhd_conf.txgain = pt.get("uhdoutput.txgain", 0.0); outputuhd_conf.frequency = pt.get("uhdoutput.frequency", 0); std::string chan = pt.get("uhdoutput.channel", ""); diff --git a/src/OutputUHD.h b/src/OutputUHD.h index 3a047bf..ef9740d 100644 --- a/src/OutputUHD.h +++ b/src/OutputUHD.h @@ -166,7 +166,7 @@ struct OutputUHDConfig { long masterClockRate; unsigned sampleRate; double frequency; - int txgain; + double txgain; bool enableSync; bool muteNoTimestamps; -- cgit v1.2.3 From 8ba7e406e1d71460865c0eb493956520e2f35ae1 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 14 Nov 2014 23:42:52 +0100 Subject: Update -V output --- src/DabMod.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index b0a7a2c..df7e2a1 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -138,8 +138,13 @@ void printVersion(FILE *out = stderr) { fprintf(out, "Welcome to %s %s, compiled at %s, %s\n\n", PACKAGE, VERSION, __DATE__, __TIME__); - fprintf(out, "ODR-DabMod is copyright (C) Her Majesty the Queen in Right of Canada,\n" - " 2009, 2010, 2011, 2012 Communications Research Centre (CRC).\n" + fprintf(out, + " ODR-DabMod is copyright (C) Her Majesty the Queen in Right of Canada,\n" + " 2009, 2010, 2011, 2012 Communications Research Centre (CRC),\n" + " and\n" + " Copyright (C) 2014 Matthias P. Braendli, matthias.braendli@mpb.li\n" + "\n" + " http://opendigitalradio.org\n" "\n" " This program is available free of charge and is licensed to you on a\n" " non-exclusive basis; you may not redistribute it.\n" @@ -152,8 +157,10 @@ void printVersion(FILE *out = stderr) " In no event shall CRC be LIABLE for any LOSS, DAMAGE or COST that may be\n" " incurred in connection with the use of this software.\n" "\n" +#if USE_KISS_FFT "ODR-DabMod makes use of the following open source packages:\n" " Kiss FFT v1.2.9 (Revised BSD) - http://kissfft.sourceforge.net/\n" +#endif ); } -- cgit v1.2.3 From ae4bed0f8ef4b7b318befe49336902deee983614 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 14 Nov 2014 23:54:46 +0100 Subject: Print compile-time settings on startup --- src/DabMod.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index df7e2a1..1afdfb5 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -339,6 +339,30 @@ int main(int argc, char* argv[]) #endif << std::endl; + std::cerr << "Using FFT library " << +#if defined(USE_FFTW) + "FFTW" << +#endif +#if defined(USE_KISS_FFT) + "Kiss FFT" << +#endif +#if defined(USE_SIMD) + " (with fft_simd)" << +#endif + "\n"; + + std::cerr << "Compiled with features: " << +#if defined(HAVE_INPUT_ZEROMQ) + "input_zeromq " << +#endif +#if defined(HAVE_OUTPUT_UHD) + "output_uhd " << +#endif +#if defined(HAVE_OUTPUT_ZEROMQ) + "output_zeromq " << +#endif + "\n"; + if (use_configuration_file && use_configuration_cmdline) { fprintf(stderr, "Warning: configuration file and command line parameters are defined:\n\t" "Command line parameters override settings in the configuration file !\n"); @@ -578,6 +602,7 @@ int main(int argc, char* argv[]) outputuhd_conf.muteNoTimestamps = (pt.get("delaymanagement.mutenotimestamps", 0) == 1); #endif } + if (!rc) { logger.level(warn) << "No Remote-Control started"; rc = new RemoteControllerDummy(); -- cgit v1.2.3 From e2d7cfa4ed5d8bfd4a4798b5f653d0bc222d5bce Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 14 Nov 2014 23:55:19 +0100 Subject: Interpret a single cmdline option as ini file name --- src/DabMod.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 1afdfb5..91c0b9d 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -92,11 +92,11 @@ void printUsage(char* progName, FILE* out = stderr) #endif __DATE__, __TIME__); fprintf(out, "Usage with configuration file:\n"); - fprintf(out, "\t%s -C config_file.ini\n\n", progName); + fprintf(out, "\t%s [-C] config_file.ini\n\n", progName); fprintf(out, "Usage with command line options:\n"); fprintf(out, "\t%s" - " [input]" + " input" " (-f filename | -u uhddevice -F frequency) " " [-G txgain]" " [-o offset]" @@ -368,6 +368,18 @@ int main(int argc, char* argv[]) "Command line parameters override settings in the configuration file !\n"); } + // No argument given ? You can't be serious ! Show usage. + if (argc == 1) { + printUsage(argv[0]); + goto END_MAIN; + } + + // If only one argument is given, interpret as configuration file name + if (argc == 2) { + use_configuration_file = true; + configuration_file = argv[1]; + } + if (use_configuration_file) { // First read parameters from the file using boost::property_tree::ptree; @@ -624,7 +636,7 @@ int main(int argc, char* argv[]) } // Setting ETI input filename - if (inputName == "") { + if (use_configuration_cmdline && inputName == "") { if (optind < argc) { inputName = argv[optind++]; @@ -640,7 +652,7 @@ int main(int argc, char* argv[]) } // Checking unused arguments - if (optind != argc) { + if (use_configuration_cmdline && optind != argc) { fprintf(stderr, "Invalid arguments:"); while (optind != argc) { fprintf(stderr, " %s", argv[optind++]); -- cgit v1.2.3