diff --git a/CHANGELOG b/CHANGELOG index 69ec8f148..54101c163 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +sdrangel (4.10.0-1) unstable; urgency=medium + + * Support for KiwiSDR + + -- Edouard Griffiths, F4EXB Sun, 09 Jun 2019 20:44:06 +0100 + sdrangel (4.9.1-1) unstable; urgency=medium * WFM demod: variable RF bandwidth. Implements #320 diff --git a/debian/changelog b/debian/changelog index 69ec8f148..54101c163 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sdrangel (4.10.0-1) unstable; urgency=medium + + * Support for KiwiSDR + + -- Edouard Griffiths, F4EXB Sun, 09 Jun 2019 20:44:06 +0100 + sdrangel (4.9.1-1) unstable; urgency=medium * WFM demod: variable RF bandwidth. Implements #320 diff --git a/debian/control b/debian/control index 949540ae0..5f7450321 100644 --- a/debian/control +++ b/debian/control @@ -12,6 +12,7 @@ Build-Depends: debhelper (>= 9), qttools5-dev-tools, qtmultimedia5-dev, libqt5multimedia5-plugins, + libqt5websockets5-dev, libusb-1.0-0-dev, libboost-all-dev, librtlsdr-dev, diff --git a/plugins/samplesource/kiwisdr/CMakeLists.txt b/plugins/samplesource/kiwisdr/CMakeLists.txt index 49b34c3f4..b5d08adfe 100644 --- a/plugins/samplesource/kiwisdr/CMakeLists.txt +++ b/plugins/samplesource/kiwisdr/CMakeLists.txt @@ -15,6 +15,7 @@ set(kiwisdr_HEADERS ) include_directories( + ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${Boost_INCLUDE_DIRS} ) @@ -22,7 +23,6 @@ if(NOT SERVER_MODE) set(kiwisdr_SOURCES ${kiwisdr_SOURCES} kiwisdrgui.cpp - kiwisdrgui.ui ) set(kiwisdr_HEADERS diff --git a/plugins/samplesource/kiwisdr/kiwisdrgui.cpp b/plugins/samplesource/kiwisdr/kiwisdrgui.cpp index 1f1e2f917..29bee3b16 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrgui.cpp +++ b/plugins/samplesource/kiwisdr/kiwisdrgui.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2019 Vort // -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/plugins/samplesource/kiwisdr/kiwisdrgui.h b/plugins/samplesource/kiwisdr/kiwisdrgui.h index 2f40caff1..2cce8a58a 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrgui.h +++ b/plugins/samplesource/kiwisdr/kiwisdrgui.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2019 Vort // -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/plugins/samplesource/kiwisdr/kiwisdrinput.cpp b/plugins/samplesource/kiwisdr/kiwisdrinput.cpp index 01abc2bca..58b1ffb0f 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrinput.cpp +++ b/plugins/samplesource/kiwisdr/kiwisdrinput.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2019 Vort // -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -24,6 +24,9 @@ #include #include +#include "SWGDeviceSettings.h" +#include "SWGDeviceState.h" + #include "kiwisdrinput.h" #include "device/deviceapi.h" #include "kiwisdrworker.h" @@ -290,7 +293,9 @@ int KiwiSDRInput::webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage) { - return 404; + (void) errorMessage; + m_deviceAPI->getDeviceEngineStateStr(*response.getState()); + return 200; } int KiwiSDRInput::webapiRun( @@ -298,14 +303,29 @@ int KiwiSDRInput::webapiRun( SWGSDRangel::SWGDeviceState& response, QString& errorMessage) { - return 404; + (void) errorMessage; + m_deviceAPI->getDeviceEngineStateStr(*response.getState()); + MsgStartStop *message = MsgStartStop::create(run); + m_inputMessageQueue.push(message); + + if (m_guiMessageQueue) // forward to GUI if any + { + MsgStartStop *msgToGUI = MsgStartStop::create(run); + m_guiMessageQueue->push(msgToGUI); + } + + return 200; } int KiwiSDRInput::webapiSettingsGet( SWGSDRangel::SWGDeviceSettings& response, QString& errorMessage) { - return 404; + (void) errorMessage; + response.setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings()); + response.getKiwiSdrSettings()->init(); + webapiFormatDeviceSettings(response, m_settings); + return 200; } int KiwiSDRInput::webapiSettingsPutPatch( @@ -314,19 +334,126 @@ int KiwiSDRInput::webapiSettingsPutPatch( SWGSDRangel::SWGDeviceSettings& response, // query + response QString& errorMessage) { - return 404; + (void) errorMessage; + KiwiSDRSettings settings = m_settings; + + if (deviceSettingsKeys.contains("gain")) { + settings.m_gain = response.getKiwiSdrSettings()->getGain(); + } + if (deviceSettingsKeys.contains("useAGC")) { + settings.m_useAGC = response.getKiwiSdrSettings()->getUseAgc(); + } + if (deviceSettingsKeys.contains("centerFrequency")) { + settings.m_centerFrequency = response.getKiwiSdrSettings()->getCenterFrequency(); + } + if (deviceSettingsKeys.contains("serverAddress")) { + settings.m_serverAddress = *response.getKiwiSdrSettings()->getServerAddress(); + } + if (deviceSettingsKeys.contains("useReverseAPI")) { + settings.m_useReverseAPI = response.getKiwiSdrSettings()->getUseReverseApi() != 0; + } + if (deviceSettingsKeys.contains("reverseAPIAddress")) { + settings.m_reverseAPIAddress = *response.getKiwiSdrSettings()->getReverseApiAddress(); + } + if (deviceSettingsKeys.contains("reverseAPIPort")) { + settings.m_reverseAPIPort = response.getKiwiSdrSettings()->getReverseApiPort(); + } + if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) { + settings.m_reverseAPIDeviceIndex = response.getKiwiSdrSettings()->getReverseApiDeviceIndex(); + } + + MsgConfigureKiwiSDR *msg = MsgConfigureKiwiSDR::create(settings, force); + m_inputMessageQueue.push(msg); + + if (m_guiMessageQueue) // forward to GUI if any + { + MsgConfigureKiwiSDR *msgToGUI = MsgConfigureKiwiSDR::create(settings, force); + m_guiMessageQueue->push(msgToGUI); + } + + webapiFormatDeviceSettings(response, settings); + return 200; } void KiwiSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const KiwiSDRSettings& settings) { + response.getKiwiSdrSettings()->setGain(settings.m_gain); + response.getKiwiSdrSettings()->setUseAgc(settings.m_useAGC ? 1 : 0); + response.getKiwiSdrSettings()->setCenterFrequency(settings.m_centerFrequency); + + if (response.getKiwiSdrSettings()->getServerAddress()) { + *response.getKiwiSdrSettings()->getServerAddress() = settings.m_serverAddress; + } else { + response.getKiwiSdrSettings()->setServerAddress(new QString(settings.m_serverAddress)); + } } void KiwiSDRInput::webapiReverseSendSettings(QList& deviceSettingsKeys, const KiwiSDRSettings& settings, bool force) { + SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); + swgDeviceSettings->setDirection(0); // single Rx + swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex()); + swgDeviceSettings->setDeviceHwType(new QString("KiwiSDR")); + swgDeviceSettings->setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings()); + SWGSDRangel::SWGKiwiSDRSettings *swgKiwiSDRSettings = swgDeviceSettings->getKiwiSdrSettings(); + + // transfer data that has been modified. When force is on transfer all data except reverse API data + + if (deviceSettingsKeys.contains("gain")) { + swgKiwiSDRSettings->setGain(settings.m_gain); + } + if (deviceSettingsKeys.contains("useAGC")) { + swgKiwiSDRSettings->setUseAgc(settings.m_useAGC ? 1 : 0); + } + if (deviceSettingsKeys.contains("centerFrequency") || force) { + swgKiwiSDRSettings->setCenterFrequency(settings.m_centerFrequency); + } + if (deviceSettingsKeys.contains("serverAddress") || force) { + swgKiwiSDRSettings->setServerAddress(new QString(settings.m_serverAddress)); + } + + QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings") + .arg(settings.m_reverseAPIAddress) + .arg(settings.m_reverseAPIPort) + .arg(settings.m_reverseAPIDeviceIndex); + m_networkRequest.setUrl(QUrl(deviceSettingsURL)); + m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + QBuffer *buffer=new QBuffer(); + buffer->open((QBuffer::ReadWrite)); + buffer->write(swgDeviceSettings->asJson().toUtf8()); + buffer->seek(0); + + // Always use PATCH to avoid passing reverse API settings + m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer); + + delete swgDeviceSettings; } void KiwiSDRInput::webapiReverseSendStartStop(bool start) { + SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); + swgDeviceSettings->setDirection(0); // single Rx + swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex()); + swgDeviceSettings->setDeviceHwType(new QString("KiwiSDR")); + + QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run") + .arg(m_settings.m_reverseAPIAddress) + .arg(m_settings.m_reverseAPIPort) + .arg(m_settings.m_reverseAPIDeviceIndex); + m_networkRequest.setUrl(QUrl(deviceSettingsURL)); + m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + QBuffer *buffer=new QBuffer(); + buffer->open((QBuffer::ReadWrite)); + buffer->write(swgDeviceSettings->asJson().toUtf8()); + buffer->seek(0); + + if (start) { + m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer); + } else { + m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer); + } } void KiwiSDRInput::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/samplesource/kiwisdr/kiwisdrinput.h b/plugins/samplesource/kiwisdr/kiwisdrinput.h index 6c1b17653..63e061732 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrinput.h +++ b/plugins/samplesource/kiwisdr/kiwisdrinput.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2019 Vort // -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/plugins/samplesource/kiwisdr/kiwisdrplugin.cpp b/plugins/samplesource/kiwisdr/kiwisdrplugin.cpp index 06337e495..68b012123 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrplugin.cpp +++ b/plugins/samplesource/kiwisdr/kiwisdrplugin.cpp @@ -1,5 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Vort // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -29,7 +30,7 @@ const PluginDescriptor KiwiSDRPlugin::m_pluginDescriptor = { QString("KiwiSDR input"), - QString("0.0.1"), + QString("4.10.0"), QString("(c) Vort (c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/samplesource/kiwisdr/kiwisdrplugin.h b/plugins/samplesource/kiwisdr/kiwisdrplugin.h index 25fae1f05..e11434341 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrplugin.h +++ b/plugins/samplesource/kiwisdr/kiwisdrplugin.h @@ -1,5 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Vort // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/plugins/samplesource/kiwisdr/kiwisdrsettings.cpp b/plugins/samplesource/kiwisdr/kiwisdrsettings.cpp index 329863b62..21b30faf2 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrsettings.cpp +++ b/plugins/samplesource/kiwisdr/kiwisdrsettings.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2019 Vort // -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/plugins/samplesource/kiwisdr/kiwisdrsettings.h b/plugins/samplesource/kiwisdr/kiwisdrsettings.h index f2958f8b4..f651d97d7 100644 --- a/plugins/samplesource/kiwisdr/kiwisdrsettings.h +++ b/plugins/samplesource/kiwisdr/kiwisdrsettings.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2019 Vort // -// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// Copyright (C) 2019 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/sdrbase/resources/webapi.qrc b/sdrbase/resources/webapi.qrc index 424197f06..fb37821b5 100644 --- a/sdrbase/resources/webapi.qrc +++ b/sdrbase/resources/webapi.qrc @@ -20,6 +20,7 @@ webapi/doc/swagger/include/FreqTracker.yaml webapi/doc/swagger/include/HackRF.yaml webapi/doc/swagger/include/LimeSdr.yaml + webapi/doc/swagger/include/KiwiSDR.yaml webapi/doc/swagger/include/LocalInput.yaml webapi/doc/swagger/include/LocalOutput.yaml webapi/doc/swagger/include/NFMDemod.yaml diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 369d948b9..2886b3e4a 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -2297,6 +2297,9 @@ margin-bottom: 20px; "hackRFOutputSettings" : { "$ref" : "#/definitions/HackRFOutputSettings" }, + "kiwiSDRSettings" : { + "$ref" : "#/definitions/KiwiSDRSettings" + }, "limeSdrInputSettings" : { "$ref" : "#/definitions/LimeSdrInputSettings" }, @@ -3073,6 +3076,39 @@ margin-bottom: 20px; } }, "description" : "Summarized information about this SDRangel instance" +}; + defs.KiwiSDRSettings = { + "properties" : { + "gain" : { + "type" : "integer" + }, + "useAGC" : { + "type" : "integer", + "description" : "AGC active (1 for yes, 0 for no)" + }, + "centerFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "serverAddress" : { + "type" : "string", + "description" : "Distant KiwiSDR instance URL or IPv4 address with port" + }, + "useReverseAPI" : { + "type" : "integer", + "description" : "Synchronize with reverse API (1 for yes, 0 for no)" + }, + "reverseAPIAddress" : { + "type" : "string" + }, + "reverseAPIPort" : { + "type" : "integer" + }, + "reverseAPIDeviceIndex" : { + "type" : "integer" + } + }, + "description" : "KiwiSDR" }; defs.LimeSdrInputReport = { "properties" : { @@ -25100,7 +25136,7 @@ except ApiException as e:
- Generated 2019-05-25T21:27:31.978+02:00 + Generated 2019-06-08T11:06:14.976+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/KiwiSDR.yaml b/sdrbase/resources/webapi/doc/swagger/include/KiwiSDR.yaml new file mode 100644 index 000000000..7359a0870 --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/KiwiSDR.yaml @@ -0,0 +1,23 @@ +KiwiSDRSettings: + description: KiwiSDR + properties: + gain: + type: integer + useAGC: + description: AGC active (1 for yes, 0 for no) + type: integer + centerFrequency: + type: integer + format: int64 + serverAddress: + description: Distant KiwiSDR instance URL or IPv4 address with port + type: string + useReverseAPI: + description: Synchronize with reverse API (1 for yes, 0 for no) + type: integer + reverseAPIAddress: + type: string + reverseAPIPort: + type: integer + reverseAPIDeviceIndex: + type: integer diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 8d6a6fbfc..dab008a9a 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1802,6 +1802,8 @@ definitions: $ref: "/doc/swagger/include/HackRF.yaml#/HackRFInputSettings" hackRFOutputSettings: $ref: "/doc/swagger/include/HackRF.yaml#/HackRFOutputSettings" + kiwiSDRSettings: + $ref: "/doc/swagger/include/KiwiSDR.yaml#/KiwiSDRSettings" limeSdrInputSettings: $ref: "/doc/swagger/include/LimeSdr.yaml#/LimeSdrInputSettings" limeSdrOutputSettings: diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 91a1f87e4..dcfcef89b 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -1944,6 +1944,21 @@ bool WebAPIRequestMapper::validateDeviceSettings( return false; } } + else if ((*deviceHwType == "KiwiSDR") && (deviceSettings.getDirection() == 0)) + { + if (jsonObject.contains("kiwiSDRSettings") && jsonObject["kiwiSDRSettings"].isObject()) + { + QJsonObject kiwiSDRSettingsJsonObject = jsonObject["kiwiSDRSettings"].toObject(); + deviceSettingsKeys = kiwiSDRSettingsJsonObject.keys(); + deviceSettings.setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings()); + deviceSettings.getKiwiSdrSettings()->fromJsonObject(kiwiSDRSettingsJsonObject); + return true; + } + else + { + return false; + } + } else if ((*deviceHwType == "LimeSDR") && (deviceSettings.getDirection() == 0)) { if (jsonObject.contains("limeSdrInputSettings") && jsonObject["limeSdrInputSettings"].isObject()) diff --git a/swagger/sdrangel/api/swagger/include/KiwiSDR.yaml b/swagger/sdrangel/api/swagger/include/KiwiSDR.yaml new file mode 100644 index 000000000..7359a0870 --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/KiwiSDR.yaml @@ -0,0 +1,23 @@ +KiwiSDRSettings: + description: KiwiSDR + properties: + gain: + type: integer + useAGC: + description: AGC active (1 for yes, 0 for no) + type: integer + centerFrequency: + type: integer + format: int64 + serverAddress: + description: Distant KiwiSDR instance URL or IPv4 address with port + type: string + useReverseAPI: + description: Synchronize with reverse API (1 for yes, 0 for no) + type: integer + reverseAPIAddress: + type: string + reverseAPIPort: + type: integer + reverseAPIDeviceIndex: + type: integer diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 6c7a69e96..71ea3bd5d 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1802,6 +1802,8 @@ definitions: $ref: "http://localhost:8081/api/swagger/include/HackRF.yaml#/HackRFInputSettings" hackRFOutputSettings: $ref: "http://localhost:8081/api/swagger/include/HackRF.yaml#/HackRFOutputSettings" + kiwiSDRSettings: + $ref: "http://localhost:8081/api/swagger/include/KiwiSDR.yaml#/KiwiSDRSettings" limeSdrInputSettings: $ref: "http://localhost:8081/api/swagger/include/LimeSdr.yaml#/LimeSdrInputSettings" limeSdrOutputSettings: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 369d948b9..2886b3e4a 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -2297,6 +2297,9 @@ margin-bottom: 20px; "hackRFOutputSettings" : { "$ref" : "#/definitions/HackRFOutputSettings" }, + "kiwiSDRSettings" : { + "$ref" : "#/definitions/KiwiSDRSettings" + }, "limeSdrInputSettings" : { "$ref" : "#/definitions/LimeSdrInputSettings" }, @@ -3073,6 +3076,39 @@ margin-bottom: 20px; } }, "description" : "Summarized information about this SDRangel instance" +}; + defs.KiwiSDRSettings = { + "properties" : { + "gain" : { + "type" : "integer" + }, + "useAGC" : { + "type" : "integer", + "description" : "AGC active (1 for yes, 0 for no)" + }, + "centerFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "serverAddress" : { + "type" : "string", + "description" : "Distant KiwiSDR instance URL or IPv4 address with port" + }, + "useReverseAPI" : { + "type" : "integer", + "description" : "Synchronize with reverse API (1 for yes, 0 for no)" + }, + "reverseAPIAddress" : { + "type" : "string" + }, + "reverseAPIPort" : { + "type" : "integer" + }, + "reverseAPIDeviceIndex" : { + "type" : "integer" + } + }, + "description" : "KiwiSDR" }; defs.LimeSdrInputReport = { "properties" : { @@ -25100,7 +25136,7 @@ except ApiException as e:
- Generated 2019-05-25T21:27:31.978+02:00 + Generated 2019-06-08T11:06:14.976+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp index 7ed2bcc3a..7ee2aad35 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp @@ -56,6 +56,8 @@ SWGDeviceSettings::SWGDeviceSettings() { m_hack_rf_input_settings_isSet = false; hack_rf_output_settings = nullptr; m_hack_rf_output_settings_isSet = false; + kiwi_sdr_settings = nullptr; + m_kiwi_sdr_settings_isSet = false; lime_sdr_input_settings = nullptr; m_lime_sdr_input_settings_isSet = false; lime_sdr_output_settings = nullptr; @@ -126,6 +128,8 @@ SWGDeviceSettings::init() { m_hack_rf_input_settings_isSet = false; hack_rf_output_settings = new SWGHackRFOutputSettings(); m_hack_rf_output_settings_isSet = false; + kiwi_sdr_settings = new SWGKiwiSDRSettings(); + m_kiwi_sdr_settings_isSet = false; lime_sdr_input_settings = new SWGLimeSdrInputSettings(); m_lime_sdr_input_settings_isSet = false; lime_sdr_output_settings = new SWGLimeSdrOutputSettings(); @@ -202,6 +206,9 @@ SWGDeviceSettings::cleanup() { if(hack_rf_output_settings != nullptr) { delete hack_rf_output_settings; } + if(kiwi_sdr_settings != nullptr) { + delete kiwi_sdr_settings; + } if(lime_sdr_input_settings != nullptr) { delete lime_sdr_input_settings; } @@ -294,6 +301,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&hack_rf_output_settings, pJson["hackRFOutputSettings"], "SWGHackRFOutputSettings", "SWGHackRFOutputSettings"); + ::SWGSDRangel::setValue(&kiwi_sdr_settings, pJson["kiwiSDRSettings"], "SWGKiwiSDRSettings", "SWGKiwiSDRSettings"); + ::SWGSDRangel::setValue(&lime_sdr_input_settings, pJson["limeSdrInputSettings"], "SWGLimeSdrInputSettings", "SWGLimeSdrInputSettings"); ::SWGSDRangel::setValue(&lime_sdr_output_settings, pJson["limeSdrOutputSettings"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings"); @@ -386,6 +395,9 @@ SWGDeviceSettings::asJsonObject() { if((hack_rf_output_settings != nullptr) && (hack_rf_output_settings->isSet())){ toJsonValue(QString("hackRFOutputSettings"), hack_rf_output_settings, obj, QString("SWGHackRFOutputSettings")); } + if((kiwi_sdr_settings != nullptr) && (kiwi_sdr_settings->isSet())){ + toJsonValue(QString("kiwiSDRSettings"), kiwi_sdr_settings, obj, QString("SWGKiwiSDRSettings")); + } if((lime_sdr_input_settings != nullptr) && (lime_sdr_input_settings->isSet())){ toJsonValue(QString("limeSdrInputSettings"), lime_sdr_input_settings, obj, QString("SWGLimeSdrInputSettings")); } @@ -581,6 +593,16 @@ SWGDeviceSettings::setHackRfOutputSettings(SWGHackRFOutputSettings* hack_rf_outp this->m_hack_rf_output_settings_isSet = true; } +SWGKiwiSDRSettings* +SWGDeviceSettings::getKiwiSdrSettings() { + return kiwi_sdr_settings; +} +void +SWGDeviceSettings::setKiwiSdrSettings(SWGKiwiSDRSettings* kiwi_sdr_settings) { + this->kiwi_sdr_settings = kiwi_sdr_settings; + this->m_kiwi_sdr_settings_isSet = true; +} + SWGLimeSdrInputSettings* SWGDeviceSettings::getLimeSdrInputSettings() { return lime_sdr_input_settings; @@ -770,6 +792,7 @@ SWGDeviceSettings::isSet(){ if(file_source_settings != nullptr && file_source_settings->isSet()){ isObjectUpdated = true; break;} if(hack_rf_input_settings != nullptr && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break;} if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;} + if(kiwi_sdr_settings != nullptr && kiwi_sdr_settings->isSet()){ isObjectUpdated = true; break;} if(lime_sdr_input_settings != nullptr && lime_sdr_input_settings->isSet()){ isObjectUpdated = true; break;} if(lime_sdr_output_settings != nullptr && lime_sdr_output_settings->isSet()){ isObjectUpdated = true; break;} if(local_input_settings != nullptr && local_input_settings->isSet()){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h index fdc91d022..ba1ee762b 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h @@ -33,6 +33,7 @@ #include "SWGFileSourceSettings.h" #include "SWGHackRFInputSettings.h" #include "SWGHackRFOutputSettings.h" +#include "SWGKiwiSDRSettings.h" #include "SWGLimeSdrInputSettings.h" #include "SWGLimeSdrOutputSettings.h" #include "SWGLocalInputSettings.h" @@ -112,6 +113,9 @@ public: SWGHackRFOutputSettings* getHackRfOutputSettings(); void setHackRfOutputSettings(SWGHackRFOutputSettings* hack_rf_output_settings); + SWGKiwiSDRSettings* getKiwiSdrSettings(); + void setKiwiSdrSettings(SWGKiwiSDRSettings* kiwi_sdr_settings); + SWGLimeSdrInputSettings* getLimeSdrInputSettings(); void setLimeSdrInputSettings(SWGLimeSdrInputSettings* lime_sdr_input_settings); @@ -209,6 +213,9 @@ private: SWGHackRFOutputSettings* hack_rf_output_settings; bool m_hack_rf_output_settings_isSet; + SWGKiwiSDRSettings* kiwi_sdr_settings; + bool m_kiwi_sdr_settings_isSet; + SWGLimeSdrInputSettings* lime_sdr_input_settings; bool m_lime_sdr_input_settings_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGKiwiSDRSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGKiwiSDRSettings.cpp new file mode 100644 index 000000000..7cbe5447a --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGKiwiSDRSettings.cpp @@ -0,0 +1,257 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 4.8.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGKiwiSDRSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGKiwiSDRSettings::SWGKiwiSDRSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGKiwiSDRSettings::SWGKiwiSDRSettings() { + gain = 0; + m_gain_isSet = false; + use_agc = 0; + m_use_agc_isSet = false; + center_frequency = 0L; + m_center_frequency_isSet = false; + server_address = nullptr; + m_server_address_isSet = false; + use_reverse_api = 0; + m_use_reverse_api_isSet = false; + reverse_api_address = nullptr; + m_reverse_api_address_isSet = false; + reverse_api_port = 0; + m_reverse_api_port_isSet = false; + reverse_api_device_index = 0; + m_reverse_api_device_index_isSet = false; +} + +SWGKiwiSDRSettings::~SWGKiwiSDRSettings() { + this->cleanup(); +} + +void +SWGKiwiSDRSettings::init() { + gain = 0; + m_gain_isSet = false; + use_agc = 0; + m_use_agc_isSet = false; + center_frequency = 0L; + m_center_frequency_isSet = false; + server_address = new QString(""); + m_server_address_isSet = false; + use_reverse_api = 0; + m_use_reverse_api_isSet = false; + reverse_api_address = new QString(""); + m_reverse_api_address_isSet = false; + reverse_api_port = 0; + m_reverse_api_port_isSet = false; + reverse_api_device_index = 0; + m_reverse_api_device_index_isSet = false; +} + +void +SWGKiwiSDRSettings::cleanup() { + + + + if(server_address != nullptr) { + delete server_address; + } + + if(reverse_api_address != nullptr) { + delete reverse_api_address; + } + + +} + +SWGKiwiSDRSettings* +SWGKiwiSDRSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGKiwiSDRSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", ""); + + ::SWGSDRangel::setValue(&use_agc, pJson["useAGC"], "qint32", ""); + + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", ""); + + ::SWGSDRangel::setValue(&server_address, pJson["serverAddress"], "QString", "QString"); + + ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); + + ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); + + ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", ""); + + ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", ""); + +} + +QString +SWGKiwiSDRSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGKiwiSDRSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_gain_isSet){ + obj->insert("gain", QJsonValue(gain)); + } + if(m_use_agc_isSet){ + obj->insert("useAGC", QJsonValue(use_agc)); + } + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(server_address != nullptr && *server_address != QString("")){ + toJsonValue(QString("serverAddress"), server_address, obj, QString("QString")); + } + if(m_use_reverse_api_isSet){ + obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); + } + if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ + toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString")); + } + if(m_reverse_api_port_isSet){ + obj->insert("reverseAPIPort", QJsonValue(reverse_api_port)); + } + if(m_reverse_api_device_index_isSet){ + obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index)); + } + + return obj; +} + +qint32 +SWGKiwiSDRSettings::getGain() { + return gain; +} +void +SWGKiwiSDRSettings::setGain(qint32 gain) { + this->gain = gain; + this->m_gain_isSet = true; +} + +qint32 +SWGKiwiSDRSettings::getUseAgc() { + return use_agc; +} +void +SWGKiwiSDRSettings::setUseAgc(qint32 use_agc) { + this->use_agc = use_agc; + this->m_use_agc_isSet = true; +} + +qint64 +SWGKiwiSDRSettings::getCenterFrequency() { + return center_frequency; +} +void +SWGKiwiSDRSettings::setCenterFrequency(qint64 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +QString* +SWGKiwiSDRSettings::getServerAddress() { + return server_address; +} +void +SWGKiwiSDRSettings::setServerAddress(QString* server_address) { + this->server_address = server_address; + this->m_server_address_isSet = true; +} + +qint32 +SWGKiwiSDRSettings::getUseReverseApi() { + return use_reverse_api; +} +void +SWGKiwiSDRSettings::setUseReverseApi(qint32 use_reverse_api) { + this->use_reverse_api = use_reverse_api; + this->m_use_reverse_api_isSet = true; +} + +QString* +SWGKiwiSDRSettings::getReverseApiAddress() { + return reverse_api_address; +} +void +SWGKiwiSDRSettings::setReverseApiAddress(QString* reverse_api_address) { + this->reverse_api_address = reverse_api_address; + this->m_reverse_api_address_isSet = true; +} + +qint32 +SWGKiwiSDRSettings::getReverseApiPort() { + return reverse_api_port; +} +void +SWGKiwiSDRSettings::setReverseApiPort(qint32 reverse_api_port) { + this->reverse_api_port = reverse_api_port; + this->m_reverse_api_port_isSet = true; +} + +qint32 +SWGKiwiSDRSettings::getReverseApiDeviceIndex() { + return reverse_api_device_index; +} +void +SWGKiwiSDRSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) { + this->reverse_api_device_index = reverse_api_device_index; + this->m_reverse_api_device_index_isSet = true; +} + + +bool +SWGKiwiSDRSettings::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_gain_isSet){ isObjectUpdated = true; break;} + if(m_use_agc_isSet){ isObjectUpdated = true; break;} + if(m_center_frequency_isSet){ isObjectUpdated = true; break;} + if(server_address != nullptr && *server_address != QString("")){ isObjectUpdated = true; break;} + if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;} + if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;} + if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;} + if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGKiwiSDRSettings.h b/swagger/sdrangel/code/qt5/client/SWGKiwiSDRSettings.h new file mode 100644 index 000000000..08f8853e2 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGKiwiSDRSettings.h @@ -0,0 +1,101 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 4.8.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGKiwiSDRSettings.h + * + * KiwiSDR + */ + +#ifndef SWGKiwiSDRSettings_H_ +#define SWGKiwiSDRSettings_H_ + +#include + + +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGKiwiSDRSettings: public SWGObject { +public: + SWGKiwiSDRSettings(); + SWGKiwiSDRSettings(QString* json); + virtual ~SWGKiwiSDRSettings(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGKiwiSDRSettings* fromJson(QString &jsonString) override; + + qint32 getGain(); + void setGain(qint32 gain); + + qint32 getUseAgc(); + void setUseAgc(qint32 use_agc); + + qint64 getCenterFrequency(); + void setCenterFrequency(qint64 center_frequency); + + QString* getServerAddress(); + void setServerAddress(QString* server_address); + + qint32 getUseReverseApi(); + void setUseReverseApi(qint32 use_reverse_api); + + QString* getReverseApiAddress(); + void setReverseApiAddress(QString* reverse_api_address); + + qint32 getReverseApiPort(); + void setReverseApiPort(qint32 reverse_api_port); + + qint32 getReverseApiDeviceIndex(); + void setReverseApiDeviceIndex(qint32 reverse_api_device_index); + + + virtual bool isSet() override; + +private: + qint32 gain; + bool m_gain_isSet; + + qint32 use_agc; + bool m_use_agc_isSet; + + qint64 center_frequency; + bool m_center_frequency_isSet; + + QString* server_address; + bool m_server_address_isSet; + + qint32 use_reverse_api; + bool m_use_reverse_api_isSet; + + QString* reverse_api_address; + bool m_reverse_api_address_isSet; + + qint32 reverse_api_port; + bool m_reverse_api_port_isSet; + + qint32 reverse_api_device_index; + bool m_reverse_api_device_index_isSet; + +}; + +} + +#endif /* SWGKiwiSDRSettings_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index b3f4afdd6..4dd166421 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -75,6 +75,7 @@ #include "SWGInstanceChannelsResponse.h" #include "SWGInstanceDevicesResponse.h" #include "SWGInstanceSummaryResponse.h" +#include "SWGKiwiSDRSettings.h" #include "SWGLimeSdrInputReport.h" #include "SWGLimeSdrInputSettings.h" #include "SWGLimeSdrOutputReport.h" @@ -334,6 +335,9 @@ namespace SWGSDRangel { if(QString("SWGInstanceSummaryResponse").compare(type) == 0) { return new SWGInstanceSummaryResponse(); } + if(QString("SWGKiwiSDRSettings").compare(type) == 0) { + return new SWGKiwiSDRSettings(); + } if(QString("SWGLimeSdrInputReport").compare(type) == 0) { return new SWGLimeSdrInputReport(); }