diff options
Diffstat (limited to 'lib/soapy/soapy_source_c.cc')
-rw-r--r-- | lib/soapy/soapy_source_c.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc index d066ed8..fe1e8d9 100644 --- a/lib/soapy/soapy_source_c.cc +++ b/lib/soapy/soapy_source_c.cc @@ -29,6 +29,7 @@ #endif #include <iostream> +#include <algorithm> //find #include <boost/assign.hpp> #include <boost/format.hpp> @@ -164,13 +165,22 @@ double soapy_source_c::get_center_freq( size_t chan ) double soapy_source_c::set_freq_corr( double ppm, size_t chan ) { - _device->setFrequency(SOAPY_SDR_RX, chan, "CORR", ppm); + std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_RX, chan); + if (std::find(components.begin(), components.end(), "COOR") != components.end()) + { + _device->setFrequency(SOAPY_SDR_RX, chan, "CORR", ppm); + } return this->get_freq_corr(chan); } double soapy_source_c::get_freq_corr( size_t chan ) { - return _device->getFrequency(SOAPY_SDR_RX, chan, "CORR"); + std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_RX, chan); + if (std::find(components.begin(), components.end(), "COOR") != components.end()) + { + return _device->getFrequency(SOAPY_SDR_RX, chan, "CORR"); + } + return 0.0; } std::vector<std::string> soapy_source_c::get_gain_names( size_t chan ) |