diff options
author | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-08-16 18:05:40 +0200 |
---|---|---|
committer | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-08-16 18:05:40 +0200 |
commit | b946ff6bceef6150f19da0a86950ed9ebbf0c2cb (patch) | |
tree | 6987a458cdb324a0155f7f8d36fc1ecc0d336bb3 /src/OutputUHD.cpp | |
parent | 521ee81560be5d065bd090002a2c6b92a322a034 (diff) | |
download | dabmod-b946ff6bceef6150f19da0a86950ed9ebbf0c2cb.tar.gz dabmod-b946ff6bceef6150f19da0a86950ed9ebbf0c2cb.tar.bz2 dabmod-b946ff6bceef6150f19da0a86950ed9ebbf0c2cb.zip |
crc-dabmod: removed useless set_parameters from remote_control
Diffstat (limited to 'src/OutputUHD.cpp')
-rw-r--r-- | src/OutputUHD.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index 971f33b..0195841 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -27,6 +27,7 @@ #include "OutputUHD.h" #include "PcDebug.h" #include "Log.h" +#include "RemoteControl.h" #include <iostream> #include <assert.h> @@ -42,6 +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"), myLogger(logger), mySampleRate(sampleRate), myTxGain(txgain), @@ -52,6 +54,9 @@ OutputUHD::OutputUHD(const char* device, unsigned sampleRate, MDEBUG("OutputUHD::OutputUHD(device: %s) @ %p\n", device, this); + /* register the parameters that can be remote controlled */ + RC_ADD_PARAMETER("txgain", "UHD analog daughterboard TX gain") + myDevice = device; #if ENABLE_UHD @@ -499,3 +504,36 @@ loopend: workerbuffer = (workerbuffer + 1) % 2; } } + + +virtual void OutputUHD::set_parameter(string parameter, string value) +{ + stringstream ss(value); + ss.exceptions ( stringstream::failbit | stringstream::badbit ); + + if (parameter == "txgain") { + ss >> myTxStream; +#if ENABLE_UHD + myUsrp->set_tx_gain(myTxGain); +#endif + } + else { + stringstream ss; + ss << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); + throw ParameterError(ss.str()); + } +} + +virtual string OutputUHD::get_parameter(string parameter) +{ + stringstream ss; + if (parameter == "txgain") { + ss << myTxGain; + } + else { + ss << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); + throw ParameterError(ss.str()); + } + return ss.str(); +} + |