forked from sdr/gr-osmosdr
soapy: support set/getFrequencyCorrection() API
backwards compatible changes with #ifdef set/get_freq_corr() call directly into the SoapySDR equivalent when supported by the API version.
This commit is contained in:
parent
b361fa5a77
commit
117f648859
|
@ -171,22 +171,30 @@ double soapy_sink_c::get_center_freq( size_t chan)
|
||||||
|
|
||||||
double soapy_sink_c::set_freq_corr( double ppm, 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);
|
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_TX, chan);
|
||||||
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
||||||
{
|
{
|
||||||
_device->setFrequency(SOAPY_SDR_TX, chan, "CORR", ppm);
|
_device->setFrequency(SOAPY_SDR_TX, chan, "CORR", ppm);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return this->get_freq_corr(chan);
|
return this->get_freq_corr(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
double soapy_sink_c::get_freq_corr( size_t 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);
|
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_TX, chan);
|
||||||
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
||||||
{
|
{
|
||||||
return _device->getFrequency(SOAPY_SDR_TX, chan, "CORR");
|
return _device->getFrequency(SOAPY_SDR_TX, chan, "CORR");
|
||||||
}
|
}
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> soapy_sink_c::get_gain_names( size_t chan)
|
std::vector<std::string> soapy_sink_c::get_gain_names( size_t chan)
|
||||||
|
|
|
@ -172,22 +172,30 @@ double soapy_source_c::get_center_freq( size_t chan )
|
||||||
|
|
||||||
double soapy_source_c::set_freq_corr( double ppm, 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);
|
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_RX, chan);
|
||||||
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
||||||
{
|
{
|
||||||
_device->setFrequency(SOAPY_SDR_RX, chan, "CORR", ppm);
|
_device->setFrequency(SOAPY_SDR_RX, chan, "CORR", ppm);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return this->get_freq_corr(chan);
|
return this->get_freq_corr(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
double soapy_source_c::get_freq_corr( size_t 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);
|
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_RX, chan);
|
||||||
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
if (std::find(components.begin(), components.end(), "COOR") != components.end())
|
||||||
{
|
{
|
||||||
return _device->getFrequency(SOAPY_SDR_RX, chan, "CORR");
|
return _device->getFrequency(SOAPY_SDR_RX, chan, "CORR");
|
||||||
}
|
}
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> soapy_source_c::get_gain_names( size_t chan )
|
std::vector<std::string> soapy_source_c::get_gain_names( size_t chan )
|
||||||
|
|
Loading…
Reference in New Issue