diff options
author | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-08-16 18:28:13 +0200 |
---|---|---|
committer | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-08-16 18:28:13 +0200 |
commit | 06fe89bd86fc709908c5882a2c48d03fc0977a25 (patch) | |
tree | c2b39935d99e841e350af95c3d878155875f0a6a | |
parent | b946ff6bceef6150f19da0a86950ed9ebbf0c2cb (diff) | |
download | dabmod-06fe89bd86fc709908c5882a2c48d03fc0977a25.tar.gz dabmod-06fe89bd86fc709908c5882a2c48d03fc0977a25.tar.bz2 dabmod-06fe89bd86fc709908c5882a2c48d03fc0977a25.zip |
crc-dabmod: added UHD tx gain remote control
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 61 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/DabMod.cpp | 15 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/Makefile.in | 21 | ||||
-rw-r--r-- | src/OutputUHD.cpp | 10 | ||||
-rw-r--r-- | src/OutputUHD.h | 6 |
8 files changed, 99 insertions, 23 deletions
diff --git a/config.h.in b/config.h.in index 0bdccbd..2bd5b1b 100644 --- a/config.h.in +++ b/config.h.in @@ -22,6 +22,9 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `boost_system' library (-lboost_system). */ +#undef HAVE_LIBBOOST_SYSTEM + /* Define to 1 if you have the `boost_thread' library (-lboost_thread). */ #undef HAVE_LIBBOOST_THREAD @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for CRC-DabMod 0.3.3-sfn-r2. +# Generated by GNU Autoconf 2.68 for CRC-DabMod 0.3.3-sfn-r3. # # Report bugs to <pascal.charest@crc.ca>. # @@ -560,8 +560,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='CRC-DabMod' PACKAGE_TARNAME='crc-dabmod' -PACKAGE_VERSION='0.3.3-sfn-r2' -PACKAGE_STRING='CRC-DabMod 0.3.3-sfn-r2' +PACKAGE_VERSION='0.3.3-sfn-r3' +PACKAGE_STRING='CRC-DabMod 0.3.3-sfn-r3' PACKAGE_BUGREPORT='pascal.charest@crc.ca' PACKAGE_URL='' @@ -1268,7 +1268,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures CRC-DabMod 0.3.3-sfn-r2 to adapt to many kinds of systems. +\`configure' configures CRC-DabMod 0.3.3-sfn-r3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1339,7 +1339,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of CRC-DabMod 0.3.3-sfn-r2:";; + short | recursive ) echo "Configuration of CRC-DabMod 0.3.3-sfn-r3:";; esac cat <<\_ACEOF @@ -1438,7 +1438,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -CRC-DabMod configure 0.3.3-sfn-r2 +CRC-DabMod configure 0.3.3-sfn-r3 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1998,7 +1998,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by CRC-DabMod $as_me 0.3.3-sfn-r2, which was +It was created by CRC-DabMod $as_me 0.3.3-sfn-r3, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2924,7 +2924,7 @@ fi # Define the identity of the package. PACKAGE='crc-dabmod' - VERSION='0.3.3-sfn-r2' + VERSION='0.3.3-sfn-r3' cat >>confdefs.h <<_ACEOF @@ -4710,6 +4710,47 @@ else as_fn_error $? "library uhd is missing" "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_system" >&5 +$as_echo_n "checking for main in -lboost_system... " >&6; } +if ${ac_cv_lib_boost_system_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lboost_system $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_boost_system_main=yes +else + ac_cv_lib_boost_system_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_boost_system_main" >&5 +$as_echo "$ac_cv_lib_boost_system_main" >&6; } +if test "x$ac_cv_lib_boost_system_main" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBBOOST_SYSTEM 1 +_ACEOF + + LIBS="-lboost_system $LIBS" + +else + as_fn_error $? "library boost_system is missing" "$LINENO" 5 +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_thread" >&5 $as_echo_n "checking for main in -lboost_thread... " >&6; } if ${ac_cv_lib_boost_thread_main+:} false; then : @@ -6438,7 +6479,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by CRC-DabMod $as_me 0.3.3-sfn-r2, which was +This file was extended by CRC-DabMod $as_me 0.3.3-sfn-r3, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6504,7 +6545,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -CRC-DabMod config.status 0.3.3-sfn-r2 +CRC-DabMod config.status 0.3.3-sfn-r3 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 99971ef..0d16c76 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ # along with CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.59) -AC_INIT([CRC-DabMod], [0.3.3-sfn-r2], [pascal.charest@crc.ca]) +AC_INIT([CRC-DabMod], [0.3.3-sfn-r3], [pascal.charest@crc.ca]) AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([-Wall]) @@ -72,6 +72,7 @@ AC_SUBST([CFLAGS], ["$OPTIM $DEBUG $EXTRA"]) AC_SUBST([CXXFLAGS], ["$OPTIM $DEBUG $EXTRA"]) AC_CHECK_LIB([uhd], [main], [], [AC_MSG_ERROR([library uhd is missing])]) +AC_CHECK_LIB([boost_system], [main], [], [AC_MSG_ERROR([library boost_system is missing])]) AC_CHECK_LIB([boost_thread], [main], [], [AC_MSG_ERROR([library boost_thread is missing])]) AC_CHECK_LIB([rt], [clock_gettime], [], [AC_MSG_ERROR([library rt is missing])]) diff --git a/src/DabMod.cpp b/src/DabMod.cpp index d3cc877..dbfc885 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -37,6 +37,7 @@ #include "PcDebug.h" #include "TimestampDecoder.h" #include "FIRFilter.h" +#include "RemoteControl.h" #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ini_parser.hpp> @@ -150,7 +151,7 @@ int main(int argc, char* argv[]) { int ret = 0; bool loop = false; - char* inputName = NULL; + const char* inputName = NULL; const char* outputName; const char* outputDevice; @@ -191,6 +192,9 @@ int main(int argc, char* argv[]) InputMemory* input = NULL; ModOutput* output = NULL; + RemoteControllerTelnet rc (2121); + rc.start(); + Logger logger; signal(SIGINT, signalHandler); @@ -306,6 +310,14 @@ int main(int argc, char* argv[]) read_ini(configuration_file, pt); + // input params: + if (pt.get("input.loop", 0) == 1) { + loop = true; + } + + string input_filename = pt.get("input.filename", "/dev/stdin"); + inputName = input_filename.c_str(); + // log parameters: if (pt.get("log.syslog", 0) == 1) { LogToSyslog* log_syslog = new LogToSyslog(); @@ -501,6 +513,7 @@ int main(int argc, char* argv[]) uhdFrequency, uhdTxGain, uhd_enable_sync, uhd_mute_no_timestamps, logger); + ((OutputUHD*)output)->enrol_at(rc); } catch (std::exception& e) { logger(error, "UHD initialisation failed"); diff --git a/src/Makefile.am b/src/Makefile.am index c546e1d..991267b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,7 +76,8 @@ crc_dabmod_SOURCES = DabMod.cpp \ Resampler.cpp Resampler.h \ ConvEncoder.cpp ConvEncoder.h \ TimeInterleaver.cpp TimeInterleaver.h \ - Log.cpp Log.h + Log.cpp Log.h \ + RemoteControl.cpp RemoteControl.h nodist_crc_dabmod_SOURCES =$(FFT_SRC) dist_bin_SCRIPTS =crc-dwap.py diff --git a/src/Makefile.in b/src/Makefile.in index f56fb98..6ac0326 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -99,7 +99,8 @@ am_crc_dabmod_OBJECTS = crc_dabmod-DabMod.$(OBJEXT) \ crc_dabmod-GuardIntervalInserter.$(OBJEXT) \ crc_dabmod-Resampler.$(OBJEXT) \ crc_dabmod-ConvEncoder.$(OBJEXT) \ - crc_dabmod-TimeInterleaver.$(OBJEXT) crc_dabmod-Log.$(OBJEXT) + crc_dabmod-TimeInterleaver.$(OBJEXT) crc_dabmod-Log.$(OBJEXT) \ + crc_dabmod-RemoteControl.$(OBJEXT) am__objects_1 = crc_dabmod-kiss_fft.$(OBJEXT) \ crc_dabmod-kiss_fftr.$(OBJEXT) \ crc_dabmod-kiss_fftsimd.$(OBJEXT) @@ -294,7 +295,8 @@ crc_dabmod_SOURCES = DabMod.cpp \ Resampler.cpp Resampler.h \ ConvEncoder.cpp ConvEncoder.h \ TimeInterleaver.cpp TimeInterleaver.h \ - Log.cpp Log.h + Log.cpp Log.h \ + RemoteControl.cpp RemoteControl.h nodist_crc_dabmod_SOURCES = $(FFT_SRC) dist_bin_SCRIPTS = crc-dwap.py @@ -448,6 +450,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-PuncturingEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-PuncturingRule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-QpskSymbolMapper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-RemoteControl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-Resampler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-SignalMultiplexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-SubchannelSource.Po@am__quote@ @@ -1088,6 +1091,20 @@ crc_dabmod-Log.obj: Log.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-Log.obj `if test -f 'Log.cpp'; then $(CYGPATH_W) 'Log.cpp'; else $(CYGPATH_W) '$(srcdir)/Log.cpp'; fi` +crc_dabmod-RemoteControl.o: RemoteControl.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-RemoteControl.o -MD -MP -MF $(DEPDIR)/crc_dabmod-RemoteControl.Tpo -c -o crc_dabmod-RemoteControl.o `test -f 'RemoteControl.cpp' || echo '$(srcdir)/'`RemoteControl.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-RemoteControl.Tpo $(DEPDIR)/crc_dabmod-RemoteControl.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RemoteControl.cpp' object='crc_dabmod-RemoteControl.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-RemoteControl.o `test -f 'RemoteControl.cpp' || echo '$(srcdir)/'`RemoteControl.cpp + +crc_dabmod-RemoteControl.obj: RemoteControl.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-RemoteControl.obj -MD -MP -MF $(DEPDIR)/crc_dabmod-RemoteControl.Tpo -c -o crc_dabmod-RemoteControl.obj `if test -f 'RemoteControl.cpp'; then $(CYGPATH_W) 'RemoteControl.cpp'; else $(CYGPATH_W) '$(srcdir)/RemoteControl.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-RemoteControl.Tpo $(DEPDIR)/crc_dabmod-RemoteControl.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RemoteControl.cpp' object='crc_dabmod-RemoteControl.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-RemoteControl.obj `if test -f 'RemoteControl.cpp'; then $(CYGPATH_W) 'RemoteControl.cpp'; else $(CYGPATH_W) '$(srcdir)/RemoteControl.cpp'; fi` + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index 0195841..808d0e1 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -43,7 +43,7 @@ OutputUHD::OutputUHD(const char* device, unsigned sampleRate, double frequency, int txgain, bool enableSync, bool muteNoTimestamps, Logger& logger) : ModOutput(ModFormat(1), ModFormat(0)), - RemoteControl("uhd"), + RemoteControllable("uhd"), myLogger(logger), mySampleRate(sampleRate), myTxGain(txgain), @@ -55,7 +55,7 @@ OutputUHD::OutputUHD(const char* device, unsigned sampleRate, device, this); /* register the parameters that can be remote controlled */ - RC_ADD_PARAMETER("txgain", "UHD analog daughterboard TX gain") + RC_ADD_PARAMETER(txgain, "UHD analog daughterboard TX gain") myDevice = device; @@ -506,13 +506,13 @@ loopend: } -virtual void OutputUHD::set_parameter(string parameter, string value) +void OutputUHD::set_parameter(string parameter, string value) { stringstream ss(value); ss.exceptions ( stringstream::failbit | stringstream::badbit ); if (parameter == "txgain") { - ss >> myTxStream; + ss >> myTxGain; #if ENABLE_UHD myUsrp->set_tx_gain(myTxGain); #endif @@ -524,7 +524,7 @@ virtual void OutputUHD::set_parameter(string parameter, string value) } } -virtual string OutputUHD::get_parameter(string parameter) +string OutputUHD::get_parameter(string parameter) { stringstream ss; if (parameter == "txgain") { diff --git a/src/OutputUHD.h b/src/OutputUHD.h index 1a53804..28d3f25 100644 --- a/src/OutputUHD.h +++ b/src/OutputUHD.h @@ -139,7 +139,7 @@ class UHDWorker { }; -class OutputUHD: public ModOutput, public RemoteControl { +class OutputUHD: public ModOutput, public RemoteControllable { public: OutputUHD(const char* device, unsigned sampleRate, @@ -165,10 +165,10 @@ class OutputUHD: public ModOutput, public RemoteControl { } // */ /* Base function to set parameters. */ - virtual void set_parameter(string parameter, string value) = 0; + virtual void set_parameter(string parameter, string value); /* Getting a parameter always returns a string. */ - virtual string get_parameter(string parameter) = 0; + virtual string get_parameter(string parameter); protected: |