soapy: support newer getBandwidthRange() API call
Switch to the newer API call which can provide a list of ranges. There are feature detection ifdefs provided by the library so that code will always correctly compile.
This commit is contained in:
parent
860e9a1a72
commit
ae686c462d
|
@ -39,6 +39,7 @@
|
||||||
#include "arg_helpers.h"
|
#include "arg_helpers.h"
|
||||||
#include "soapy_sink_c.h"
|
#include "soapy_sink_c.h"
|
||||||
#include <SoapySDR/Device.hpp>
|
#include <SoapySDR/Device.hpp>
|
||||||
|
#include <SoapySDR/Version.hpp>
|
||||||
|
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
|
@ -287,10 +288,17 @@ double soapy_sink_c::get_bandwidth( size_t chan)
|
||||||
osmosdr::freq_range_t soapy_sink_c::get_bandwidth_range( size_t chan)
|
osmosdr::freq_range_t soapy_sink_c::get_bandwidth_range( size_t chan)
|
||||||
{
|
{
|
||||||
osmosdr::meta_range_t result;
|
osmosdr::meta_range_t result;
|
||||||
|
#ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
|
||||||
|
BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_TX, 0))
|
||||||
|
{
|
||||||
|
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
|
||||||
|
}
|
||||||
|
#else
|
||||||
BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_TX, 0))
|
BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_TX, 0))
|
||||||
{
|
{
|
||||||
result.push_back(osmosdr::range_t(bw));
|
result.push_back(osmosdr::range_t(bw));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "soapy_source_c.h"
|
#include "soapy_source_c.h"
|
||||||
#include "osmosdr/source.h"
|
#include "osmosdr/source.h"
|
||||||
#include <SoapySDR/Device.hpp>
|
#include <SoapySDR/Device.hpp>
|
||||||
|
#include <SoapySDR/Version.hpp>
|
||||||
|
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
|
@ -307,10 +308,17 @@ double soapy_source_c::get_bandwidth( size_t chan )
|
||||||
osmosdr::freq_range_t soapy_source_c::get_bandwidth_range( size_t chan )
|
osmosdr::freq_range_t soapy_source_c::get_bandwidth_range( size_t chan )
|
||||||
{
|
{
|
||||||
osmosdr::meta_range_t result;
|
osmosdr::meta_range_t result;
|
||||||
|
#ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
|
||||||
|
BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_RX, 0))
|
||||||
|
{
|
||||||
|
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
|
||||||
|
}
|
||||||
|
#else
|
||||||
BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_RX, 0))
|
BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_RX, 0))
|
||||||
{
|
{
|
||||||
result.push_back(osmosdr::range_t(bw));
|
result.push_back(osmosdr::range_t(bw));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue