1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

SoapySDR support: REST API: fixed individual gains and tunable elements settings

This commit is contained in:
f4exb 2018-11-15 23:00:55 +01:00
parent 2ab09f7e6c
commit 3da7933fa7
2 changed files with 24 additions and 16 deletions

View File

@ -1309,12 +1309,14 @@ int SoapySDROutput::webapiSettingsPutPatch(
{
QList<SWGSDRangel::SWGArgValue*> *tunableElements = response.getSoapySdrOutputSettings()->getTunableElements();
for (const auto itArg : *tunableElements)
for (const auto &itArg : *tunableElements)
{
auto ovalue = settings.m_tunableElements.find(*itArg->getKey());
QMap<QString, double>::iterator itSettings = settings.m_tunableElements.find(*(itArg->getKey()));
if ((ovalue != settings.m_tunableElements.end()) && (atof(itArg->getValueString()->toStdString().c_str()) != *ovalue)) {
m_settings.m_tunableElements[*itArg->getKey()] = atof(itArg->getValueString()->toStdString().c_str());
if (itSettings != settings.m_tunableElements.end())
{
QVariant v = webapiVariantFromArgValue(itArg);
itSettings.value() = v.toDouble();
}
}
}
@ -1327,12 +1329,14 @@ int SoapySDROutput::webapiSettingsPutPatch(
{
QList<SWGSDRangel::SWGArgValue*> *individualGains = response.getSoapySdrOutputSettings()->getIndividualGains();
for (const auto itArg : *individualGains)
for (const auto &itArg : *individualGains)
{
auto ovalue = settings.m_individualGains.find(*itArg->getKey());
QMap<QString, double>::iterator itSettings = settings.m_individualGains.find(*(itArg->getKey()));
if ((ovalue != settings.m_individualGains.end()) && (atof(itArg->getValueString()->toStdString().c_str()) != *ovalue)) {
m_settings.m_individualGains[*itArg->getKey()] = atof(itArg->getValueString()->toStdString().c_str());
if (itSettings != settings.m_individualGains.end())
{
QVariant v = webapiVariantFromArgValue(itArg);
itSettings.value() = v.toDouble();
}
}
}

View File

@ -1373,12 +1373,14 @@ int SoapySDRInput::webapiSettingsPutPatch(
{
QList<SWGSDRangel::SWGArgValue*> *tunableElements = response.getSoapySdrInputSettings()->getTunableElements();
for (const auto itArg : *tunableElements)
for (const auto &itArg : *tunableElements)
{
auto ovalue = settings.m_tunableElements.find(*itArg->getKey());
QMap<QString, double>::iterator itSettings = settings.m_tunableElements.find(*(itArg->getKey()));
if ((ovalue != settings.m_tunableElements.end()) && (atof(itArg->getValueString()->toStdString().c_str()) != *ovalue)) {
m_settings.m_tunableElements[*itArg->getKey()] = atof(itArg->getValueString()->toStdString().c_str());
if (itSettings != settings.m_tunableElements.end())
{
QVariant v = webapiVariantFromArgValue(itArg);
itSettings.value() = v.toDouble();
}
}
}
@ -1391,12 +1393,14 @@ int SoapySDRInput::webapiSettingsPutPatch(
{
QList<SWGSDRangel::SWGArgValue*> *individualGains = response.getSoapySdrInputSettings()->getIndividualGains();
for (const auto itArg : *individualGains)
for (const auto &itArg : *individualGains)
{
auto ovalue = settings.m_individualGains.find(*itArg->getKey());
QMap<QString, double>::iterator itSettings = settings.m_individualGains.find(*(itArg->getKey()));
if ((ovalue != settings.m_individualGains.end()) && (atof(itArg->getValueString()->toStdString().c_str()) != *ovalue)) {
m_settings.m_individualGains[*itArg->getKey()] = atof(itArg->getValueString()->toStdString().c_str());
if (itSettings != settings.m_individualGains.end())
{
QVariant v = webapiVariantFromArgValue(itArg);
itSettings.value() = v.toDouble();
}
}
}