From cd0d9350c6a534dd057f709ee1d9f00a19c90306 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 16 Feb 2015 21:25:38 -0800 Subject: [PATCH] soapy: fix set_dc_offset_mode implementation --- lib/soapy/soapy_source_c.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc index 8c1dbf8..330173b 100644 --- a/lib/soapy/soapy_source_c.cc +++ b/lib/soapy/soapy_source_c.cc @@ -38,6 +38,7 @@ #include "arg_helpers.h" #include "soapy_source_c.h" +#include "osmosdr/source.h" #include using namespace boost::assign; @@ -278,7 +279,19 @@ std::string soapy_source_c::get_antenna( size_t chan ) void soapy_source_c::set_dc_offset_mode( int mode, size_t chan ) { - _device->setDCOffsetMode(SOAPY_SDR_RX, chan, mode); + switch (mode) + { + case osmosdr::source::DCOffsetOff: + _device->setDCOffsetMode(SOAPY_SDR_RX, chan, false); + this->set_dc_offset(0.0, chan); //reset + break; + case osmosdr::source::DCOffsetManual: + _device->setDCOffsetMode(SOAPY_SDR_RX, chan, false); + break; + case osmosdr::source::DCOffsetAutomatic: + _device->setDCOffsetMode(SOAPY_SDR_RX, chan, true); + break; + } } void soapy_source_c::set_dc_offset( const std::complex &offset, size_t chan )