aboutsummaryrefslogtreecommitdiffstats
path: root/lib/soapy/soapy_source_c.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/soapy/soapy_source_c.cc')
-rw-r--r--lib/soapy/soapy_source_c.cc27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc
index 4dc9efc..a645361 100644
--- a/lib/soapy/soapy_source_c.cc
+++ b/lib/soapy/soapy_source_c.cc
@@ -64,7 +64,7 @@ soapy_source_c::soapy_source_c (const std::string &args)
args_to_io_signature(args))
{
{
- std::lock_guard<std::mutex> l(get_soapy_maker_mutex());
+ boost::mutex::scoped_lock l(get_soapy_maker_mutex());
_device = SoapySDR::Device::make(params_to_dict(args));
}
_nchan = std::max(1, args_to_io_signature(args)->max_streams());
@@ -76,7 +76,7 @@ soapy_source_c::soapy_source_c (const std::string &args)
soapy_source_c::~soapy_source_c(void)
{
_device->closeStream(_stream);
- std::lock_guard<std::mutex> l(get_soapy_maker_mutex());
+ boost::mutex::scoped_lock l(get_soapy_maker_mutex());
SoapySDR::Device::unmake(_device);
}
@@ -96,14 +96,9 @@ int soapy_source_c::work( int noutput_items,
{
int flags = 0;
long long timeNs = 0;
- int ret;
- int retries = 1;
-
- do {
- ret = _device->readStream(
- _stream, &output_items[0],
- noutput_items, flags, timeNs);
- } while (retries-- && (ret == SOAPY_SDR_OVERFLOW));
+ int ret = _device->readStream(
+ _stream, &output_items[0],
+ noutput_items, flags, timeNs);
if (ret < 0) return 0; //call again
return ret;
@@ -113,7 +108,7 @@ std::vector<std::string> soapy_source_c::get_devices()
{
std::vector<std::string> result;
int i = 0;
- for (SoapySDR::Kwargs kw : SoapySDR::Device::enumerate())
+ BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
{
kw["soapy"] = boost::lexical_cast<std::string>(i++);
result.push_back(dict_to_args_string(kw));
@@ -130,12 +125,12 @@ osmosdr::meta_range_t soapy_source_c::get_sample_rates( void )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
- for (const SoapySDR::Range &r : _device->getSampleRateRange(SOAPY_SDR_RX, 0))
+ BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
- for (const double rate : _device->listSampleRates(SOAPY_SDR_RX, 0))
+ BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(rate));
}
@@ -157,7 +152,7 @@ double soapy_source_c::get_sample_rate( void )
osmosdr::freq_range_t soapy_source_c::get_freq_range( size_t chan )
{
osmosdr::meta_range_t result;
- for (const SoapySDR::Range r : _device->getFrequencyRange(SOAPY_SDR_RX, 0))
+ BOOST_FOREACH(const SoapySDR::Range r, _device->getFrequencyRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
@@ -338,12 +333,12 @@ osmosdr::freq_range_t soapy_source_c::get_bandwidth_range( size_t chan )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
- for (const SoapySDR::Range &r : _device->getBandwidthRange(SOAPY_SDR_RX, 0))
+ BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
- for (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));
}