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 /src | |
parent | b946ff6bceef6150f19da0a86950ed9ebbf0c2cb (diff) | |
download | dabmod-06fe89bd86fc709908c5882a2c48d03fc0977a25.tar.gz dabmod-06fe89bd86fc709908c5882a2c48d03fc0977a25.tar.bz2 dabmod-06fe89bd86fc709908c5882a2c48d03fc0977a25.zip |
crc-dabmod: added UHD tx gain remote control
Diffstat (limited to 'src')
-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 |
5 files changed, 43 insertions, 12 deletions
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: |