|
|
|
|
@ -2043,143 +2043,6 @@ bool WebAPIRequestMapper::validateChannelSettings(
@@ -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, |
|
|
|
|
|