diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 2fb880e6f..6a149d513 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -2043,143 +2043,6 @@ bool WebAPIRequestMapper::validateChannelSettings( } } -bool WebAPIRequestMapper::validateChannelReport( - SWGSDRangel::SWGChannelReport& channelReport, - QJsonObject& jsonObject, - QStringList& channelReportKeys) -{ - if (jsonObject.contains("tx")) { - channelReport.setTx(jsonObject["tx"].toInt()); - } else { - channelReport.setTx(0); // assume Rx - } - - if (jsonObject.contains("channelType") && jsonObject["channelType"].isString()) { - channelReport.setChannelType(new QString(jsonObject["channelType"].toString())); - } else { - return false; - } - - QString *channelType = channelReport.getChannelType(); - - if (*channelType == "AMDemod") - { - if (channelReport.getTx() == 0) - { - QJsonObject amDemodReportJsonObject = jsonObject["AMDemodReport"].toObject(); - channelReportKeys = amDemodReportJsonObject.keys(); - channelReport.setAmDemodReport(new SWGSDRangel::SWGAMDemodReport()); - channelReport.getAmDemodReport()->fromJsonObject(amDemodReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "AMMod") - { - if (channelReport.getTx() != 0) - { - QJsonObject amModReportJsonObject = jsonObject["AMModReport"].toObject(); - channelReportKeys = amModReportJsonObject.keys(); - channelReport.setAmModReport(new SWGSDRangel::SWGAMModReport()); - channelReport.getAmModReport()->fromJsonObject(amModReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "ATVMod") - { - if (channelReport.getTx() != 0) - { - QJsonObject atvModReportJsonObject = jsonObject["ATVModReport"].toObject(); - channelReportKeys = atvModReportJsonObject.keys(); - channelReport.setAtvModReport(new SWGSDRangel::SWGATVModReport()); - channelReport.getAtvModReport()->fromJsonObject(atvModReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "NFMDemod") - { - if (channelReport.getTx() == 0) - { - QJsonObject nfmDemodReportJsonObject = jsonObject["NFMDemodReport"].toObject(); - channelReportKeys = nfmDemodReportJsonObject.keys(); - channelReport.setNfmDemodReport(new SWGSDRangel::SWGNFMDemodReport()); - channelReport.getNfmDemodReport()->fromJsonObject(nfmDemodReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "NFMMod") - { - if (channelReport.getTx() != 0) - { - QJsonObject nfmModReportJsonObject = jsonObject["NFMModReport"].toObject(); - channelReportKeys = nfmModReportJsonObject.keys(); - channelReport.setNfmModReport(new SWGSDRangel::SWGNFMModReport()); - channelReport.getNfmModReport()->fromJsonObject(nfmModReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "SSBMod") - { - if (channelReport.getTx() != 0) - { - QJsonObject ssbModReportJsonObject = jsonObject["SSBModReport"].toObject(); - channelReportKeys = ssbModReportJsonObject.keys(); - channelReport.setSsbModReport(new SWGSDRangel::SWGSSBModReport()); - channelReport.getSsbModReport()->fromJsonObject(ssbModReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "UDPSink") - { - if (channelReport.getTx() != 0) - { - QJsonObject udpSinkReportJsonObject = jsonObject["UDPSinkReport"].toObject(); - channelReportKeys = udpSinkReportJsonObject.keys(); - channelReport.setUdpSinkReport(new SWGSDRangel::SWGUDPSinkReport()); - channelReport.getUdpSinkReport()->fromJsonObject(udpSinkReportJsonObject); - return true; - } - else { - return false; - } - } - else if (*channelType == "WFMMod") - { - if (channelReport.getTx() != 0) - { - QJsonObject wfmModReportJsonObject = jsonObject["WFMModReport"].toObject(); - channelReportKeys = wfmModReportJsonObject.keys(); - channelReport.setWfmModReport(new SWGSDRangel::SWGWFMModReport()); - channelReport.getWfmModReport()->fromJsonObject(wfmModReportJsonObject); - return true; - } - else { - return false; - } - } - else - { - return false; - } -} - bool WebAPIRequestMapper::validateAudioInputDevice( SWGSDRangel::SWGAudioInputDevice& audioInputDevice, QJsonObject& jsonObject, diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index 33a598d30..0abb90913 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -81,7 +81,6 @@ private: bool validateDeviceListItem(SWGSDRangel::SWGDeviceListItem& deviceListItem, QJsonObject& jsonObject); bool validateDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings, QJsonObject& jsonObject, QStringList& deviceSettingsKeys); bool validateChannelSettings(SWGSDRangel::SWGChannelSettings& deviceSettings, QJsonObject& jsonObject, QStringList& channelSettingsKeys); - bool validateChannelReport(SWGSDRangel::SWGChannelReport& deviceReport, QJsonObject& jsonObject, QStringList& channelReportKeys); bool validateAudioInputDevice(SWGSDRangel::SWGAudioInputDevice& audioInputDevice, QJsonObject& jsonObject, QStringList& audioInputDeviceKeys); bool validateAudioOutputDevice(SWGSDRangel::SWGAudioOutputDevice& audioOutputDevice, QJsonObject& jsonObject, QStringList& audioOutputDeviceKeys);