From 8d4dc0c8ff86bb0d8ec34bcd8c79d2607dc2df37 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 16 Jan 2019 01:56:43 +0100 Subject: [PATCH] XTRX output: REST API fixes --- plugins/samplesink/xtrxoutput/xtrxoutput.cpp | 6 +++--- sdrbase/webapi/webapirequestmapper.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/samplesink/xtrxoutput/xtrxoutput.cpp b/plugins/samplesink/xtrxoutput/xtrxoutput.cpp index bdeed42b5..ecff4d2cd 100644 --- a/plugins/samplesink/xtrxoutput/xtrxoutput.cpp +++ b/plugins/samplesink/xtrxoutput/xtrxoutput.cpp @@ -1171,8 +1171,8 @@ int XTRXOutput::webapiSettingsGet( QString& errorMessage) { (void) errorMessage; - response.setXtrxInputSettings(new SWGSDRangel::SWGXtrxInputSettings()); - response.getXtrxInputSettings()->init(); + response.setXtrxOutputSettings(new SWGSDRangel::SWGXtrxOutputSettings()); + response.getXtrxOutputSettings()->init(); webapiFormatDeviceSettings(response, m_settings); return 200; } @@ -1280,7 +1280,7 @@ int XTRXOutput::webapiReportGet( { (void) errorMessage; response.setXtrxOutputReport(new SWGSDRangel::SWGXtrxOutputReport()); - response.getXtrxInputReport()->init(); + response.getXtrxOutputReport()->init(); webapiFormatDeviceReport(response); return 200; } diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 8f403ed85..8a577e5d3 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -2085,6 +2085,21 @@ bool WebAPIRequestMapper::validateDeviceSettings( return false; } } + else if ((*deviceHwType == "XTRX") && (deviceSettings.getTx() != 0)) + { + if (jsonObject.contains("xtrxOutputSettings") && jsonObject["xtrxOutputSettings"].isObject()) + { + QJsonObject xtrxOutputSettingsJsonObject = jsonObject["xtrxOutputSettings"].toObject(); + deviceSettingsKeys = xtrxOutputSettingsJsonObject.keys(); + deviceSettings.setXtrxOutputSettings(new SWGSDRangel::SWGXtrxOutputSettings()); + deviceSettings.getXtrxOutputSettings()->fromJsonObject(xtrxOutputSettingsJsonObject); + return true; + } + else + { + return false; + } + } else { return false;