1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

SoapySDR: added try/catch blocks around calls to SoapySDR interface methods where missing

This commit is contained in:
f4exb 2019-01-13 23:33:31 +01:00
parent 00ca85c0bf
commit 932048dba0
2 changed files with 38 additions and 10 deletions

View File

@ -720,10 +720,17 @@ void SoapySDROutput::updateGains(SoapySDR::Device *dev, int requestedChannel, So
return;
}
settings.m_globalGain = round(dev->getGain(SOAPY_SDR_TX, requestedChannel));
try
{
settings.m_globalGain = round(dev->getGain(SOAPY_SDR_TX, requestedChannel));
for (const auto &name : settings.m_individualGains.keys()) {
settings.m_individualGains[name] = dev->getGain(SOAPY_SDR_TX, requestedChannel, name.toStdString());
for (const auto &name : settings.m_individualGains.keys()) {
settings.m_individualGains[name] = dev->getGain(SOAPY_SDR_TX, requestedChannel, name.toStdString());
}
}
catch (const std::exception &ex)
{
qCritical("SoapySDROutput::updateGains: caught exception: %s", ex.what());
}
}
@ -733,8 +740,15 @@ void SoapySDROutput::updateTunableElements(SoapySDR::Device *dev, int requestedC
return;
}
for (const auto &name : settings.m_tunableElements.keys()) {
settings.m_tunableElements[name] = dev->getFrequency(SOAPY_SDR_TX, requestedChannel, name.toStdString());
try
{
for (const auto &name : settings.m_tunableElements.keys()) {
settings.m_tunableElements[name] = dev->getFrequency(SOAPY_SDR_TX, requestedChannel, name.toStdString());
}
}
catch (const std::exception &ex)
{
qCritical("SoapySDROutput::updateTunableElements: caught exception: %s", ex.what());
}
}

View File

@ -749,10 +749,17 @@ void SoapySDRInput::updateGains(SoapySDR::Device *dev, int requestedChannel, Soa
return;
}
settings.m_globalGain = round(dev->getGain(SOAPY_SDR_RX, requestedChannel));
try
{
settings.m_globalGain = round(dev->getGain(SOAPY_SDR_RX, requestedChannel));
for (const auto &name : settings.m_individualGains.keys()) {
settings.m_individualGains[name] = dev->getGain(SOAPY_SDR_RX, requestedChannel, name.toStdString());
for (const auto &name : settings.m_individualGains.keys()) {
settings.m_individualGains[name] = dev->getGain(SOAPY_SDR_RX, requestedChannel, name.toStdString());
}
}
catch (const std::exception &ex)
{
qCritical("SoapySDRInput::updateGains: caught exception: %s", ex.what());
}
}
@ -762,8 +769,15 @@ void SoapySDRInput::updateTunableElements(SoapySDR::Device *dev, int requestedCh
return;
}
for (const auto &name : settings.m_tunableElements.keys()) {
settings.m_tunableElements[name] = dev->getFrequency(SOAPY_SDR_RX, requestedChannel, name.toStdString());
try
{
for (const auto &name : settings.m_tunableElements.keys()) {
settings.m_tunableElements[name] = dev->getFrequency(SOAPY_SDR_RX, requestedChannel, name.toStdString());
}
}
catch (const std::exception &ex)
{
qCritical("SoapySDRInput::updateTunableElements: caught exception: %s", ex.what());
}
}