soapy: fixes from last commit w/ field test

soapy_support
Josh Blum 8 years ago
parent 6d6a483cfb
commit 535a505069
  1. 2
      lib/arg_helpers.h
  2. 4
      lib/sink_impl.cc
  3. 10
      lib/soapy/soapy_sink_c.cc
  4. 1
      lib/soapy/soapy_sink_c.h
  5. 10
      lib/soapy/soapy_source_c.cc
  6. 1
      lib/soapy/soapy_source_c.h

@ -39,7 +39,7 @@ inline std::string dict_to_args_string( const dict_t &d )
std::string out;
BOOST_FOREACH(const pair_t pair, d)
{
if (not out.empty()) out += ", ";
if (not out.empty()) out += ",";
out += pair.first + "='" + pair.second + "'";
}
return out;

@ -172,8 +172,8 @@ sink_impl::sink_impl( const std::string &args )
#ifdef ENABLE_SOAPY
if ( dict.count("soapy") ) {
soapy_sink_c_sptr src = make_soapy_sink_c( arg );
block = src; iface = src.get();
soapy_sink_c_sptr sink = make_soapy_sink_c( arg );
block = sink; iface = sink.get();
}
#endif

@ -69,9 +69,9 @@ soapy_sink_c::soapy_sink_c (const std::string &args)
boost::mutex::scoped_lock l(get_soapy_maker_mutex());
_device = SoapySDR::Device::make(params_to_dict(args));
}
size_t num_chan = std::max(1, args_to_io_signature(args)->max_streams());
_nchan = std::max(1, args_to_io_signature(args)->max_streams());
std::vector<size_t> channels;
for (size_t i = 0; i < num_chan; i++) channels.push_back(i);
for (size_t i = 0; i < _nchan; i++) channels.push_back(i);
_stream = _device->setupStream(SOAPY_SDR_TX, "CF32", channels);
}
@ -127,8 +127,10 @@ int soapy_sink_c::work( int noutput_items,
std::vector<std::string> soapy_sink_c::get_devices()
{
std::vector<std::string> result;
BOOST_FOREACH(const SoapySDR::Kwargs &kw, SoapySDR::Device::enumerate())
int i = 0;
BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
{
kw["soapy"] = boost::lexical_cast<std::string>(i++);
result.push_back(dict_to_args_string(kw));
}
return result;
@ -136,7 +138,7 @@ std::vector<std::string> soapy_sink_c::get_devices()
size_t soapy_sink_c::get_num_channels( void )
{
return _device->getNumChannels(SOAPY_SDR_TX);
return _nchan;
}
osmosdr::meta_range_t soapy_sink_c::get_sample_rates( void )

@ -132,6 +132,7 @@ void set_time_unknown_pps(const ::osmosdr::time_spec_t &time_spec);
private:
SoapySDR::Device *_device;
SoapySDR::Stream *_stream;
size_t _nchan;
};
#endif /* INCLUDED_SOAPY_SINK_C_H */

@ -65,9 +65,9 @@ soapy_source_c::soapy_source_c (const std::string &args)
boost::mutex::scoped_lock l(get_soapy_maker_mutex());
_device = SoapySDR::Device::make(params_to_dict(args));
}
size_t num_chan = std::max(1, args_to_io_signature(args)->max_streams());
_nchan = std::max(1, args_to_io_signature(args)->max_streams());
std::vector<size_t> channels;
for (size_t i = 0; i < num_chan; i++) channels.push_back(i);
for (size_t i = 0; i < _nchan; i++) channels.push_back(i);
_stream = _device->setupStream(SOAPY_SDR_RX, "CF32", channels);
}
@ -123,8 +123,10 @@ int soapy_source_c::work( int noutput_items,
std::vector<std::string> soapy_source_c::get_devices()
{
std::vector<std::string> result;
BOOST_FOREACH(const SoapySDR::Kwargs &kw, SoapySDR::Device::enumerate())
int i = 0;
BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
{
kw["soapy"] = boost::lexical_cast<std::string>(i++);
result.push_back(dict_to_args_string(kw));
}
return result;
@ -132,7 +134,7 @@ std::vector<std::string> soapy_source_c::get_devices()
size_t soapy_source_c::get_num_channels( void )
{
return _device->getNumChannels(SOAPY_SDR_RX);
return _nchan;
}
osmosdr::meta_range_t soapy_source_c::get_sample_rates( void )

@ -134,6 +134,7 @@ void set_time_unknown_pps(const ::osmosdr::time_spec_t &time_spec);
private:
SoapySDR::Device *_device;
SoapySDR::Stream *_stream;
size_t _nchan;
};
#endif /* INCLUDED_SOAPY_SOURCE_C_H */

Loading…
Cancel
Save