From 6e828066e020a1c7f2af82afb42f8744a3e18286 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 27 May 2018 11:07:24 +0200 Subject: [PATCH] SDRdaemon input: implemeted WEB API --- .../sdrdaemonsource/sdrdaemonsourcegui.cpp | 2 +- .../sdrdaemonsource/sdrdaemonsourceinput.cpp | 127 +++++- .../sdrdaemonsource/sdrdaemonsourceinput.h | 16 + .../sdrdaemonsourceudphandler.h | 5 + sdrbase/resources/webapi/doc/html2/index.html | 84 +++- .../doc/swagger/include/SDRDaemonSource.yaml | 55 +++ .../resources/webapi/doc/swagger/swagger.yaml | 4 + .../api/swagger/include/SDRDaemonSource.yaml | 55 +++ swagger/sdrangel/api/swagger/swagger.yaml | 4 + swagger/sdrangel/code/html2/index.html | 84 +++- .../code/qt5/client/SWGDeviceReport.cpp | 23 ++ .../code/qt5/client/SWGDeviceReport.h | 7 + .../code/qt5/client/SWGDeviceSettings.cpp | 23 ++ .../code/qt5/client/SWGDeviceSettings.h | 7 + .../code/qt5/client/SWGModelFactory.h | 8 + .../qt5/client/SWGSDRdaemonSourceReport.cpp | 213 ++++++++++ .../qt5/client/SWGSDRdaemonSourceReport.h | 89 +++++ .../qt5/client/SWGSDRdaemonSourceSettings.cpp | 364 ++++++++++++++++++ .../qt5/client/SWGSDRdaemonSourceSettings.h | 131 +++++++ 19 files changed, 1295 insertions(+), 6 deletions(-) create mode 100644 sdrbase/resources/webapi/doc/swagger/include/SDRDaemonSource.yaml create mode 100644 swagger/sdrangel/api/swagger/include/SDRDaemonSource.yaml create mode 100644 swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.h create mode 100644 swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.h diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcegui.cpp b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcegui.cpp index 86510b77a..a0e23d9e2 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcegui.cpp +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcegui.cpp @@ -633,7 +633,7 @@ void SDRdaemonSourceGui::updateStatus() } } -void SDRdaemonSourceGui::tick() +void SDRdaemonSourceGui::tick() // FIXME: needed? { if ((++m_tickCount & 0xf) == 0) { SDRdaemonSourceInput::MsgConfigureSDRdaemonStreamTiming* message = SDRdaemonSourceInput::MsgConfigureSDRdaemonStreamTiming::create(); diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp index 62fc4cadd..84232843c 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp @@ -16,8 +16,10 @@ #include #include +#include #include + #ifdef _WIN32 #include #include @@ -28,6 +30,8 @@ #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" +#include "SWGDeviceReport.h" +#include "SWGSDRdaemonSourceReport.h" #include "util/simpleserializer.h" #include "dsp/dspcommands.h" @@ -228,11 +232,11 @@ bool SDRdaemonSourceInput::handleMessage(const Message& message) applySettings(conf.getSettings(), conf.getForce()); return true; } - else if (MsgConfigureSDRdaemonStreamTiming::match(message)) + else if (MsgConfigureSDRdaemonStreamTiming::match(message)) // FIXME: really needed? UDP handler is connected to timer { return true; } - else if (MsgReportSDRdaemonSourceStreamData::match(message)) + else if (MsgReportSDRdaemonSourceStreamData::match(message)) // FIXME: really needed? UDP handler sends it to GUI already { // Forward message to the GUI if it is present if (getMessageQueueToGUI()) { @@ -242,7 +246,7 @@ bool SDRdaemonSourceInput::handleMessage(const Message& message) return true; // delete the unused message } } - else if (MsgReportSDRdaemonSourceStreamTiming::match(message)) + else if (MsgReportSDRdaemonSourceStreamTiming::match(message)) // FIXME: really needed? UDP handler sends it to GUI already { // Forward message to the GUI if it is present if (getMessageQueueToGUI()) { @@ -432,3 +436,120 @@ int SDRdaemonSourceInput::webapiRun( return 200; } +int SDRdaemonSourceInput::webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage __attribute__((unused))) +{ + response.setSdrDaemonSourceSettings(new SWGSDRangel::SWGSDRdaemonSourceSettings()); + response.getSdrDaemonSourceSettings()->init(); + webapiFormatDeviceSettings(response, m_settings); + return 200; +} + +int SDRdaemonSourceInput::webapiSettingsPutPatch( + bool force, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response, // query + response + QString& errorMessage __attribute__((unused))) +{ + SDRdaemonSourceSettings settings = m_settings; + + if (deviceSettingsKeys.contains("centerFrequency")) { + settings.m_centerFrequency = response.getSdrDaemonSourceSettings()->getCenterFrequency(); + } + if (deviceSettingsKeys.contains("sampleRate")) { + settings.m_sampleRate = response.getSdrDaemonSourceSettings()->getSampleRate(); + } + if (deviceSettingsKeys.contains("log2Decim")) { + settings.m_log2Decim = response.getSdrDaemonSourceSettings()->getLog2Decim(); + } + if (deviceSettingsKeys.contains("txDelay")) { + settings.m_txDelay = response.getSdrDaemonSourceSettings()->getTxDelay(); + } + if (deviceSettingsKeys.contains("nbFECBlocks")) { + settings.m_txDelay = response.getSdrDaemonSourceSettings()->getNbFecBlocks(); + } + if (deviceSettingsKeys.contains("address")) { + settings.m_address = *response.getSdrDaemonSourceSettings()->getAddress(); + } + if (deviceSettingsKeys.contains("dataPort")) { + settings.m_dataPort = response.getSdrDaemonSourceSettings()->getDataPort(); + } + if (deviceSettingsKeys.contains("controlPort")) { + settings.m_controlPort = response.getSdrDaemonSourceSettings()->getControlPort(); + } + if (deviceSettingsKeys.contains("specificParameters")) { + settings.m_specificParameters = *response.getSdrDaemonSourceSettings()->getSpecificParameters(); + } + if (deviceSettingsKeys.contains("dcBlock")) { + settings.m_dcBlock = response.getSdrDaemonSourceSettings()->getDcBlock() != 0; + } + if (deviceSettingsKeys.contains("iqCorrection")) { + settings.m_iqCorrection = response.getSdrDaemonSourceSettings()->getIqCorrection() != 0; + } + if (deviceSettingsKeys.contains("fcPos")) { + int fcPos = response.getSdrDaemonSourceSettings()->getFcPos(); + settings.m_fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos; + } + if (deviceSettingsKeys.contains("fileRecordName")) { + settings.m_fileRecordName = *response.getSdrDaemonSourceSettings()->getFileRecordName(); + } + + MsgConfigureSDRdaemonSource *msg = MsgConfigureSDRdaemonSource::create(settings, force); + m_inputMessageQueue.push(msg); + + if (m_guiMessageQueue) // forward to GUI if any + { + MsgConfigureSDRdaemonSource *msgToGUI = MsgConfigureSDRdaemonSource::create(settings, force); + m_guiMessageQueue->push(msgToGUI); + } + + webapiFormatDeviceSettings(response, settings); + return 200; +} + +void SDRdaemonSourceInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SDRdaemonSourceSettings& settings) +{ + response.getSdrDaemonSourceSettings()->setCenterFrequency(settings.m_centerFrequency); + response.getSdrDaemonSourceSettings()->setSampleRate(settings.m_sampleRate); + response.getSdrDaemonSourceSettings()->setLog2Decim(settings.m_log2Decim); + response.getSdrDaemonSourceSettings()->setTxDelay(settings.m_txDelay); + response.getSdrDaemonSourceSettings()->setNbFecBlocks(settings.m_nbFECBlocks); + response.getSdrDaemonSourceSettings()->setAddress(new QString(settings.m_address)); + response.getSdrDaemonSourceSettings()->setDataPort(settings.m_dataPort); + response.getSdrDaemonSourceSettings()->setControlPort(settings.m_controlPort); + response.getSdrDaemonSourceSettings()->setSpecificParameters(new QString(settings.m_specificParameters)); + response.getSdrDaemonSourceSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0); + response.getSdrDaemonSourceSettings()->setIqCorrection(settings.m_iqCorrection); + response.getSdrDaemonSourceSettings()->setFcPos((int) settings.m_fcPos); + + if (response.getSdrDaemonSourceSettings()->getFileRecordName()) { + *response.getSdrDaemonSourceSettings()->getFileRecordName() = settings.m_fileRecordName; + } else { + response.getSdrDaemonSourceSettings()->setFileRecordName(new QString(settings.m_fileRecordName)); + } +} + +int SDRdaemonSourceInput::webapiReportGet( + SWGSDRangel::SWGDeviceReport& response, + QString& errorMessage __attribute__((unused))) +{ + response.setSdrDaemonSourceReport(new SWGSDRangel::SWGSDRdaemonSourceReport()); + response.getSdrDaemonSourceReport()->init(); + webapiFormatDeviceReport(response); + return 200; +} + +void SDRdaemonSourceInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response) +{ + response.getSdrDaemonSourceReport()->setCenterFrequency(m_SDRdaemonUDPHandler->getCenterFrequency()); + response.getSdrDaemonSourceReport()->setSampleRate(m_SDRdaemonUDPHandler->getSampleRate()); + response.getSdrDaemonSourceReport()->setBufferRwBalance(m_SDRdaemonUDPHandler->getBufferGauge()); + + quint64 startingTimeStampMsec = ((quint64) m_SDRdaemonUDPHandler->getTVSec() * 1000LL) + ((quint64) m_SDRdaemonUDPHandler->getTVuSec() / 1000LL); + QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec); + response.getSdrDaemonSourceReport()->setDaemonTimestamp(new QString(dt.toString("yyyy-MM-dd HH:mm:ss.zzz"))); + + response.getSdrDaemonSourceReport()->setMinNbBlocks(m_SDRdaemonUDPHandler->getMinNbBlocks()); + response.getSdrDaemonSourceReport()->setMaxNbRecovery(m_SDRdaemonUDPHandler->getMaxNbRecovery()); +} diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h index 0de1e372b..6e035f606 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h @@ -279,6 +279,20 @@ public: virtual bool handleMessage(const Message& message); + virtual int webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage); + + virtual int webapiSettingsPutPatch( + bool force, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response, // query + response + QString& errorMessage); + + virtual int webapiReportGet( + SWGSDRangel::SWGDeviceReport& response, + QString& errorMessage); + virtual int webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage); @@ -300,6 +314,8 @@ private: FileRecord *m_fileSink; //!< File sink to record device I/Q output void applySettings(const SDRdaemonSourceSettings& settings, bool force = false); + void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SDRdaemonSourceSettings& settings); + void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response); }; #endif // INCLUDE_SDRDAEMONSOURCEINPUT_H diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceudphandler.h b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceudphandler.h index bbb4c0799..44c26bbc8 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceudphandler.h +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceudphandler.h @@ -47,6 +47,11 @@ public: bool isStreaming() const { return m_masterTimerConnected; } int getSampleRate() const { return m_samplerate; } int getCenterFrequency() const { return m_centerFrequency * 1000; } + int getBufferGauge() const { return m_sdrDaemonBuffer.getBufferGauge(); } + uint32_t getTVSec() const { return m_tv_sec; } + uint32_t getTVuSec() const { return m_tv_usec; } + int getMinNbBlocks() { return m_sdrDaemonBuffer.getMinNbBlocks(); } + int getMaxNbRecovery() { return m_sdrDaemonBuffer.getMaxNbRecovery(); } public slots: void dataReadyRead(); diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index d5445a952..49a75bb9f 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1738,6 +1738,9 @@ margin-bottom: 20px; }, "rtlSdrReport" : { "$ref" : "#/definitions/RtlSdrReport" + }, + "sdrDaemonSourceReport" : { + "$ref" : "#/definitions/SDRdaemonSourceReport" } }, "description" : "Base device report. The specific device report present depends on deviceHwType" @@ -1838,6 +1841,9 @@ margin-bottom: 20px; }, "rtlSdrSettings" : { "$ref" : "#/definitions/RtlSdrSettings" + }, + "sdrDaemonSourceSettings" : { + "$ref" : "#/definitions/SDRdaemonSourceSettings" } }, "description" : "Base device settings. The specific device settings present depends on deviceHwType." @@ -3047,6 +3053,82 @@ margin-bottom: 20px; } }, "description" : "RTLSDR" +}; + defs.SDRdaemonSourceReport = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "uint64" + }, + "sampleRate" : { + "type" : "integer" + }, + "bufferRWBalance" : { + "type" : "integer", + "description" : "percentage off the mid buffer (positive read leads)" + }, + "daemonTimestamp" : { + "type" : "string", + "description" : "string representation of timestamp as sent by the SDRdaemon instance" + }, + "minNbBlocks" : { + "type" : "integer", + "description" : "Minimum number of blocks retrieved per frame" + }, + "maxNbRecovery" : { + "type" : "integer", + "description" : "Maximum number of recovery blocks used per frame" + } + }, + "description" : "SDRdaemonSource" +}; + defs.SDRdaemonSourceSettings = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "uint64" + }, + "sampleRate" : { + "type" : "integer" + }, + "log2Decim" : { + "type" : "integer" + }, + "txDelay" : { + "type" : "number", + "format" : "float", + "description" : "minimum delay in ms between two consecutive packets sending" + }, + "nbFECBlocks" : { + "type" : "integer" + }, + "address" : { + "type" : "string" + }, + "dataPort" : { + "type" : "integer" + }, + "controlPort" : { + "type" : "integer" + }, + "specificParameters" : { + "type" : "string" + }, + "dcBlock" : { + "type" : "integer" + }, + "iqCorrection" : { + "type" : "integer" + }, + "fcPos" : { + "type" : "integer", + "description" : "0=Infra 1=Supra 2=Center" + }, + "fileRecordName" : { + "type" : "string" + } + }, + "description" : "SDRdaemonSource" }; defs.SSBDemodReport = { "properties" : { @@ -22292,7 +22374,7 @@ except ApiException as e:
- Generated 2018-05-26T22:09:48.356+02:00 + Generated 2018-05-26T23:41:15.758+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/SDRDaemonSource.yaml b/sdrbase/resources/webapi/doc/swagger/include/SDRDaemonSource.yaml new file mode 100644 index 000000000..66bf84bd6 --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/SDRDaemonSource.yaml @@ -0,0 +1,55 @@ +SDRdaemonSourceSettings: + description: SDRdaemonSource + properties: + centerFrequency: + type: integer + format: uint64 + sampleRate: + type: integer + log2Decim: + type: integer + txDelay: + description: minimum delay in ms between two consecutive packets sending + type: number + format: float + nbFECBlocks: + type: integer + address: + type: string + dataPort: + type: integer + controlPort: + type: integer + specificParameters: + type: string + dcBlock: + type: integer + iqCorrection: + type: integer + fcPos: + description: 0=Infra 1=Supra 2=Center + type: integer + fileRecordName: + type: string + +SDRdaemonSourceReport: + description: SDRdaemonSource + properties: + centerFrequency: + type: integer + format: uint64 + sampleRate: + type: integer + bufferRWBalance: + description: percentage off the mid buffer (positive read leads) + type: integer + daemonTimestamp: + description: string representation of timestamp as sent by the SDRdaemon instance + type: string + minNbBlocks: + description: Minimum number of blocks retrieved per frame + type: integer + maxNbRecovery: + description: Maximum number of recovery blocks used per frame + type: integer + \ No newline at end of file diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index e4a21ae40..9bd8c4f9a 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1775,6 +1775,8 @@ definitions: $ref: "/doc/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputSettings" rtlSdrSettings: $ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrSettings" + sdrDaemonSourceSettings: + $ref: "/doc/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceSettings" DeviceReport: description: Base device report. The specific device report present depends on deviceHwType @@ -1807,6 +1809,8 @@ definitions: $ref: "/doc/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputReport" rtlSdrReport: $ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrReport" + sdrDaemonSourceReport: + $ref: "/doc/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceReport" ChannelSettings: description: Base channel settings. The specific channel settings present depends on channelType. diff --git a/swagger/sdrangel/api/swagger/include/SDRDaemonSource.yaml b/swagger/sdrangel/api/swagger/include/SDRDaemonSource.yaml new file mode 100644 index 000000000..66bf84bd6 --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/SDRDaemonSource.yaml @@ -0,0 +1,55 @@ +SDRdaemonSourceSettings: + description: SDRdaemonSource + properties: + centerFrequency: + type: integer + format: uint64 + sampleRate: + type: integer + log2Decim: + type: integer + txDelay: + description: minimum delay in ms between two consecutive packets sending + type: number + format: float + nbFECBlocks: + type: integer + address: + type: string + dataPort: + type: integer + controlPort: + type: integer + specificParameters: + type: string + dcBlock: + type: integer + iqCorrection: + type: integer + fcPos: + description: 0=Infra 1=Supra 2=Center + type: integer + fileRecordName: + type: string + +SDRdaemonSourceReport: + description: SDRdaemonSource + properties: + centerFrequency: + type: integer + format: uint64 + sampleRate: + type: integer + bufferRWBalance: + description: percentage off the mid buffer (positive read leads) + type: integer + daemonTimestamp: + description: string representation of timestamp as sent by the SDRdaemon instance + type: string + minNbBlocks: + description: Minimum number of blocks retrieved per frame + type: integer + maxNbRecovery: + description: Maximum number of recovery blocks used per frame + type: integer + \ No newline at end of file diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 209a7ba68..10d8f8183 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1775,6 +1775,8 @@ definitions: $ref: "http://localhost:8081/api/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputSettings" rtlSdrSettings: $ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrSettings" + sdrDaemonSourceSettings: + $ref: "http://localhost:8081/api/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceSettings" DeviceReport: description: Base device report. The specific device report present depends on deviceHwType @@ -1807,6 +1809,8 @@ definitions: $ref: "http://localhost:8081/api/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputReport" rtlSdrReport: $ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrReport" + sdrDaemonSourceReport: + $ref: "http://localhost:8081/api/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceReport " ChannelSettings: description: Base channel settings. The specific channel settings present depends on channelType. diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index d5445a952..49a75bb9f 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1738,6 +1738,9 @@ margin-bottom: 20px; }, "rtlSdrReport" : { "$ref" : "#/definitions/RtlSdrReport" + }, + "sdrDaemonSourceReport" : { + "$ref" : "#/definitions/SDRdaemonSourceReport" } }, "description" : "Base device report. The specific device report present depends on deviceHwType" @@ -1838,6 +1841,9 @@ margin-bottom: 20px; }, "rtlSdrSettings" : { "$ref" : "#/definitions/RtlSdrSettings" + }, + "sdrDaemonSourceSettings" : { + "$ref" : "#/definitions/SDRdaemonSourceSettings" } }, "description" : "Base device settings. The specific device settings present depends on deviceHwType." @@ -3047,6 +3053,82 @@ margin-bottom: 20px; } }, "description" : "RTLSDR" +}; + defs.SDRdaemonSourceReport = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "uint64" + }, + "sampleRate" : { + "type" : "integer" + }, + "bufferRWBalance" : { + "type" : "integer", + "description" : "percentage off the mid buffer (positive read leads)" + }, + "daemonTimestamp" : { + "type" : "string", + "description" : "string representation of timestamp as sent by the SDRdaemon instance" + }, + "minNbBlocks" : { + "type" : "integer", + "description" : "Minimum number of blocks retrieved per frame" + }, + "maxNbRecovery" : { + "type" : "integer", + "description" : "Maximum number of recovery blocks used per frame" + } + }, + "description" : "SDRdaemonSource" +}; + defs.SDRdaemonSourceSettings = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "uint64" + }, + "sampleRate" : { + "type" : "integer" + }, + "log2Decim" : { + "type" : "integer" + }, + "txDelay" : { + "type" : "number", + "format" : "float", + "description" : "minimum delay in ms between two consecutive packets sending" + }, + "nbFECBlocks" : { + "type" : "integer" + }, + "address" : { + "type" : "string" + }, + "dataPort" : { + "type" : "integer" + }, + "controlPort" : { + "type" : "integer" + }, + "specificParameters" : { + "type" : "string" + }, + "dcBlock" : { + "type" : "integer" + }, + "iqCorrection" : { + "type" : "integer" + }, + "fcPos" : { + "type" : "integer", + "description" : "0=Infra 1=Supra 2=Center" + }, + "fileRecordName" : { + "type" : "string" + } + }, + "description" : "SDRdaemonSource" }; defs.SSBDemodReport = { "properties" : { @@ -22292,7 +22374,7 @@ except ApiException as e:
- Generated 2018-05-26T22:09:48.356+02:00 + Generated 2018-05-26T23:41:15.758+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp index 019c1fc7f..c0956bf08 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp @@ -50,6 +50,8 @@ SWGDeviceReport::SWGDeviceReport() { m_pluto_sdr_output_report_isSet = false; rtl_sdr_report = nullptr; m_rtl_sdr_report_isSet = false; + sdr_daemon_source_report = nullptr; + m_sdr_daemon_source_report_isSet = false; } SWGDeviceReport::~SWGDeviceReport() { @@ -80,6 +82,8 @@ SWGDeviceReport::init() { m_pluto_sdr_output_report_isSet = false; rtl_sdr_report = new SWGRtlSdrReport(); m_rtl_sdr_report_isSet = false; + sdr_daemon_source_report = new SWGSDRdaemonSourceReport(); + m_sdr_daemon_source_report_isSet = false; } void @@ -115,6 +119,9 @@ SWGDeviceReport::cleanup() { if(rtl_sdr_report != nullptr) { delete rtl_sdr_report; } + if(sdr_daemon_source_report != nullptr) { + delete sdr_daemon_source_report; + } } SWGDeviceReport* @@ -150,6 +157,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&rtl_sdr_report, pJson["rtlSdrReport"], "SWGRtlSdrReport", "SWGRtlSdrReport"); + ::SWGSDRangel::setValue(&sdr_daemon_source_report, pJson["sdrDaemonSourceReport"], "SWGSDRdaemonSourceReport", "SWGSDRdaemonSourceReport"); + } QString @@ -199,6 +208,9 @@ SWGDeviceReport::asJsonObject() { if((rtl_sdr_report != nullptr) && (rtl_sdr_report->isSet())){ toJsonValue(QString("rtlSdrReport"), rtl_sdr_report, obj, QString("SWGRtlSdrReport")); } + if((sdr_daemon_source_report != nullptr) && (sdr_daemon_source_report->isSet())){ + toJsonValue(QString("sdrDaemonSourceReport"), sdr_daemon_source_report, obj, QString("SWGSDRdaemonSourceReport")); + } return obj; } @@ -313,6 +325,16 @@ SWGDeviceReport::setRtlSdrReport(SWGRtlSdrReport* rtl_sdr_report) { this->m_rtl_sdr_report_isSet = true; } +SWGSDRdaemonSourceReport* +SWGDeviceReport::getSdrDaemonSourceReport() { + return sdr_daemon_source_report; +} +void +SWGDeviceReport::setSdrDaemonSourceReport(SWGSDRdaemonSourceReport* sdr_daemon_source_report) { + this->sdr_daemon_source_report = sdr_daemon_source_report; + this->m_sdr_daemon_source_report_isSet = true; +} + bool SWGDeviceReport::isSet(){ @@ -329,6 +351,7 @@ SWGDeviceReport::isSet(){ if(pluto_sdr_input_report != nullptr && pluto_sdr_input_report->isSet()){ isObjectUpdated = true; break;} if(pluto_sdr_output_report != nullptr && pluto_sdr_output_report->isSet()){ isObjectUpdated = true; break;} if(rtl_sdr_report != nullptr && rtl_sdr_report->isSet()){ isObjectUpdated = true; break;} + if(sdr_daemon_source_report != nullptr && sdr_daemon_source_report->isSet()){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h index 0b51c016a..ed8ea3348 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h @@ -31,6 +31,7 @@ #include "SWGPlutoSdrInputReport.h" #include "SWGPlutoSdrOutputReport.h" #include "SWGRtlSdrReport.h" +#include "SWGSDRdaemonSourceReport.h" #include #include "SWGObject.h" @@ -84,6 +85,9 @@ public: SWGRtlSdrReport* getRtlSdrReport(); void setRtlSdrReport(SWGRtlSdrReport* rtl_sdr_report); + SWGSDRdaemonSourceReport* getSdrDaemonSourceReport(); + void setSdrDaemonSourceReport(SWGSDRdaemonSourceReport* sdr_daemon_source_report); + virtual bool isSet() override; @@ -121,6 +125,9 @@ private: SWGRtlSdrReport* rtl_sdr_report; bool m_rtl_sdr_report_isSet; + SWGSDRdaemonSourceReport* sdr_daemon_source_report; + bool m_sdr_daemon_source_report_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp index e8f645521..a041a3b1c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp @@ -62,6 +62,8 @@ SWGDeviceSettings::SWGDeviceSettings() { m_pluto_sdr_output_settings_isSet = false; rtl_sdr_settings = nullptr; m_rtl_sdr_settings_isSet = false; + sdr_daemon_source_settings = nullptr; + m_sdr_daemon_source_settings_isSet = false; } SWGDeviceSettings::~SWGDeviceSettings() { @@ -104,6 +106,8 @@ SWGDeviceSettings::init() { m_pluto_sdr_output_settings_isSet = false; rtl_sdr_settings = new SWGRtlSdrSettings(); m_rtl_sdr_settings_isSet = false; + sdr_daemon_source_settings = new SWGSDRdaemonSourceSettings(); + m_sdr_daemon_source_settings_isSet = false; } void @@ -157,6 +161,9 @@ SWGDeviceSettings::cleanup() { if(rtl_sdr_settings != nullptr) { delete rtl_sdr_settings; } + if(sdr_daemon_source_settings != nullptr) { + delete sdr_daemon_source_settings; + } } SWGDeviceSettings* @@ -204,6 +211,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&rtl_sdr_settings, pJson["rtlSdrSettings"], "SWGRtlSdrSettings", "SWGRtlSdrSettings"); + ::SWGSDRangel::setValue(&sdr_daemon_source_settings, pJson["sdrDaemonSourceSettings"], "SWGSDRdaemonSourceSettings", "SWGSDRdaemonSourceSettings"); + } QString @@ -271,6 +280,9 @@ SWGDeviceSettings::asJsonObject() { if((rtl_sdr_settings != nullptr) && (rtl_sdr_settings->isSet())){ toJsonValue(QString("rtlSdrSettings"), rtl_sdr_settings, obj, QString("SWGRtlSdrSettings")); } + if((sdr_daemon_source_settings != nullptr) && (sdr_daemon_source_settings->isSet())){ + toJsonValue(QString("sdrDaemonSourceSettings"), sdr_daemon_source_settings, obj, QString("SWGSDRdaemonSourceSettings")); + } return obj; } @@ -445,6 +457,16 @@ SWGDeviceSettings::setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings) { this->m_rtl_sdr_settings_isSet = true; } +SWGSDRdaemonSourceSettings* +SWGDeviceSettings::getSdrDaemonSourceSettings() { + return sdr_daemon_source_settings; +} +void +SWGDeviceSettings::setSdrDaemonSourceSettings(SWGSDRdaemonSourceSettings* sdr_daemon_source_settings) { + this->sdr_daemon_source_settings = sdr_daemon_source_settings; + this->m_sdr_daemon_source_settings_isSet = true; +} + bool SWGDeviceSettings::isSet(){ @@ -467,6 +489,7 @@ SWGDeviceSettings::isSet(){ if(pluto_sdr_input_settings != nullptr && pluto_sdr_input_settings->isSet()){ isObjectUpdated = true; break;} if(pluto_sdr_output_settings != nullptr && pluto_sdr_output_settings->isSet()){ isObjectUpdated = true; break;} if(rtl_sdr_settings != nullptr && rtl_sdr_settings->isSet()){ isObjectUpdated = true; break;} + if(sdr_daemon_source_settings != nullptr && sdr_daemon_source_settings->isSet()){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h index 243e9e233..8d81a5a02 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h @@ -37,6 +37,7 @@ #include "SWGPlutoSdrInputSettings.h" #include "SWGPlutoSdrOutputSettings.h" #include "SWGRtlSdrSettings.h" +#include "SWGSDRdaemonSourceSettings.h" #include #include "SWGObject.h" @@ -108,6 +109,9 @@ public: SWGRtlSdrSettings* getRtlSdrSettings(); void setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings); + SWGSDRdaemonSourceSettings* getSdrDaemonSourceSettings(); + void setSdrDaemonSourceSettings(SWGSDRdaemonSourceSettings* sdr_daemon_source_settings); + virtual bool isSet() override; @@ -163,6 +167,9 @@ private: SWGRtlSdrSettings* rtl_sdr_settings; bool m_rtl_sdr_settings_isSet; + SWGSDRdaemonSourceSettings* sdr_daemon_source_settings; + bool m_sdr_daemon_source_settings_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index a34da8f7a..b065d68da 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -86,6 +86,8 @@ #include "SWGRtlSdrReport.h" #include "SWGRtlSdrReport_gains.h" #include "SWGRtlSdrSettings.h" +#include "SWGSDRdaemonSourceReport.h" +#include "SWGSDRdaemonSourceSettings.h" #include "SWGSSBDemodReport.h" #include "SWGSSBDemodSettings.h" #include "SWGSSBModReport.h" @@ -320,6 +322,12 @@ namespace SWGSDRangel { if(QString("SWGRtlSdrSettings").compare(type) == 0) { return new SWGRtlSdrSettings(); } + if(QString("SWGSDRdaemonSourceReport").compare(type) == 0) { + return new SWGSDRdaemonSourceReport(); + } + if(QString("SWGSDRdaemonSourceSettings").compare(type) == 0) { + return new SWGSDRdaemonSourceSettings(); + } if(QString("SWGSSBDemodReport").compare(type) == 0) { return new SWGSSBDemodReport(); } diff --git a/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.cpp b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.cpp new file mode 100644 index 000000000..252069449 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.cpp @@ -0,0 +1,213 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.0.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 "SWGSDRdaemonSourceReport.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGSDRdaemonSourceReport::SWGSDRdaemonSourceReport(QString* json) { + init(); + this->fromJson(*json); +} + +SWGSDRdaemonSourceReport::SWGSDRdaemonSourceReport() { + center_frequency = 0; + m_center_frequency_isSet = false; + sample_rate = 0; + m_sample_rate_isSet = false; + buffer_rw_balance = 0; + m_buffer_rw_balance_isSet = false; + daemon_timestamp = nullptr; + m_daemon_timestamp_isSet = false; + min_nb_blocks = 0; + m_min_nb_blocks_isSet = false; + max_nb_recovery = 0; + m_max_nb_recovery_isSet = false; +} + +SWGSDRdaemonSourceReport::~SWGSDRdaemonSourceReport() { + this->cleanup(); +} + +void +SWGSDRdaemonSourceReport::init() { + center_frequency = 0; + m_center_frequency_isSet = false; + sample_rate = 0; + m_sample_rate_isSet = false; + buffer_rw_balance = 0; + m_buffer_rw_balance_isSet = false; + daemon_timestamp = new QString(""); + m_daemon_timestamp_isSet = false; + min_nb_blocks = 0; + m_min_nb_blocks_isSet = false; + max_nb_recovery = 0; + m_max_nb_recovery_isSet = false; +} + +void +SWGSDRdaemonSourceReport::cleanup() { + + + + if(daemon_timestamp != nullptr) { + delete daemon_timestamp; + } + + +} + +SWGSDRdaemonSourceReport* +SWGSDRdaemonSourceReport::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGSDRdaemonSourceReport::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint32", ""); + + ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); + + ::SWGSDRangel::setValue(&buffer_rw_balance, pJson["bufferRWBalance"], "qint32", ""); + + ::SWGSDRangel::setValue(&daemon_timestamp, pJson["daemonTimestamp"], "QString", "QString"); + + ::SWGSDRangel::setValue(&min_nb_blocks, pJson["minNbBlocks"], "qint32", ""); + + ::SWGSDRangel::setValue(&max_nb_recovery, pJson["maxNbRecovery"], "qint32", ""); + +} + +QString +SWGSDRdaemonSourceReport::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGSDRdaemonSourceReport::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(m_sample_rate_isSet){ + obj->insert("sampleRate", QJsonValue(sample_rate)); + } + if(m_buffer_rw_balance_isSet){ + obj->insert("bufferRWBalance", QJsonValue(buffer_rw_balance)); + } + if(daemon_timestamp != nullptr && *daemon_timestamp != QString("")){ + toJsonValue(QString("daemonTimestamp"), daemon_timestamp, obj, QString("QString")); + } + if(m_min_nb_blocks_isSet){ + obj->insert("minNbBlocks", QJsonValue(min_nb_blocks)); + } + if(m_max_nb_recovery_isSet){ + obj->insert("maxNbRecovery", QJsonValue(max_nb_recovery)); + } + + return obj; +} + +qint32 +SWGSDRdaemonSourceReport::getCenterFrequency() { + return center_frequency; +} +void +SWGSDRdaemonSourceReport::setCenterFrequency(qint32 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +qint32 +SWGSDRdaemonSourceReport::getSampleRate() { + return sample_rate; +} +void +SWGSDRdaemonSourceReport::setSampleRate(qint32 sample_rate) { + this->sample_rate = sample_rate; + this->m_sample_rate_isSet = true; +} + +qint32 +SWGSDRdaemonSourceReport::getBufferRwBalance() { + return buffer_rw_balance; +} +void +SWGSDRdaemonSourceReport::setBufferRwBalance(qint32 buffer_rw_balance) { + this->buffer_rw_balance = buffer_rw_balance; + this->m_buffer_rw_balance_isSet = true; +} + +QString* +SWGSDRdaemonSourceReport::getDaemonTimestamp() { + return daemon_timestamp; +} +void +SWGSDRdaemonSourceReport::setDaemonTimestamp(QString* daemon_timestamp) { + this->daemon_timestamp = daemon_timestamp; + this->m_daemon_timestamp_isSet = true; +} + +qint32 +SWGSDRdaemonSourceReport::getMinNbBlocks() { + return min_nb_blocks; +} +void +SWGSDRdaemonSourceReport::setMinNbBlocks(qint32 min_nb_blocks) { + this->min_nb_blocks = min_nb_blocks; + this->m_min_nb_blocks_isSet = true; +} + +qint32 +SWGSDRdaemonSourceReport::getMaxNbRecovery() { + return max_nb_recovery; +} +void +SWGSDRdaemonSourceReport::setMaxNbRecovery(qint32 max_nb_recovery) { + this->max_nb_recovery = max_nb_recovery; + this->m_max_nb_recovery_isSet = true; +} + + +bool +SWGSDRdaemonSourceReport::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_center_frequency_isSet){ isObjectUpdated = true; break;} + if(m_sample_rate_isSet){ isObjectUpdated = true; break;} + if(m_buffer_rw_balance_isSet){ isObjectUpdated = true; break;} + if(daemon_timestamp != nullptr && *daemon_timestamp != QString("")){ isObjectUpdated = true; break;} + if(m_min_nb_blocks_isSet){ isObjectUpdated = true; break;} + if(m_max_nb_recovery_isSet){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.h b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.h new file mode 100644 index 000000000..e191cbdfe --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceReport.h @@ -0,0 +1,89 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.0.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. + */ + +/* + * SWGSDRdaemonSourceReport.h + * + * SDRdaemonSource + */ + +#ifndef SWGSDRdaemonSourceReport_H_ +#define SWGSDRdaemonSourceReport_H_ + +#include + + +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGSDRdaemonSourceReport: public SWGObject { +public: + SWGSDRdaemonSourceReport(); + SWGSDRdaemonSourceReport(QString* json); + virtual ~SWGSDRdaemonSourceReport(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGSDRdaemonSourceReport* fromJson(QString &jsonString) override; + + qint32 getCenterFrequency(); + void setCenterFrequency(qint32 center_frequency); + + qint32 getSampleRate(); + void setSampleRate(qint32 sample_rate); + + qint32 getBufferRwBalance(); + void setBufferRwBalance(qint32 buffer_rw_balance); + + QString* getDaemonTimestamp(); + void setDaemonTimestamp(QString* daemon_timestamp); + + qint32 getMinNbBlocks(); + void setMinNbBlocks(qint32 min_nb_blocks); + + qint32 getMaxNbRecovery(); + void setMaxNbRecovery(qint32 max_nb_recovery); + + + virtual bool isSet() override; + +private: + qint32 center_frequency; + bool m_center_frequency_isSet; + + qint32 sample_rate; + bool m_sample_rate_isSet; + + qint32 buffer_rw_balance; + bool m_buffer_rw_balance_isSet; + + QString* daemon_timestamp; + bool m_daemon_timestamp_isSet; + + qint32 min_nb_blocks; + bool m_min_nb_blocks_isSet; + + qint32 max_nb_recovery; + bool m_max_nb_recovery_isSet; + +}; + +} + +#endif /* SWGSDRdaemonSourceReport_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.cpp new file mode 100644 index 000000000..239d58117 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.cpp @@ -0,0 +1,364 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.0.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 "SWGSDRdaemonSourceSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGSDRdaemonSourceSettings::SWGSDRdaemonSourceSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGSDRdaemonSourceSettings::SWGSDRdaemonSourceSettings() { + center_frequency = 0; + m_center_frequency_isSet = false; + sample_rate = 0; + m_sample_rate_isSet = false; + log2_decim = 0; + m_log2_decim_isSet = false; + tx_delay = 0.0f; + m_tx_delay_isSet = false; + nb_fec_blocks = 0; + m_nb_fec_blocks_isSet = false; + address = nullptr; + m_address_isSet = false; + data_port = 0; + m_data_port_isSet = false; + control_port = 0; + m_control_port_isSet = false; + specific_parameters = nullptr; + m_specific_parameters_isSet = false; + dc_block = 0; + m_dc_block_isSet = false; + iq_correction = 0; + m_iq_correction_isSet = false; + fc_pos = 0; + m_fc_pos_isSet = false; + file_record_name = nullptr; + m_file_record_name_isSet = false; +} + +SWGSDRdaemonSourceSettings::~SWGSDRdaemonSourceSettings() { + this->cleanup(); +} + +void +SWGSDRdaemonSourceSettings::init() { + center_frequency = 0; + m_center_frequency_isSet = false; + sample_rate = 0; + m_sample_rate_isSet = false; + log2_decim = 0; + m_log2_decim_isSet = false; + tx_delay = 0.0f; + m_tx_delay_isSet = false; + nb_fec_blocks = 0; + m_nb_fec_blocks_isSet = false; + address = new QString(""); + m_address_isSet = false; + data_port = 0; + m_data_port_isSet = false; + control_port = 0; + m_control_port_isSet = false; + specific_parameters = new QString(""); + m_specific_parameters_isSet = false; + dc_block = 0; + m_dc_block_isSet = false; + iq_correction = 0; + m_iq_correction_isSet = false; + fc_pos = 0; + m_fc_pos_isSet = false; + file_record_name = new QString(""); + m_file_record_name_isSet = false; +} + +void +SWGSDRdaemonSourceSettings::cleanup() { + + + + + + if(address != nullptr) { + delete address; + } + + + if(specific_parameters != nullptr) { + delete specific_parameters; + } + + + + if(file_record_name != nullptr) { + delete file_record_name; + } +} + +SWGSDRdaemonSourceSettings* +SWGSDRdaemonSourceSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGSDRdaemonSourceSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint32", ""); + + ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); + + ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", ""); + + ::SWGSDRangel::setValue(&tx_delay, pJson["txDelay"], "float", ""); + + ::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", ""); + + ::SWGSDRangel::setValue(&address, pJson["address"], "QString", "QString"); + + ::SWGSDRangel::setValue(&data_port, pJson["dataPort"], "qint32", ""); + + ::SWGSDRangel::setValue(&control_port, pJson["controlPort"], "qint32", ""); + + ::SWGSDRangel::setValue(&specific_parameters, pJson["specificParameters"], "QString", "QString"); + + ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", ""); + + ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", ""); + + ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", ""); + + ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString"); + +} + +QString +SWGSDRdaemonSourceSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGSDRdaemonSourceSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(m_sample_rate_isSet){ + obj->insert("sampleRate", QJsonValue(sample_rate)); + } + if(m_log2_decim_isSet){ + obj->insert("log2Decim", QJsonValue(log2_decim)); + } + if(m_tx_delay_isSet){ + obj->insert("txDelay", QJsonValue(tx_delay)); + } + if(m_nb_fec_blocks_isSet){ + obj->insert("nbFECBlocks", QJsonValue(nb_fec_blocks)); + } + if(address != nullptr && *address != QString("")){ + toJsonValue(QString("address"), address, obj, QString("QString")); + } + if(m_data_port_isSet){ + obj->insert("dataPort", QJsonValue(data_port)); + } + if(m_control_port_isSet){ + obj->insert("controlPort", QJsonValue(control_port)); + } + if(specific_parameters != nullptr && *specific_parameters != QString("")){ + toJsonValue(QString("specificParameters"), specific_parameters, obj, QString("QString")); + } + if(m_dc_block_isSet){ + obj->insert("dcBlock", QJsonValue(dc_block)); + } + if(m_iq_correction_isSet){ + obj->insert("iqCorrection", QJsonValue(iq_correction)); + } + if(m_fc_pos_isSet){ + obj->insert("fcPos", QJsonValue(fc_pos)); + } + if(file_record_name != nullptr && *file_record_name != QString("")){ + toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString")); + } + + return obj; +} + +qint32 +SWGSDRdaemonSourceSettings::getCenterFrequency() { + return center_frequency; +} +void +SWGSDRdaemonSourceSettings::setCenterFrequency(qint32 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getSampleRate() { + return sample_rate; +} +void +SWGSDRdaemonSourceSettings::setSampleRate(qint32 sample_rate) { + this->sample_rate = sample_rate; + this->m_sample_rate_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getLog2Decim() { + return log2_decim; +} +void +SWGSDRdaemonSourceSettings::setLog2Decim(qint32 log2_decim) { + this->log2_decim = log2_decim; + this->m_log2_decim_isSet = true; +} + +float +SWGSDRdaemonSourceSettings::getTxDelay() { + return tx_delay; +} +void +SWGSDRdaemonSourceSettings::setTxDelay(float tx_delay) { + this->tx_delay = tx_delay; + this->m_tx_delay_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getNbFecBlocks() { + return nb_fec_blocks; +} +void +SWGSDRdaemonSourceSettings::setNbFecBlocks(qint32 nb_fec_blocks) { + this->nb_fec_blocks = nb_fec_blocks; + this->m_nb_fec_blocks_isSet = true; +} + +QString* +SWGSDRdaemonSourceSettings::getAddress() { + return address; +} +void +SWGSDRdaemonSourceSettings::setAddress(QString* address) { + this->address = address; + this->m_address_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getDataPort() { + return data_port; +} +void +SWGSDRdaemonSourceSettings::setDataPort(qint32 data_port) { + this->data_port = data_port; + this->m_data_port_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getControlPort() { + return control_port; +} +void +SWGSDRdaemonSourceSettings::setControlPort(qint32 control_port) { + this->control_port = control_port; + this->m_control_port_isSet = true; +} + +QString* +SWGSDRdaemonSourceSettings::getSpecificParameters() { + return specific_parameters; +} +void +SWGSDRdaemonSourceSettings::setSpecificParameters(QString* specific_parameters) { + this->specific_parameters = specific_parameters; + this->m_specific_parameters_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getDcBlock() { + return dc_block; +} +void +SWGSDRdaemonSourceSettings::setDcBlock(qint32 dc_block) { + this->dc_block = dc_block; + this->m_dc_block_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getIqCorrection() { + return iq_correction; +} +void +SWGSDRdaemonSourceSettings::setIqCorrection(qint32 iq_correction) { + this->iq_correction = iq_correction; + this->m_iq_correction_isSet = true; +} + +qint32 +SWGSDRdaemonSourceSettings::getFcPos() { + return fc_pos; +} +void +SWGSDRdaemonSourceSettings::setFcPos(qint32 fc_pos) { + this->fc_pos = fc_pos; + this->m_fc_pos_isSet = true; +} + +QString* +SWGSDRdaemonSourceSettings::getFileRecordName() { + return file_record_name; +} +void +SWGSDRdaemonSourceSettings::setFileRecordName(QString* file_record_name) { + this->file_record_name = file_record_name; + this->m_file_record_name_isSet = true; +} + + +bool +SWGSDRdaemonSourceSettings::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_center_frequency_isSet){ isObjectUpdated = true; break;} + if(m_sample_rate_isSet){ isObjectUpdated = true; break;} + if(m_log2_decim_isSet){ isObjectUpdated = true; break;} + if(m_tx_delay_isSet){ isObjectUpdated = true; break;} + if(m_nb_fec_blocks_isSet){ isObjectUpdated = true; break;} + if(address != nullptr && *address != QString("")){ isObjectUpdated = true; break;} + if(m_data_port_isSet){ isObjectUpdated = true; break;} + if(m_control_port_isSet){ isObjectUpdated = true; break;} + if(specific_parameters != nullptr && *specific_parameters != QString("")){ isObjectUpdated = true; break;} + if(m_dc_block_isSet){ isObjectUpdated = true; break;} + if(m_iq_correction_isSet){ isObjectUpdated = true; break;} + if(m_fc_pos_isSet){ isObjectUpdated = true; break;} + if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.h b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.h new file mode 100644 index 000000000..b6965db11 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSDRdaemonSourceSettings.h @@ -0,0 +1,131 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.0.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. + */ + +/* + * SWGSDRdaemonSourceSettings.h + * + * SDRdaemonSource + */ + +#ifndef SWGSDRdaemonSourceSettings_H_ +#define SWGSDRdaemonSourceSettings_H_ + +#include + + +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGSDRdaemonSourceSettings: public SWGObject { +public: + SWGSDRdaemonSourceSettings(); + SWGSDRdaemonSourceSettings(QString* json); + virtual ~SWGSDRdaemonSourceSettings(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGSDRdaemonSourceSettings* fromJson(QString &jsonString) override; + + qint32 getCenterFrequency(); + void setCenterFrequency(qint32 center_frequency); + + qint32 getSampleRate(); + void setSampleRate(qint32 sample_rate); + + qint32 getLog2Decim(); + void setLog2Decim(qint32 log2_decim); + + float getTxDelay(); + void setTxDelay(float tx_delay); + + qint32 getNbFecBlocks(); + void setNbFecBlocks(qint32 nb_fec_blocks); + + QString* getAddress(); + void setAddress(QString* address); + + qint32 getDataPort(); + void setDataPort(qint32 data_port); + + qint32 getControlPort(); + void setControlPort(qint32 control_port); + + QString* getSpecificParameters(); + void setSpecificParameters(QString* specific_parameters); + + qint32 getDcBlock(); + void setDcBlock(qint32 dc_block); + + qint32 getIqCorrection(); + void setIqCorrection(qint32 iq_correction); + + qint32 getFcPos(); + void setFcPos(qint32 fc_pos); + + QString* getFileRecordName(); + void setFileRecordName(QString* file_record_name); + + + virtual bool isSet() override; + +private: + qint32 center_frequency; + bool m_center_frequency_isSet; + + qint32 sample_rate; + bool m_sample_rate_isSet; + + qint32 log2_decim; + bool m_log2_decim_isSet; + + float tx_delay; + bool m_tx_delay_isSet; + + qint32 nb_fec_blocks; + bool m_nb_fec_blocks_isSet; + + QString* address; + bool m_address_isSet; + + qint32 data_port; + bool m_data_port_isSet; + + qint32 control_port; + bool m_control_port_isSet; + + QString* specific_parameters; + bool m_specific_parameters_isSet; + + qint32 dc_block; + bool m_dc_block_isSet; + + qint32 iq_correction; + bool m_iq_correction_isSet; + + qint32 fc_pos; + bool m_fc_pos_isSet; + + QString* file_record_name; + bool m_file_record_name_isSet; + +}; + +} + +#endif /* SWGSDRdaemonSourceSettings_H_ */