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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user