diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-05-07 11:46:45 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-05-07 11:46:45 +0200 |
commit | 04c3650d5f730891c33e45d2f07c052c6393c2e8 (patch) | |
tree | d95431a387598f88b4a05df7a1dd3d3c91f6126b /src/output/Soapy.cpp | |
parent | f6e3913f80ec15f2a554dc2ad1fe219cefd1f5d2 (diff) | |
parent | 3a7202306c6aca5be2dad604f62063d605fd0982 (diff) | |
download | dabmod-04c3650d5f730891c33e45d2f07c052c6393c2e8.tar.gz dabmod-04c3650d5f730891c33e45d2f07c052c6393c2e8.tar.bz2 dabmod-04c3650d5f730891c33e45d2f07c052c6393c2e8.zip |
Merge branch 'next' into lime
Diffstat (limited to 'src/output/Soapy.cpp')
-rw-r--r-- | src/output/Soapy.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/output/Soapy.cpp b/src/output/Soapy.cpp index 8c84b84..4846279 100644 --- a/src/output/Soapy.cpp +++ b/src/output/Soapy.cpp @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2018 + Copyright (C) 2019 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -90,15 +90,23 @@ Soapy::Soapy(SDRDeviceConfig& config) : std::fixed << std::setprecision(3) << m_conf.frequency / 1000.0 << " kHz."; + if (m_conf.bandwidth > 0) { + m_device->setBandwidth(SOAPY_SDR_TX, 0, m_conf.bandwidth); + m_device->setBandwidth(SOAPY_SDR_RX, 0, m_conf.bandwidth); + etiLog.level(info) << "SoapySDR:Actual TX bandwidth: " << + std::fixed << std::setprecision(2) << + m_device->getBandwidth(SOAPY_SDR_TX, 0); + } + m_device->setGain(SOAPY_SDR_TX, 0, m_conf.txgain); - etiLog.level(info) << "SoapySDR:Actual tx gain: " << + etiLog.level(info) << "SoapySDR:Actual TX gain: " << std::fixed << std::setprecision(2) << m_device->getGain(SOAPY_SDR_TX, 0); if (not m_conf.tx_antenna.empty()) { m_device->setAntenna(SOAPY_SDR_TX, 0, m_conf.tx_antenna); } - etiLog.level(info) << "SoapySDR:Actual tx antenna: " << + etiLog.level(info) << "SoapySDR:Actual TX antenna: " << m_device->getAntenna(SOAPY_SDR_TX, 0); if (m_device->hasHardwareTime()) { @@ -157,6 +165,20 @@ double Soapy::get_txgain(void) const return m_device->getGain(SOAPY_SDR_TX, 0); } +void Soapy::set_bandwidth(double bandwidth) +{ + m_conf.bandwidth = bandwidth; + if (not m_device) throw runtime_error("Soapy device not set up"); + m_device->setBandwidth(SOAPY_SDR_TX, 0, m_conf.bandwidth); + m_device->setBandwidth(SOAPY_SDR_RX, 0, m_conf.bandwidth); +} + +double Soapy::get_bandwidth(void) const +{ + if (not m_device) throw runtime_error("Soapy device not set up"); + return m_device->getBandwidth(SOAPY_SDR_TX, 0); +} + SDRDevice::RunStatistics Soapy::get_run_statistics(void) const { RunStatistics rs; |