forked from sdr/gr-osmosdr
soapy: fixes from last commit w/ field test
This commit is contained in:
parent
6d6a483cfb
commit
535a505069
|
@ -39,7 +39,7 @@ inline std::string dict_to_args_string( const dict_t &d )
|
||||||
std::string out;
|
std::string out;
|
||||||
BOOST_FOREACH(const pair_t pair, d)
|
BOOST_FOREACH(const pair_t pair, d)
|
||||||
{
|
{
|
||||||
if (not out.empty()) out += ", ";
|
if (not out.empty()) out += ",";
|
||||||
out += pair.first + "='" + pair.second + "'";
|
out += pair.first + "='" + pair.second + "'";
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -172,8 +172,8 @@ sink_impl::sink_impl( const std::string &args )
|
||||||
|
|
||||||
#ifdef ENABLE_SOAPY
|
#ifdef ENABLE_SOAPY
|
||||||
if ( dict.count("soapy") ) {
|
if ( dict.count("soapy") ) {
|
||||||
soapy_sink_c_sptr src = make_soapy_sink_c( arg );
|
soapy_sink_c_sptr sink = make_soapy_sink_c( arg );
|
||||||
block = src; iface = src.get();
|
block = sink; iface = sink.get();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,9 @@ soapy_sink_c::soapy_sink_c (const std::string &args)
|
||||||
boost::mutex::scoped_lock l(get_soapy_maker_mutex());
|
boost::mutex::scoped_lock l(get_soapy_maker_mutex());
|
||||||
_device = SoapySDR::Device::make(params_to_dict(args));
|
_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;
|
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);
|
_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> soapy_sink_c::get_devices()
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
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));
|
result.push_back(dict_to_args_string(kw));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -136,7 +138,7 @@ std::vector<std::string> soapy_sink_c::get_devices()
|
||||||
|
|
||||||
size_t soapy_sink_c::get_num_channels( void )
|
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 )
|
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:
|
private:
|
||||||
SoapySDR::Device *_device;
|
SoapySDR::Device *_device;
|
||||||
SoapySDR::Stream *_stream;
|
SoapySDR::Stream *_stream;
|
||||||
|
size_t _nchan;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* INCLUDED_SOAPY_SINK_C_H */
|
#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());
|
boost::mutex::scoped_lock l(get_soapy_maker_mutex());
|
||||||
_device = SoapySDR::Device::make(params_to_dict(args));
|
_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;
|
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);
|
_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> soapy_source_c::get_devices()
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
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));
|
result.push_back(dict_to_args_string(kw));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -132,7 +134,7 @@ std::vector<std::string> soapy_source_c::get_devices()
|
||||||
|
|
||||||
size_t soapy_source_c::get_num_channels( void )
|
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 )
|
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:
|
private:
|
||||||
SoapySDR::Device *_device;
|
SoapySDR::Device *_device;
|
||||||
SoapySDR::Stream *_stream;
|
SoapySDR::Stream *_stream;
|
||||||
|
size_t _nchan;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* INCLUDED_SOAPY_SOURCE_C_H */
|
#endif /* INCLUDED_SOAPY_SOURCE_C_H */
|
||||||
|
|
Loading…
Reference in New Issue