1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 22:14:45 -04:00

Web API: NFM modulator settings parameters optional

This commit is contained in:
f4exb
2017-12-24 04:19:44 +01:00
parent d08917897c
commit 7577e6f145
3 changed files with 114 additions and 30 deletions
+21
View File
@@ -1468,6 +1468,13 @@ bool WebAPIRequestMapper::validateChannelSettings(
{
QJsonObject nfmModSettingsJsonObject = jsonObject["NFMModSettings"].toObject();
channelSettingsKeys = nfmModSettingsJsonObject.keys();
if (channelSettingsKeys.contains("cwKeyer"))
{
QJsonObject cwKeyerSettingsJsonObject;
appendSettingsSubKeys(nfmModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
}
channelSettings.setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
channelSettings.getNfmModSettings()->fromJsonObject(nfmModSettingsJsonObject);
return true;
@@ -1482,6 +1489,20 @@ bool WebAPIRequestMapper::validateChannelSettings(
}
}
void WebAPIRequestMapper::appendSettingsSubKeys(
const QJsonObject& parentSettingsJsonObject,
QJsonObject& childSettingsJsonObject,
const QString& parentKey,
QStringList& keyList)
{
childSettingsJsonObject = parentSettingsJsonObject[parentKey].toObject();
QStringList childSettingsKeys = childSettingsJsonObject.keys();
for (int i = 0; i < childSettingsKeys.size(); i++) {
keyList.append(parentKey + QString(".") + childSettingsKeys.at(i));
}
}
void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings)
{
deviceSettings.cleanup();