forked from sdr/gr-osmosdr
Merge branch 'master' of git.osmocom.org:gr-osmosdr
This commit is contained in:
commit
c653754dde
|
@ -29,6 +29,7 @@
|
|||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm> //find
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
@ -122,10 +123,17 @@ size_t soapy_sink_c::get_num_channels( void )
|
|||
osmosdr::meta_range_t soapy_sink_c::get_sample_rates( void )
|
||||
{
|
||||
osmosdr::meta_range_t result;
|
||||
#ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
|
||||
BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_TX, 0))
|
||||
{
|
||||
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
|
||||
}
|
||||
#else
|
||||
BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_TX, 0))
|
||||
{
|
||||
result.push_back(osmosdr::range_t(rate));
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -162,15 +170,32 @@ double soapy_sink_c::get_center_freq( size_t chan)
|
|||
}
|
||||
|
||||
double soapy_sink_c::set_freq_corr( double ppm, size_t chan)
|
||||
{
|
||||
#ifdef SOAPY_SDR_API_HAS_FREQUENCY_CORRECTION_API
|
||||
_device->setFrequencyCorrection(SOAPY_SDR_TX, chan, ppm);
|
||||
#else
|
||||
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_TX, chan);
|
||||
if (std::find(components.begin(), components.end(), "CORR") != components.end())
|
||||
{
|
||||
_device->setFrequency(SOAPY_SDR_TX, chan, "CORR", ppm);
|
||||
}
|
||||
#endif
|
||||
return this->get_freq_corr(chan);
|
||||
}
|
||||
|
||||
double soapy_sink_c::get_freq_corr( size_t chan)
|
||||
{
|
||||
#ifdef SOAPY_SDR_API_HAS_FREQUENCY_CORRECTION_API
|
||||
return _device->getFrequencyCorrection(SOAPY_SDR_TX, chan);
|
||||
#else
|
||||
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_TX, chan);
|
||||
if (std::find(components.begin(), components.end(), "CORR") != components.end())
|
||||
{
|
||||
return _device->getFrequency(SOAPY_SDR_TX, chan, "CORR");
|
||||
}
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::string> soapy_sink_c::get_gain_names( size_t chan)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm> //find
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
@ -123,10 +124,17 @@ size_t soapy_source_c::get_num_channels( void )
|
|||
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
|
||||
BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_RX, 0))
|
||||
{
|
||||
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
|
||||
}
|
||||
#else
|
||||
BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_RX, 0))
|
||||
{
|
||||
result.push_back(osmosdr::range_t(rate));
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -163,15 +171,32 @@ double soapy_source_c::get_center_freq( size_t chan )
|
|||
}
|
||||
|
||||
double soapy_source_c::set_freq_corr( double ppm, size_t chan )
|
||||
{
|
||||
#ifdef SOAPY_SDR_API_HAS_FREQUENCY_CORRECTION_API
|
||||
_device->setFrequencyCorrection(SOAPY_SDR_RX, chan, ppm);
|
||||
#else
|
||||
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_RX, chan);
|
||||
if (std::find(components.begin(), components.end(), "CORR") != components.end())
|
||||
{
|
||||
_device->setFrequency(SOAPY_SDR_RX, chan, "CORR", ppm);
|
||||
}
|
||||
#endif
|
||||
return this->get_freq_corr(chan);
|
||||
}
|
||||
|
||||
double soapy_source_c::get_freq_corr( size_t chan )
|
||||
{
|
||||
#ifdef SOAPY_SDR_API_HAS_FREQUENCY_CORRECTION_API
|
||||
return _device->getFrequencyCorrection(SOAPY_SDR_RX, chan);
|
||||
#else
|
||||
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_RX, chan);
|
||||
if (std::find(components.begin(), components.end(), "CORR") != components.end())
|
||||
{
|
||||
return _device->getFrequency(SOAPY_SDR_RX, chan, "CORR");
|
||||
}
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::string> soapy_source_c::get_gain_names( size_t chan )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue