1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

SDR daemon sink: implemeted WEB API

This commit is contained in:
f4exb 2018-05-28 00:40:33 +02:00
parent f5bcbf2e9e
commit 8155825bc4
19 changed files with 955 additions and 3 deletions

View File

@ -20,6 +20,8 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGSDRdaemonSinkReport.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
@ -363,4 +365,92 @@ int SDRdaemonSinkOutput::webapiRun(
return 200;
}
int SDRdaemonSinkOutput::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage __attribute__((unused)))
{
response.setSdrDaemonSinkSettings(new SWGSDRangel::SWGSDRdaemonSinkSettings());
response.getSdrDaemonSinkSettings()->init();
webapiFormatDeviceSettings(response, m_settings);
return 200;
}
int SDRdaemonSinkOutput::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage __attribute__((unused)))
{
SDRdaemonSinkSettings settings = m_settings;
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getSdrDaemonSinkSettings()->getCenterFrequency();
}
if (deviceSettingsKeys.contains("sampleRate")) {
settings.m_sampleRate = response.getSdrDaemonSinkSettings()->getSampleRate();
}
if (deviceSettingsKeys.contains("log2Interp")) {
settings.m_log2Interp = response.getSdrDaemonSinkSettings()->getLog2Interp();
}
if (deviceSettingsKeys.contains("txDelay")) {
settings.m_txDelay = response.getSdrDaemonSinkSettings()->getTxDelay();
}
if (deviceSettingsKeys.contains("nbFECBlocks")) {
settings.m_nbFECBlocks = response.getSdrDaemonSinkSettings()->getNbFecBlocks();
}
if (deviceSettingsKeys.contains("address")) {
settings.m_address = *response.getSdrDaemonSinkSettings()->getAddress();
}
if (deviceSettingsKeys.contains("dataPort")) {
settings.m_dataPort = response.getSdrDaemonSinkSettings()->getDataPort();
}
if (deviceSettingsKeys.contains("controlPort")) {
settings.m_controlPort = response.getSdrDaemonSinkSettings()->getControlPort();
}
if (deviceSettingsKeys.contains("specificParameters")) {
settings.m_specificParameters = *response.getSdrDaemonSinkSettings()->getSpecificParameters();
}
MsgConfigureSDRdaemonSink *msg = MsgConfigureSDRdaemonSink::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureSDRdaemonSink *msgToGUI = MsgConfigureSDRdaemonSink::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatDeviceSettings(response, settings);
return 200;
}
int SDRdaemonSinkOutput::webapiReportGet(
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage __attribute__((unused)))
{
response.setSdrDaemonSinkReport(new SWGSDRangel::SWGSDRdaemonSinkReport());
response.getSdrDaemonSinkReport()->init();
webapiFormatDeviceReport(response);
return 200;
}
void SDRdaemonSinkOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SDRdaemonSinkSettings& settings)
{
response.getSdrDaemonSinkSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getSdrDaemonSinkSettings()->setSampleRate(settings.m_sampleRate);
response.getSdrDaemonSinkSettings()->setLog2Interp(settings.m_log2Interp);
response.getSdrDaemonSinkSettings()->setTxDelay(settings.m_txDelay);
response.getSdrDaemonSinkSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
response.getSdrDaemonSinkSettings()->setAddress(new QString(settings.m_address));
response.getSdrDaemonSinkSettings()->setDataPort(settings.m_dataPort);
response.getSdrDaemonSinkSettings()->setControlPort(settings.m_controlPort);
response.getSdrDaemonSinkSettings()->setSpecificParameters(new QString(settings.m_specificParameters));
}
void SDRdaemonSinkOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
response.getSdrDaemonSinkReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance());
response.getSdrDaemonSinkReport()->setSampleCount(m_sdrDaemonSinkThread ? (int) m_sdrDaemonSinkThread->getSamplesCount() : 0);
}

View File

@ -171,6 +171,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);
@ -190,6 +204,8 @@ private:
const QTimer& m_masterTimer;
void applySettings(const SDRdaemonSinkSettings& settings, bool force = false);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SDRdaemonSinkSettings& settings);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
};
#endif // INCLUDE_SDRDAEMONSINKOUTPUT_H

View File

@ -26,7 +26,7 @@
const PluginDescriptor SDRdaemonSinkPlugin::m_pluginDescriptor = {
QString("SDRdaemon sink output"),
QString("3.14.5"),
QString("4.0.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -43,6 +43,18 @@ public:
void write(const Sample& sample); //!< write directly - phase 1 + phase 2
/** returns ratio of off center over buffer size with sign: negative real lags and positive read leads */
float getRWBalance() const
{
int delta;
if (m_iw > m_ir) {
delta = (m_size/2) - (m_iw - m_ir);
} else {
delta = (m_ir - m_iw) - (m_size/2);
}
return delta / (float) m_size;
}
private:
uint32_t m_size;
SampleVector m_data;

View File

@ -1739,6 +1739,9 @@ margin-bottom: 20px;
"rtlSdrReport" : {
"$ref" : "#/definitions/RtlSdrReport"
},
"sdrDaemonSinkReport" : {
"$ref" : "#/definitions/SDRdaemonSinkReport"
},
"sdrDaemonSourceReport" : {
"$ref" : "#/definitions/SDRdaemonSourceReport"
},
@ -1845,6 +1848,9 @@ margin-bottom: 20px;
"rtlSdrSettings" : {
"$ref" : "#/definitions/RtlSdrSettings"
},
"sdrDaemonSinkSettings" : {
"$ref" : "#/definitions/SDRdaemonSinkSettings"
},
"sdrDaemonSourceSettings" : {
"$ref" : "#/definitions/SDRdaemonSourceSettings"
},
@ -3168,6 +3174,55 @@ margin-bottom: 20px;
}
},
"description" : "SDRplay1"
};
defs.SDRdaemonSinkReport = {
"properties" : {
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
"description" : "ratio off the mid buffer (positive read leads)"
},
"sampleCount" : {
"type" : "integer",
"description" : "count of samples that have been sent"
}
},
"description" : "SDRdaemonSource"
};
defs.SDRdaemonSinkSettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "uint64"
},
"sampleRate" : {
"type" : "integer"
},
"log2Interp" : {
"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"
}
},
"description" : "SDRdaemonSink"
};
defs.SDRdaemonSourceReport = {
"properties" : {
@ -22558,7 +22613,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-27T20:33:10.219+02:00
Generated 2018-05-28T00:22:45.302+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,36 @@
SDRdaemonSinkSettings:
description: SDRdaemonSink
properties:
centerFrequency:
type: integer
format: uint64
sampleRate:
type: integer
log2Interp:
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
SDRdaemonSinkReport:
description: SDRdaemonSource
properties:
bufferRWBalance:
description: ratio off the mid buffer (positive read leads)
type: number
format: float
sampleCount:
description: count of samples that have been sent
type: integer

View File

@ -1775,6 +1775,8 @@ definitions:
$ref: "/doc/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputSettings"
rtlSdrSettings:
$ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
sdrDaemonSinkSettings:
$ref: "/doc/swagger/include/SDRDaemonSink.yaml#/SDRdaemonSinkSettings"
sdrDaemonSourceSettings:
$ref: "/doc/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceSettings"
sdrPlaySettings:
@ -1814,6 +1816,8 @@ definitions:
$ref: "/doc/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputReport"
rtlSdrReport:
$ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrReport"
sdrDaemonSinkReport:
$ref: "/doc/swagger/include/SDRDaemonSink.yaml#/SDRdaemonSinkReport"
sdrDaemonSourceReport:
$ref: "/doc/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceReport"
sdrPlayReport:

View File

@ -0,0 +1,36 @@
SDRdaemonSinkSettings:
description: SDRdaemonSink
properties:
centerFrequency:
type: integer
format: uint64
sampleRate:
type: integer
log2Interp:
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
SDRdaemonSinkReport:
description: SDRdaemonSource
properties:
bufferRWBalance:
description: ratio off the mid buffer (positive read leads)
type: number
format: float
sampleCount:
description: count of samples that have been sent
type: integer

View File

@ -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"
sdrDaemonSinkSettings:
$ref: "http://localhost:8081/api/swagger/include/SDRDaemonSink.yaml#/SDRdaemonSinkSettings"
sdrDaemonSourceSettings:
$ref: "http://localhost:8081/api/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceSettings"
sdrPlaySettings:
@ -1814,6 +1816,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/PlutoSdr.yaml#/PlutoSdrOutputReport"
rtlSdrReport:
$ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrReport"
sdrDaemonSinkReport:
$ref: "http://localhost:8081/api/swagger/include/SDRDaemonSink.yaml#/SDRdaemonSinkReport"
sdrDaemonSourceReport:
$ref: "http://localhost:8081/api/swagger/include/SDRDaemonSource.yaml#/SDRdaemonSourceReport"
sdrPlayReport:

View File

@ -1739,6 +1739,9 @@ margin-bottom: 20px;
"rtlSdrReport" : {
"$ref" : "#/definitions/RtlSdrReport"
},
"sdrDaemonSinkReport" : {
"$ref" : "#/definitions/SDRdaemonSinkReport"
},
"sdrDaemonSourceReport" : {
"$ref" : "#/definitions/SDRdaemonSourceReport"
},
@ -1845,6 +1848,9 @@ margin-bottom: 20px;
"rtlSdrSettings" : {
"$ref" : "#/definitions/RtlSdrSettings"
},
"sdrDaemonSinkSettings" : {
"$ref" : "#/definitions/SDRdaemonSinkSettings"
},
"sdrDaemonSourceSettings" : {
"$ref" : "#/definitions/SDRdaemonSourceSettings"
},
@ -3168,6 +3174,55 @@ margin-bottom: 20px;
}
},
"description" : "SDRplay1"
};
defs.SDRdaemonSinkReport = {
"properties" : {
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
"description" : "ratio off the mid buffer (positive read leads)"
},
"sampleCount" : {
"type" : "integer",
"description" : "count of samples that have been sent"
}
},
"description" : "SDRdaemonSource"
};
defs.SDRdaemonSinkSettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "uint64"
},
"sampleRate" : {
"type" : "integer"
},
"log2Interp" : {
"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"
}
},
"description" : "SDRdaemonSink"
};
defs.SDRdaemonSourceReport = {
"properties" : {
@ -22558,7 +22613,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-27T20:33:10.219+02:00
Generated 2018-05-28T00:22:45.302+02:00
</div>
</div>
</div>

View File

@ -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_sink_report = nullptr;
m_sdr_daemon_sink_report_isSet = false;
sdr_daemon_source_report = nullptr;
m_sdr_daemon_source_report_isSet = false;
sdr_play_report = nullptr;
@ -84,6 +86,8 @@ SWGDeviceReport::init() {
m_pluto_sdr_output_report_isSet = false;
rtl_sdr_report = new SWGRtlSdrReport();
m_rtl_sdr_report_isSet = false;
sdr_daemon_sink_report = new SWGSDRdaemonSinkReport();
m_sdr_daemon_sink_report_isSet = false;
sdr_daemon_source_report = new SWGSDRdaemonSourceReport();
m_sdr_daemon_source_report_isSet = false;
sdr_play_report = new SWGSDRPlayReport();
@ -123,6 +127,9 @@ SWGDeviceReport::cleanup() {
if(rtl_sdr_report != nullptr) {
delete rtl_sdr_report;
}
if(sdr_daemon_sink_report != nullptr) {
delete sdr_daemon_sink_report;
}
if(sdr_daemon_source_report != nullptr) {
delete sdr_daemon_source_report;
}
@ -164,6 +171,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&rtl_sdr_report, pJson["rtlSdrReport"], "SWGRtlSdrReport", "SWGRtlSdrReport");
::SWGSDRangel::setValue(&sdr_daemon_sink_report, pJson["sdrDaemonSinkReport"], "SWGSDRdaemonSinkReport", "SWGSDRdaemonSinkReport");
::SWGSDRangel::setValue(&sdr_daemon_source_report, pJson["sdrDaemonSourceReport"], "SWGSDRdaemonSourceReport", "SWGSDRdaemonSourceReport");
::SWGSDRangel::setValue(&sdr_play_report, pJson["sdrPlayReport"], "SWGSDRPlayReport", "SWGSDRPlayReport");
@ -217,6 +226,9 @@ SWGDeviceReport::asJsonObject() {
if((rtl_sdr_report != nullptr) && (rtl_sdr_report->isSet())){
toJsonValue(QString("rtlSdrReport"), rtl_sdr_report, obj, QString("SWGRtlSdrReport"));
}
if((sdr_daemon_sink_report != nullptr) && (sdr_daemon_sink_report->isSet())){
toJsonValue(QString("sdrDaemonSinkReport"), sdr_daemon_sink_report, obj, QString("SWGSDRdaemonSinkReport"));
}
if((sdr_daemon_source_report != nullptr) && (sdr_daemon_source_report->isSet())){
toJsonValue(QString("sdrDaemonSourceReport"), sdr_daemon_source_report, obj, QString("SWGSDRdaemonSourceReport"));
}
@ -337,6 +349,16 @@ SWGDeviceReport::setRtlSdrReport(SWGRtlSdrReport* rtl_sdr_report) {
this->m_rtl_sdr_report_isSet = true;
}
SWGSDRdaemonSinkReport*
SWGDeviceReport::getSdrDaemonSinkReport() {
return sdr_daemon_sink_report;
}
void
SWGDeviceReport::setSdrDaemonSinkReport(SWGSDRdaemonSinkReport* sdr_daemon_sink_report) {
this->sdr_daemon_sink_report = sdr_daemon_sink_report;
this->m_sdr_daemon_sink_report_isSet = true;
}
SWGSDRdaemonSourceReport*
SWGDeviceReport::getSdrDaemonSourceReport() {
return sdr_daemon_source_report;
@ -373,6 +395,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_sink_report != nullptr && sdr_daemon_sink_report->isSet()){ isObjectUpdated = true; break;}
if(sdr_daemon_source_report != nullptr && sdr_daemon_source_report->isSet()){ isObjectUpdated = true; break;}
if(sdr_play_report != nullptr && sdr_play_report->isSet()){ isObjectUpdated = true; break;}
}while(false);

View File

@ -32,6 +32,7 @@
#include "SWGPlutoSdrOutputReport.h"
#include "SWGRtlSdrReport.h"
#include "SWGSDRPlayReport.h"
#include "SWGSDRdaemonSinkReport.h"
#include "SWGSDRdaemonSourceReport.h"
#include <QString>
@ -86,6 +87,9 @@ public:
SWGRtlSdrReport* getRtlSdrReport();
void setRtlSdrReport(SWGRtlSdrReport* rtl_sdr_report);
SWGSDRdaemonSinkReport* getSdrDaemonSinkReport();
void setSdrDaemonSinkReport(SWGSDRdaemonSinkReport* sdr_daemon_sink_report);
SWGSDRdaemonSourceReport* getSdrDaemonSourceReport();
void setSdrDaemonSourceReport(SWGSDRdaemonSourceReport* sdr_daemon_source_report);
@ -129,6 +133,9 @@ private:
SWGRtlSdrReport* rtl_sdr_report;
bool m_rtl_sdr_report_isSet;
SWGSDRdaemonSinkReport* sdr_daemon_sink_report;
bool m_sdr_daemon_sink_report_isSet;
SWGSDRdaemonSourceReport* sdr_daemon_source_report;
bool m_sdr_daemon_source_report_isSet;

View File

@ -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_sink_settings = nullptr;
m_sdr_daemon_sink_settings_isSet = false;
sdr_daemon_source_settings = nullptr;
m_sdr_daemon_source_settings_isSet = false;
sdr_play_settings = nullptr;
@ -110,6 +112,8 @@ SWGDeviceSettings::init() {
m_pluto_sdr_output_settings_isSet = false;
rtl_sdr_settings = new SWGRtlSdrSettings();
m_rtl_sdr_settings_isSet = false;
sdr_daemon_sink_settings = new SWGSDRdaemonSinkSettings();
m_sdr_daemon_sink_settings_isSet = false;
sdr_daemon_source_settings = new SWGSDRdaemonSourceSettings();
m_sdr_daemon_source_settings_isSet = false;
sdr_play_settings = new SWGSDRPlaySettings();
@ -169,6 +173,9 @@ SWGDeviceSettings::cleanup() {
if(rtl_sdr_settings != nullptr) {
delete rtl_sdr_settings;
}
if(sdr_daemon_sink_settings != nullptr) {
delete sdr_daemon_sink_settings;
}
if(sdr_daemon_source_settings != nullptr) {
delete sdr_daemon_source_settings;
}
@ -225,6 +232,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&rtl_sdr_settings, pJson["rtlSdrSettings"], "SWGRtlSdrSettings", "SWGRtlSdrSettings");
::SWGSDRangel::setValue(&sdr_daemon_sink_settings, pJson["sdrDaemonSinkSettings"], "SWGSDRdaemonSinkSettings", "SWGSDRdaemonSinkSettings");
::SWGSDRangel::setValue(&sdr_daemon_source_settings, pJson["sdrDaemonSourceSettings"], "SWGSDRdaemonSourceSettings", "SWGSDRdaemonSourceSettings");
::SWGSDRangel::setValue(&sdr_play_settings, pJson["sdrPlaySettings"], "SWGSDRPlaySettings", "SWGSDRPlaySettings");
@ -298,6 +307,9 @@ SWGDeviceSettings::asJsonObject() {
if((rtl_sdr_settings != nullptr) && (rtl_sdr_settings->isSet())){
toJsonValue(QString("rtlSdrSettings"), rtl_sdr_settings, obj, QString("SWGRtlSdrSettings"));
}
if((sdr_daemon_sink_settings != nullptr) && (sdr_daemon_sink_settings->isSet())){
toJsonValue(QString("sdrDaemonSinkSettings"), sdr_daemon_sink_settings, obj, QString("SWGSDRdaemonSinkSettings"));
}
if((sdr_daemon_source_settings != nullptr) && (sdr_daemon_source_settings->isSet())){
toJsonValue(QString("sdrDaemonSourceSettings"), sdr_daemon_source_settings, obj, QString("SWGSDRdaemonSourceSettings"));
}
@ -481,6 +493,16 @@ SWGDeviceSettings::setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings) {
this->m_rtl_sdr_settings_isSet = true;
}
SWGSDRdaemonSinkSettings*
SWGDeviceSettings::getSdrDaemonSinkSettings() {
return sdr_daemon_sink_settings;
}
void
SWGDeviceSettings::setSdrDaemonSinkSettings(SWGSDRdaemonSinkSettings* sdr_daemon_sink_settings) {
this->sdr_daemon_sink_settings = sdr_daemon_sink_settings;
this->m_sdr_daemon_sink_settings_isSet = true;
}
SWGSDRdaemonSourceSettings*
SWGDeviceSettings::getSdrDaemonSourceSettings() {
return sdr_daemon_source_settings;
@ -533,6 +555,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_sink_settings != nullptr && sdr_daemon_sink_settings->isSet()){ isObjectUpdated = true; break;}
if(sdr_daemon_source_settings != nullptr && sdr_daemon_source_settings->isSet()){ isObjectUpdated = true; break;}
if(sdr_play_settings != nullptr && sdr_play_settings->isSet()){ isObjectUpdated = true; break;}
if(test_source_settings != nullptr && test_source_settings->isSet()){ isObjectUpdated = true; break;}

View File

@ -38,6 +38,7 @@
#include "SWGPlutoSdrOutputSettings.h"
#include "SWGRtlSdrSettings.h"
#include "SWGSDRPlaySettings.h"
#include "SWGSDRdaemonSinkSettings.h"
#include "SWGSDRdaemonSourceSettings.h"
#include "SWGTestSourceSettings.h"
#include <QString>
@ -111,6 +112,9 @@ public:
SWGRtlSdrSettings* getRtlSdrSettings();
void setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings);
SWGSDRdaemonSinkSettings* getSdrDaemonSinkSettings();
void setSdrDaemonSinkSettings(SWGSDRdaemonSinkSettings* sdr_daemon_sink_settings);
SWGSDRdaemonSourceSettings* getSdrDaemonSourceSettings();
void setSdrDaemonSourceSettings(SWGSDRdaemonSourceSettings* sdr_daemon_source_settings);
@ -175,6 +179,9 @@ private:
SWGRtlSdrSettings* rtl_sdr_settings;
bool m_rtl_sdr_settings_isSet;
SWGSDRdaemonSinkSettings* sdr_daemon_sink_settings;
bool m_sdr_daemon_sink_settings_isSet;
SWGSDRdaemonSourceSettings* sdr_daemon_source_settings;
bool m_sdr_daemon_source_settings_isSet;

View File

@ -90,6 +90,8 @@
#include "SWGRtlSdrSettings.h"
#include "SWGSDRPlayReport.h"
#include "SWGSDRPlaySettings.h"
#include "SWGSDRdaemonSinkReport.h"
#include "SWGSDRdaemonSinkSettings.h"
#include "SWGSDRdaemonSourceReport.h"
#include "SWGSDRdaemonSourceSettings.h"
#include "SWGSSBDemodReport.h"
@ -340,6 +342,12 @@ namespace SWGSDRangel {
if(QString("SWGSDRPlaySettings").compare(type) == 0) {
return new SWGSDRPlaySettings();
}
if(QString("SWGSDRdaemonSinkReport").compare(type) == 0) {
return new SWGSDRdaemonSinkReport();
}
if(QString("SWGSDRdaemonSinkSettings").compare(type) == 0) {
return new SWGSDRdaemonSinkSettings();
}
if(QString("SWGSDRdaemonSourceReport").compare(type) == 0) {
return new SWGSDRdaemonSourceReport();
}

View File

@ -0,0 +1,127 @@
/**
* 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 "SWGSDRdaemonSinkReport.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSDRdaemonSinkReport::SWGSDRdaemonSinkReport(QString* json) {
init();
this->fromJson(*json);
}
SWGSDRdaemonSinkReport::SWGSDRdaemonSinkReport() {
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
sample_count = 0;
m_sample_count_isSet = false;
}
SWGSDRdaemonSinkReport::~SWGSDRdaemonSinkReport() {
this->cleanup();
}
void
SWGSDRdaemonSinkReport::init() {
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
sample_count = 0;
m_sample_count_isSet = false;
}
void
SWGSDRdaemonSinkReport::cleanup() {
}
SWGSDRdaemonSinkReport*
SWGSDRdaemonSinkReport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSDRdaemonSinkReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&buffer_rw_balance, pJson["bufferRWBalance"], "float", "");
::SWGSDRangel::setValue(&sample_count, pJson["sampleCount"], "qint32", "");
}
QString
SWGSDRdaemonSinkReport::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSDRdaemonSinkReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_buffer_rw_balance_isSet){
obj->insert("bufferRWBalance", QJsonValue(buffer_rw_balance));
}
if(m_sample_count_isSet){
obj->insert("sampleCount", QJsonValue(sample_count));
}
return obj;
}
float
SWGSDRdaemonSinkReport::getBufferRwBalance() {
return buffer_rw_balance;
}
void
SWGSDRdaemonSinkReport::setBufferRwBalance(float buffer_rw_balance) {
this->buffer_rw_balance = buffer_rw_balance;
this->m_buffer_rw_balance_isSet = true;
}
qint32
SWGSDRdaemonSinkReport::getSampleCount() {
return sample_count;
}
void
SWGSDRdaemonSinkReport::setSampleCount(qint32 sample_count) {
this->sample_count = sample_count;
this->m_sample_count_isSet = true;
}
bool
SWGSDRdaemonSinkReport::isSet(){
bool isObjectUpdated = false;
do{
if(m_buffer_rw_balance_isSet){ isObjectUpdated = true; break;}
if(m_sample_count_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,64 @@
/**
* 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.
*/
/*
* SWGSDRdaemonSinkReport.h
*
* SDRdaemonSource
*/
#ifndef SWGSDRdaemonSinkReport_H_
#define SWGSDRdaemonSinkReport_H_
#include <QJsonObject>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSDRdaemonSinkReport: public SWGObject {
public:
SWGSDRdaemonSinkReport();
SWGSDRdaemonSinkReport(QString* json);
virtual ~SWGSDRdaemonSinkReport();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSDRdaemonSinkReport* fromJson(QString &jsonString) override;
float getBufferRwBalance();
void setBufferRwBalance(float buffer_rw_balance);
qint32 getSampleCount();
void setSampleCount(qint32 sample_count);
virtual bool isSet() override;
private:
float buffer_rw_balance;
bool m_buffer_rw_balance_isSet;
qint32 sample_count;
bool m_sample_count_isSet;
};
}
#endif /* SWGSDRdaemonSinkReport_H_ */

View File

@ -0,0 +1,278 @@
/**
* 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 "SWGSDRdaemonSinkSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSDRdaemonSinkSettings::SWGSDRdaemonSinkSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGSDRdaemonSinkSettings::SWGSDRdaemonSinkSettings() {
center_frequency = 0;
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
log2_interp = 0;
m_log2_interp_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;
}
SWGSDRdaemonSinkSettings::~SWGSDRdaemonSinkSettings() {
this->cleanup();
}
void
SWGSDRdaemonSinkSettings::init() {
center_frequency = 0;
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
log2_interp = 0;
m_log2_interp_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;
}
void
SWGSDRdaemonSinkSettings::cleanup() {
if(address != nullptr) {
delete address;
}
if(specific_parameters != nullptr) {
delete specific_parameters;
}
}
SWGSDRdaemonSinkSettings*
SWGSDRdaemonSinkSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSDRdaemonSinkSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint32", "");
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "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");
}
QString
SWGSDRdaemonSinkSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSDRdaemonSinkSettings::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_interp_isSet){
obj->insert("log2Interp", QJsonValue(log2_interp));
}
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"));
}
return obj;
}
qint32
SWGSDRdaemonSinkSettings::getCenterFrequency() {
return center_frequency;
}
void
SWGSDRdaemonSinkSettings::setCenterFrequency(qint32 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
qint32
SWGSDRdaemonSinkSettings::getSampleRate() {
return sample_rate;
}
void
SWGSDRdaemonSinkSettings::setSampleRate(qint32 sample_rate) {
this->sample_rate = sample_rate;
this->m_sample_rate_isSet = true;
}
qint32
SWGSDRdaemonSinkSettings::getLog2Interp() {
return log2_interp;
}
void
SWGSDRdaemonSinkSettings::setLog2Interp(qint32 log2_interp) {
this->log2_interp = log2_interp;
this->m_log2_interp_isSet = true;
}
float
SWGSDRdaemonSinkSettings::getTxDelay() {
return tx_delay;
}
void
SWGSDRdaemonSinkSettings::setTxDelay(float tx_delay) {
this->tx_delay = tx_delay;
this->m_tx_delay_isSet = true;
}
qint32
SWGSDRdaemonSinkSettings::getNbFecBlocks() {
return nb_fec_blocks;
}
void
SWGSDRdaemonSinkSettings::setNbFecBlocks(qint32 nb_fec_blocks) {
this->nb_fec_blocks = nb_fec_blocks;
this->m_nb_fec_blocks_isSet = true;
}
QString*
SWGSDRdaemonSinkSettings::getAddress() {
return address;
}
void
SWGSDRdaemonSinkSettings::setAddress(QString* address) {
this->address = address;
this->m_address_isSet = true;
}
qint32
SWGSDRdaemonSinkSettings::getDataPort() {
return data_port;
}
void
SWGSDRdaemonSinkSettings::setDataPort(qint32 data_port) {
this->data_port = data_port;
this->m_data_port_isSet = true;
}
qint32
SWGSDRdaemonSinkSettings::getControlPort() {
return control_port;
}
void
SWGSDRdaemonSinkSettings::setControlPort(qint32 control_port) {
this->control_port = control_port;
this->m_control_port_isSet = true;
}
QString*
SWGSDRdaemonSinkSettings::getSpecificParameters() {
return specific_parameters;
}
void
SWGSDRdaemonSinkSettings::setSpecificParameters(QString* specific_parameters) {
this->specific_parameters = specific_parameters;
this->m_specific_parameters_isSet = true;
}
bool
SWGSDRdaemonSinkSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_log2_interp_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;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,107 @@
/**
* 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.
*/
/*
* SWGSDRdaemonSinkSettings.h
*
* SDRdaemonSink
*/
#ifndef SWGSDRdaemonSinkSettings_H_
#define SWGSDRdaemonSinkSettings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSDRdaemonSinkSettings: public SWGObject {
public:
SWGSDRdaemonSinkSettings();
SWGSDRdaemonSinkSettings(QString* json);
virtual ~SWGSDRdaemonSinkSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSDRdaemonSinkSettings* fromJson(QString &jsonString) override;
qint32 getCenterFrequency();
void setCenterFrequency(qint32 center_frequency);
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
qint32 getLog2Interp();
void setLog2Interp(qint32 log2_interp);
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);
virtual bool isSet() override;
private:
qint32 center_frequency;
bool m_center_frequency_isSet;
qint32 sample_rate;
bool m_sample_rate_isSet;
qint32 log2_interp;
bool m_log2_interp_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;
};
}
#endif /* SWGSDRdaemonSinkSettings_H_ */