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

UDP Sink: Web API: settings and report implementation

This commit is contained in:
f4exb 2018-04-15 18:25:22 +02:00
parent 62998101d3
commit 274e6c645d
23 changed files with 1476 additions and 33 deletions

View File

@ -1,5 +1,7 @@
project(udpsink)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(udpsink_SOURCES
udpsink.cpp
udpsinkgui.cpp
@ -25,6 +27,7 @@ set(udpsink_FORMS
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
)
#include(${QT_USE_FILE})
@ -44,6 +47,7 @@ target_link_libraries(modudpsink
${QT_LIBRARIES}
sdrbase
sdrgui
swagger
)
qt5_use_modules(modudpsink Core Widgets Network)

View File

@ -16,6 +16,10 @@
#include <QDebug>
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
#include "SWGUDPSinkReport.h"
#include "device/devicesinkapi.h"
#include "dsp/upchannelizer.h"
#include "dsp/threadedbasebandsamplesource.h"
@ -590,3 +594,157 @@ bool UDPSink::deserialize(const QByteArray& data)
return false;
}
}
int UDPSink::webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage __attribute__((unused)))
{
response.setUdpSinkSettings(new SWGSDRangel::SWGUDPSinkSettings());
response.getUdpSinkSettings()->init();
webapiFormatChannelSettings(response, m_settings);
return 200;
}
int UDPSink::webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage __attribute__((unused)))
{
UDPSinkSettings settings;
bool frequencyOffsetChanged = false;
if (channelSettingsKeys.contains("sampleFormat")) {
settings.m_sampleFormat = (UDPSinkSettings::SampleFormat) response.getUdpSinkSettings()->getSampleFormat();
}
if (channelSettingsKeys.contains("inputSampleRate")) {
settings.m_inputSampleRate = response.getUdpSinkSettings()->getInputSampleRate();
}
if (channelSettingsKeys.contains("inputFrequencyOffset"))
{
settings.m_inputFrequencyOffset = response.getUdpSinkSettings()->getInputFrequencyOffset();
frequencyOffsetChanged = true;
}
if (channelSettingsKeys.contains("rfBandwidth")) {
settings.m_rfBandwidth = response.getUdpSinkSettings()->getRfBandwidth();
}
if (channelSettingsKeys.contains("lowCutoff")) {
settings.m_lowCutoff = response.getUdpSinkSettings()->getLowCutoff();
}
if (channelSettingsKeys.contains("fmDeviation")) {
settings.m_fmDeviation = response.getUdpSinkSettings()->getFmDeviation();
}
if (channelSettingsKeys.contains("amModFactor")) {
settings.m_amModFactor = response.getUdpSinkSettings()->getAmModFactor();
}
if (channelSettingsKeys.contains("amModFactor")) {
settings.m_amModFactor = response.getUdpSinkSettings()->getAmModFactor();
}
if (channelSettingsKeys.contains("channelMute")) {
settings.m_channelMute = response.getUdpSinkSettings()->getChannelMute() != 0;
}
if (channelSettingsKeys.contains("gainIn")) {
settings.m_gainIn = response.getUdpSinkSettings()->getGainIn();
}
if (channelSettingsKeys.contains("gainOut")) {
settings.m_gainOut = response.getUdpSinkSettings()->getGainOut();
}
if (channelSettingsKeys.contains("squelch")) {
settings.m_squelch = response.getUdpSinkSettings()->getSquelch();
}
if (channelSettingsKeys.contains("squelchGate")) {
settings.m_squelchGate = response.getUdpSinkSettings()->getSquelchGate();
}
if (channelSettingsKeys.contains("squelchEnabled")) {
settings.m_squelchEnabled = response.getUdpSinkSettings()->getSquelchEnabled() != 0;
}
if (channelSettingsKeys.contains("autoRWBalance")) {
settings.m_autoRWBalance = response.getUdpSinkSettings()->getAutoRwBalance() != 0;
}
if (channelSettingsKeys.contains("stereoInput")) {
settings.m_stereoInput = response.getUdpSinkSettings()->getStereoInput() != 0;
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getUdpSinkSettings()->getRgbColor();
}
if (channelSettingsKeys.contains("udpAddress")) {
settings.m_udpAddress = *response.getUdpSinkSettings()->getUdpAddress();
}
if (channelSettingsKeys.contains("udpPort")) {
settings.m_udpPort = response.getUdpSinkSettings()->getUdpPort();
}
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getUdpSinkSettings()->getTitle();
}
if (frequencyOffsetChanged)
{
UDPSink::MsgConfigureChannelizer *msgChan = UDPSink::MsgConfigureChannelizer::create(
settings.m_inputSampleRate,
settings.m_inputFrequencyOffset);
m_inputMessageQueue.push(msgChan);
}
MsgConfigureUDPSink *msg = MsgConfigureUDPSink::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureUDPSink *msgToGUI = MsgConfigureUDPSink::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatChannelSettings(response, settings);
return 200;
}
int UDPSink::webapiReportGet(
SWGSDRangel::SWGChannelReport& response,
QString& errorMessage __attribute__((unused)))
{
response.setUdpSinkReport(new SWGSDRangel::SWGUDPSinkReport());
response.getUdpSinkReport()->init();
webapiFormatChannelReport(response);
return 200;
}
void UDPSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSinkSettings& settings)
{
response.getUdpSinkSettings()->setSampleFormat((int) settings.m_sampleFormat);
response.getUdpSinkSettings()->setInputSampleRate(settings.m_inputSampleRate);
response.getUdpSinkSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getUdpSinkSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getUdpSinkSettings()->setLowCutoff(settings.m_lowCutoff);
response.getUdpSinkSettings()->setFmDeviation(settings.m_fmDeviation);
response.getUdpSinkSettings()->setAmModFactor(settings.m_amModFactor);
response.getUdpSinkSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
response.getUdpSinkSettings()->setGainIn(settings.m_gainIn);
response.getUdpSinkSettings()->setGainOut(settings.m_gainOut);
response.getUdpSinkSettings()->setSquelch(settings.m_squelch);
response.getUdpSinkSettings()->setSquelchGate(settings.m_squelchGate);
response.getUdpSinkSettings()->setSquelchEnabled(settings.m_squelchEnabled ? 1 : 0);
response.getUdpSinkSettings()->setAutoRwBalance(settings.m_autoRWBalance ? 1 : 0);
response.getUdpSinkSettings()->setStereoInput(settings.m_stereoInput ? 1 : 0);
response.getUdpSinkSettings()->setRgbColor(settings.m_rgbColor);
if (response.getUdpSinkSettings()->getUdpAddress()) {
*response.getUdpSinkSettings()->getUdpAddress() = settings.m_udpAddress;
} else {
response.getUdpSinkSettings()->setUdpAddress(new QString(settings.m_udpAddress));
}
response.getUdpSinkSettings()->setUdpPort(settings.m_udpPort);
if (response.getUdpSinkSettings()->getTitle()) {
*response.getUdpSinkSettings()->getTitle() = settings.m_title;
} else {
response.getUdpSinkSettings()->setTitle(new QString(settings.m_title));
}
}
void UDPSink::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
{
response.getUdpSinkReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
response.getUdpSinkReport()->setChannelSampleRate(m_outputSampleRate);
}

View File

@ -106,6 +106,20 @@ public:
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
virtual int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage);
virtual int webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage);
virtual int webapiReportGet(
SWGSDRangel::SWGChannelReport& response,
QString& errorMessage);
double getMagSq() const { return m_magsq; }
double getInMagSq() const { return m_inMagsq; }
int32_t getBufferGauge() const { return m_udpHandler.getBufferGauge(); }
@ -225,6 +239,9 @@ private:
void calculateLevel(Real sample);
void calculateLevel(Complex sample);
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSinkSettings& settings);
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
inline void calculateSquelch(double value)
{
if ((!m_settings.m_squelchEnabled) || (value > m_squelch))

View File

@ -85,8 +85,19 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
bool UDPSinkGUI::handleMessage(const Message& message __attribute__((unused)))
{
qDebug() << "UDPSinkGUI::handleMessage";
return false;
if (UDPSink::MsgConfigureUDPSink::match(message))
{
const UDPSink::MsgConfigureUDPSink& cfg = (UDPSink::MsgConfigureUDPSink&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else
{
return false;
}
}
void UDPSinkGUI::handleSourceMessages()
@ -234,6 +245,9 @@ void UDPSinkGUI::displaySettings()
ui->addressText->setText(tr("%1:%2").arg(m_settings.m_udpAddress).arg(m_settings.m_udpPort));
ui->applyBtn->setEnabled(false);
ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }");
blockApplySettings(false);
}

View File

@ -6,13 +6,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>388</width>
<width>382</width>
<height>403</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>342</width>
<width>382</width>
<height>0</height>
</size>
</property>
@ -31,12 +31,12 @@
<property name="windowTitle">
<string>UDP Sample Sink</string>
</property>
<property name="toolTipDuration">
<number>-1</number>
</property>
<property name="statusTip">
<string>UDP Sample Sink</string>
</property>
<property name="toolTipDuration" stdset="0">
<number>-1</number>
</property>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
@ -56,16 +56,7 @@
<string>Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
@ -92,7 +83,7 @@
<string>Input sample rate (S/s)</string>
</property>
<property name="inputMask">
<string>0009999</string>
<string>0009999; </string>
</property>
<property name="text">
<string>48000</string>
@ -122,7 +113,7 @@
<string>Signal bandwidth (Hz)</string>
</property>
<property name="inputMask">
<string>0009999</string>
<string>0009999; </string>
</property>
<property name="text">
<string>32000</string>
@ -506,7 +497,7 @@
<string>FM deviation in Hz</string>
</property>
<property name="inputMask">
<string>00000</string>
<string>00000; </string>
</property>
<property name="text">
<string>2500</string>
@ -532,7 +523,7 @@
<string>Percentage of AM modulation</string>
</property>
<property name="inputMask">
<string>000</string>
<string>000; </string>
</property>
<property name="text">
<string>95</string>
@ -897,16 +888,7 @@
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>

View File

@ -14,6 +14,7 @@
<file>webapi/doc/swagger/include/NFMDemod.yaml</file>
<file>webapi/doc/swagger/include/NFMMod.yaml</file>
<file>webapi/doc/swagger/include/SSBMod.yaml</file>
<file>webapi/doc/swagger/include/UDPSink.yaml</file>
<file>webapi/doc/swagger/include/WFMMod.yaml</file>
<file>webapi/doc/swagger/include/RtlSdr.yaml</file>
<file>webapi/doc/swagger-ui/swagger-ui.js.map</file>

View File

@ -1229,6 +1229,9 @@ margin-bottom: 20px;
"SSBModReport" : {
"$ref" : "#/definitions/SSBModReport"
},
"UDPSinkReport" : {
"$ref" : "#/definitions/UDPSinkReport"
},
"WFMModReport" : {
"$ref" : "#/definitions/WFMModReport"
}
@ -1265,6 +1268,9 @@ margin-bottom: 20px;
"SSBModSettings" : {
"$ref" : "#/definitions/SSBModSettings"
},
"UDPSinkSettings" : {
"$ref" : "#/definitions/UDPSinkSettings"
},
"WFMModSettings" : {
"$ref" : "#/definitions/WFMModSettings"
}
@ -2238,6 +2244,91 @@ margin-bottom: 20px;
"type" : "string"
}
}
};
defs.UDPSinkReport = {
"properties" : {
"channelPowerDB" : {
"type" : "number",
"format" : "float",
"description" : "power transmitted in channel (dB)"
},
"channelSampleRate" : {
"type" : "integer"
}
},
"description" : "UDPSink"
};
defs.UDPSinkSettings = {
"properties" : {
"sampleFormat" : {
"type" : "integer"
},
"inputSampleRate" : {
"type" : "number",
"format" : "float"
},
"inputFrequencyOffset" : {
"type" : "integer",
"format" : "int64"
},
"rfBandwidth" : {
"type" : "number",
"format" : "float"
},
"lowCutoff" : {
"type" : "number",
"format" : "float"
},
"fmDeviation" : {
"type" : "integer"
},
"amModFactor" : {
"type" : "number",
"format" : "float"
},
"channelMute" : {
"type" : "integer"
},
"gainIn" : {
"type" : "number",
"format" : "float"
},
"gainOut" : {
"type" : "number",
"format" : "float"
},
"squelch" : {
"type" : "number",
"format" : "float"
},
"squelchGate" : {
"type" : "number",
"format" : "float"
},
"squelchEnabled" : {
"type" : "integer"
},
"autoRWBalance" : {
"type" : "integer"
},
"stereoInput" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
"udpAddress" : {
"type" : "string"
},
"udpPort" : {
"type" : "integer",
"format" : "uint16"
},
"title" : {
"type" : "string"
}
},
"description" : "UDPSink"
};
defs.WFMModReport = {
"properties" : {
@ -20538,7 +20629,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-04-15T01:40:30.919+02:00
Generated 2018-04-15T11:16:57.480+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,62 @@
UDPSinkSettings:
description: UDPSink
properties:
sampleFormat:
type: integer
inputSampleRate:
type: number
format: float
inputFrequencyOffset:
type: integer
format: int64
rfBandwidth:
type: number
format: float
lowCutoff:
type: number
format: float
fmDeviation:
type: integer
amModFactor:
type: number
format: float
channelMute:
type: integer
gainIn:
type: number
format: float
gainOut:
type: number
format: float
squelch:
type: number
format: float
squelchGate:
type: number
format: float
squelchEnabled:
type: integer
autoRWBalance:
type: integer
stereoInput:
type: integer
rgbColor:
type: integer
udpAddress:
type: string
udpPort:
type: integer
format: uint16
title:
type: string
UDPSinkReport:
description: UDPSink
properties:
channelPowerDB:
description: power transmitted in channel (dB)
type: number
format: float
channelSampleRate:
type: integer

View File

@ -1757,6 +1757,8 @@ definitions:
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModSettings"
SSBModSettings:
$ref: "/doc/swagger/include/SSBMod.yaml#/SSBModSettings"
UDPSinkSettings:
$ref: "/doc/swagger/include/UDPSink.yaml#/UDPSinkSettings"
WFMModSettings:
$ref: "/doc/swagger/include/WFMMod.yaml#/WFMModSettings"
@ -1782,6 +1784,8 @@ definitions:
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModReport"
SSBModReport:
$ref: "/doc/swagger/include/SSBMod.yaml#/SSBModReport"
UDPSinkReport:
$ref: "/doc/swagger/include/UDPSink.yaml#/UDPSinkReport"
WFMModReport:
$ref: "/doc/swagger/include/WFMMod.yaml#/WFMModReport"

View File

@ -1931,6 +1931,20 @@ bool WebAPIRequestMapper::validateChannelSettings(
return false;
}
}
else if (*channelType == "UDPSink")
{
if (channelSettings.getTx() != 0)
{
QJsonObject udpSinkSettingsJsonObject = jsonObject["UDPSinkSettings"].toObject();
channelSettingsKeys = udpSinkSettingsJsonObject.keys();
channelSettings.setUdpSinkSettings(new SWGSDRangel::SWGUDPSinkSettings());
channelSettings.getUdpSinkSettings()->fromJsonObject(udpSinkSettingsJsonObject);
return true;
}
else {
return false;
}
}
else if (*channelType == "WFMMod")
{
if (channelSettings.getTx() != 0)
@ -2061,6 +2075,20 @@ bool WebAPIRequestMapper::validateChannelReport(
return false;
}
}
else if (*channelType == "UDPSink")
{
if (channelReport.getTx() != 0)
{
QJsonObject udpSinkReportJsonObject = jsonObject["UDPSinkReport"].toObject();
channelReportKeys = udpSinkReportJsonObject.keys();
channelReport.setUdpSinkReport(new SWGSDRangel::SWGUDPSinkReport());
channelReport.getUdpSinkReport()->fromJsonObject(udpSinkReportJsonObject);
return true;
}
else {
return false;
}
}
else if (*channelType == "WFMMod")
{
if (channelReport.getTx() != 0)

View File

@ -0,0 +1,62 @@
UDPSinkSettings:
description: UDPSink
properties:
sampleFormat:
type: integer
inputSampleRate:
type: number
format: float
inputFrequencyOffset:
type: integer
format: int64
rfBandwidth:
type: number
format: float
lowCutoff:
type: number
format: float
fmDeviation:
type: integer
amModFactor:
type: number
format: float
channelMute:
type: integer
gainIn:
type: number
format: float
gainOut:
type: number
format: float
squelch:
type: number
format: float
squelchGate:
type: number
format: float
squelchEnabled:
type: integer
autoRWBalance:
type: integer
stereoInput:
type: integer
rgbColor:
type: integer
udpAddress:
type: string
udpPort:
type: integer
format: uint16
title:
type: string
UDPSinkReport:
description: UDPSink
properties:
channelPowerDB:
description: power transmitted in channel (dB)
type: number
format: float
channelSampleRate:
type: integer

View File

@ -1757,6 +1757,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModSettings"
SSBModSettings:
$ref: "http://localhost:8081/api/swagger/include/SSBMod.yaml#/SSBModSettings"
UDPSinkSettings:
$ref: "http://localhost:8081/api/swagger/include/UDPSink.yaml#/UDPSinkSettings"
WFMModSettings:
$ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModSettings"
@ -1782,6 +1784,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModReport"
SSBModReport:
$ref: "http://localhost:8081/api/swagger/include/SSBMod.yaml#/SSBModReport"
UDPSinkReport:
$ref: "http://localhost:8081/api/swagger/include/UDPSink.yaml#/UDPSinkReport"
WFMModReport:
$ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModReport"

View File

@ -1229,6 +1229,9 @@ margin-bottom: 20px;
"SSBModReport" : {
"$ref" : "#/definitions/SSBModReport"
},
"UDPSinkReport" : {
"$ref" : "#/definitions/UDPSinkReport"
},
"WFMModReport" : {
"$ref" : "#/definitions/WFMModReport"
}
@ -1265,6 +1268,9 @@ margin-bottom: 20px;
"SSBModSettings" : {
"$ref" : "#/definitions/SSBModSettings"
},
"UDPSinkSettings" : {
"$ref" : "#/definitions/UDPSinkSettings"
},
"WFMModSettings" : {
"$ref" : "#/definitions/WFMModSettings"
}
@ -2238,6 +2244,91 @@ margin-bottom: 20px;
"type" : "string"
}
}
};
defs.UDPSinkReport = {
"properties" : {
"channelPowerDB" : {
"type" : "number",
"format" : "float",
"description" : "power transmitted in channel (dB)"
},
"channelSampleRate" : {
"type" : "integer"
}
},
"description" : "UDPSink"
};
defs.UDPSinkSettings = {
"properties" : {
"sampleFormat" : {
"type" : "integer"
},
"inputSampleRate" : {
"type" : "number",
"format" : "float"
},
"inputFrequencyOffset" : {
"type" : "integer",
"format" : "int64"
},
"rfBandwidth" : {
"type" : "number",
"format" : "float"
},
"lowCutoff" : {
"type" : "number",
"format" : "float"
},
"fmDeviation" : {
"type" : "integer"
},
"amModFactor" : {
"type" : "number",
"format" : "float"
},
"channelMute" : {
"type" : "integer"
},
"gainIn" : {
"type" : "number",
"format" : "float"
},
"gainOut" : {
"type" : "number",
"format" : "float"
},
"squelch" : {
"type" : "number",
"format" : "float"
},
"squelchGate" : {
"type" : "number",
"format" : "float"
},
"squelchEnabled" : {
"type" : "integer"
},
"autoRWBalance" : {
"type" : "integer"
},
"stereoInput" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
"udpAddress" : {
"type" : "string"
},
"udpPort" : {
"type" : "integer",
"format" : "uint16"
},
"title" : {
"type" : "string"
}
},
"description" : "UDPSink"
};
defs.WFMModReport = {
"properties" : {
@ -20538,7 +20629,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-04-15T01:40:30.919+02:00
Generated 2018-04-15T11:16:57.480+02:00
</div>
</div>
</div>

View File

@ -44,6 +44,8 @@ SWGChannelReport::SWGChannelReport() {
m_nfm_mod_report_isSet = false;
ssb_mod_report = nullptr;
m_ssb_mod_report_isSet = false;
udp_sink_report = nullptr;
m_udp_sink_report_isSet = false;
wfm_mod_report = nullptr;
m_wfm_mod_report_isSet = false;
}
@ -70,6 +72,8 @@ SWGChannelReport::init() {
m_nfm_mod_report_isSet = false;
ssb_mod_report = new SWGSSBModReport();
m_ssb_mod_report_isSet = false;
udp_sink_report = new SWGUDPSinkReport();
m_udp_sink_report_isSet = false;
wfm_mod_report = new SWGWFMModReport();
m_wfm_mod_report_isSet = false;
}
@ -98,6 +102,9 @@ SWGChannelReport::cleanup() {
if(ssb_mod_report != nullptr) {
delete ssb_mod_report;
}
if(udp_sink_report != nullptr) {
delete udp_sink_report;
}
if(wfm_mod_report != nullptr) {
delete wfm_mod_report;
}
@ -130,6 +137,8 @@ SWGChannelReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&ssb_mod_report, pJson["SSBModReport"], "SWGSSBModReport", "SWGSSBModReport");
::SWGSDRangel::setValue(&udp_sink_report, pJson["UDPSinkReport"], "SWGUDPSinkReport", "SWGUDPSinkReport");
::SWGSDRangel::setValue(&wfm_mod_report, pJson["WFMModReport"], "SWGWFMModReport", "SWGWFMModReport");
}
@ -172,6 +181,9 @@ SWGChannelReport::asJsonObject() {
if((ssb_mod_report != nullptr) && (ssb_mod_report->isSet())){
toJsonValue(QString("SSBModReport"), ssb_mod_report, obj, QString("SWGSSBModReport"));
}
if((udp_sink_report != nullptr) && (udp_sink_report->isSet())){
toJsonValue(QString("UDPSinkReport"), udp_sink_report, obj, QString("SWGUDPSinkReport"));
}
if((wfm_mod_report != nullptr) && (wfm_mod_report->isSet())){
toJsonValue(QString("WFMModReport"), wfm_mod_report, obj, QString("SWGWFMModReport"));
}
@ -259,6 +271,16 @@ SWGChannelReport::setSsbModReport(SWGSSBModReport* ssb_mod_report) {
this->m_ssb_mod_report_isSet = true;
}
SWGUDPSinkReport*
SWGChannelReport::getUdpSinkReport() {
return udp_sink_report;
}
void
SWGChannelReport::setUdpSinkReport(SWGUDPSinkReport* udp_sink_report) {
this->udp_sink_report = udp_sink_report;
this->m_udp_sink_report_isSet = true;
}
SWGWFMModReport*
SWGChannelReport::getWfmModReport() {
return wfm_mod_report;
@ -282,6 +304,7 @@ SWGChannelReport::isSet(){
if(nfm_demod_report != nullptr && nfm_demod_report->isSet()){ isObjectUpdated = true; break;}
if(nfm_mod_report != nullptr && nfm_mod_report->isSet()){ isObjectUpdated = true; break;}
if(ssb_mod_report != nullptr && ssb_mod_report->isSet()){ isObjectUpdated = true; break;}
if(udp_sink_report != nullptr && udp_sink_report->isSet()){ isObjectUpdated = true; break;}
if(wfm_mod_report != nullptr && wfm_mod_report->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;

View File

@ -28,6 +28,7 @@
#include "SWGNFMDemodReport.h"
#include "SWGNFMModReport.h"
#include "SWGSSBModReport.h"
#include "SWGUDPSinkReport.h"
#include "SWGWFMModReport.h"
#include <QString>
@ -73,6 +74,9 @@ public:
SWGSSBModReport* getSsbModReport();
void setSsbModReport(SWGSSBModReport* ssb_mod_report);
SWGUDPSinkReport* getUdpSinkReport();
void setUdpSinkReport(SWGUDPSinkReport* udp_sink_report);
SWGWFMModReport* getWfmModReport();
void setWfmModReport(SWGWFMModReport* wfm_mod_report);
@ -104,6 +108,9 @@ private:
SWGSSBModReport* ssb_mod_report;
bool m_ssb_mod_report_isSet;
SWGUDPSinkReport* udp_sink_report;
bool m_udp_sink_report_isSet;
SWGWFMModReport* wfm_mod_report;
bool m_wfm_mod_report_isSet;

View File

@ -44,6 +44,8 @@ SWGChannelSettings::SWGChannelSettings() {
m_nfm_mod_settings_isSet = false;
ssb_mod_settings = nullptr;
m_ssb_mod_settings_isSet = false;
udp_sink_settings = nullptr;
m_udp_sink_settings_isSet = false;
wfm_mod_settings = nullptr;
m_wfm_mod_settings_isSet = false;
}
@ -70,6 +72,8 @@ SWGChannelSettings::init() {
m_nfm_mod_settings_isSet = false;
ssb_mod_settings = new SWGSSBModSettings();
m_ssb_mod_settings_isSet = false;
udp_sink_settings = new SWGUDPSinkSettings();
m_udp_sink_settings_isSet = false;
wfm_mod_settings = new SWGWFMModSettings();
m_wfm_mod_settings_isSet = false;
}
@ -98,6 +102,9 @@ SWGChannelSettings::cleanup() {
if(ssb_mod_settings != nullptr) {
delete ssb_mod_settings;
}
if(udp_sink_settings != nullptr) {
delete udp_sink_settings;
}
if(wfm_mod_settings != nullptr) {
delete wfm_mod_settings;
}
@ -130,6 +137,8 @@ SWGChannelSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&ssb_mod_settings, pJson["SSBModSettings"], "SWGSSBModSettings", "SWGSSBModSettings");
::SWGSDRangel::setValue(&udp_sink_settings, pJson["UDPSinkSettings"], "SWGUDPSinkSettings", "SWGUDPSinkSettings");
::SWGSDRangel::setValue(&wfm_mod_settings, pJson["WFMModSettings"], "SWGWFMModSettings", "SWGWFMModSettings");
}
@ -172,6 +181,9 @@ SWGChannelSettings::asJsonObject() {
if((ssb_mod_settings != nullptr) && (ssb_mod_settings->isSet())){
toJsonValue(QString("SSBModSettings"), ssb_mod_settings, obj, QString("SWGSSBModSettings"));
}
if((udp_sink_settings != nullptr) && (udp_sink_settings->isSet())){
toJsonValue(QString("UDPSinkSettings"), udp_sink_settings, obj, QString("SWGUDPSinkSettings"));
}
if((wfm_mod_settings != nullptr) && (wfm_mod_settings->isSet())){
toJsonValue(QString("WFMModSettings"), wfm_mod_settings, obj, QString("SWGWFMModSettings"));
}
@ -259,6 +271,16 @@ SWGChannelSettings::setSsbModSettings(SWGSSBModSettings* ssb_mod_settings) {
this->m_ssb_mod_settings_isSet = true;
}
SWGUDPSinkSettings*
SWGChannelSettings::getUdpSinkSettings() {
return udp_sink_settings;
}
void
SWGChannelSettings::setUdpSinkSettings(SWGUDPSinkSettings* udp_sink_settings) {
this->udp_sink_settings = udp_sink_settings;
this->m_udp_sink_settings_isSet = true;
}
SWGWFMModSettings*
SWGChannelSettings::getWfmModSettings() {
return wfm_mod_settings;
@ -282,6 +304,7 @@ SWGChannelSettings::isSet(){
if(nfm_demod_settings != nullptr && nfm_demod_settings->isSet()){ isObjectUpdated = true; break;}
if(nfm_mod_settings != nullptr && nfm_mod_settings->isSet()){ isObjectUpdated = true; break;}
if(ssb_mod_settings != nullptr && ssb_mod_settings->isSet()){ isObjectUpdated = true; break;}
if(udp_sink_settings != nullptr && udp_sink_settings->isSet()){ isObjectUpdated = true; break;}
if(wfm_mod_settings != nullptr && wfm_mod_settings->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;

View File

@ -28,6 +28,7 @@
#include "SWGNFMDemodSettings.h"
#include "SWGNFMModSettings.h"
#include "SWGSSBModSettings.h"
#include "SWGUDPSinkSettings.h"
#include "SWGWFMModSettings.h"
#include <QString>
@ -73,6 +74,9 @@ public:
SWGSSBModSettings* getSsbModSettings();
void setSsbModSettings(SWGSSBModSettings* ssb_mod_settings);
SWGUDPSinkSettings* getUdpSinkSettings();
void setUdpSinkSettings(SWGUDPSinkSettings* udp_sink_settings);
SWGWFMModSettings* getWfmModSettings();
void setWfmModSettings(SWGWFMModSettings* wfm_mod_settings);
@ -104,6 +108,9 @@ private:
SWGSSBModSettings* ssb_mod_settings;
bool m_ssb_mod_settings_isSet;
SWGUDPSinkSettings* udp_sink_settings;
bool m_udp_sink_settings_isSet;
SWGWFMModSettings* wfm_mod_settings;
bool m_wfm_mod_settings_isSet;

View File

@ -66,6 +66,8 @@
#include "SWGSSBModSettings.h"
#include "SWGSamplingDevice.h"
#include "SWGSuccessResponse.h"
#include "SWGUDPSinkReport.h"
#include "SWGUDPSinkSettings.h"
#include "SWGWFMModReport.h"
#include "SWGWFMModSettings.h"
@ -228,6 +230,12 @@ namespace SWGSDRangel {
if(QString("SWGSuccessResponse").compare(type) == 0) {
return new SWGSuccessResponse();
}
if(QString("SWGUDPSinkReport").compare(type) == 0) {
return new SWGUDPSinkReport();
}
if(QString("SWGUDPSinkSettings").compare(type) == 0) {
return new SWGUDPSinkSettings();
}
if(QString("SWGWFMModReport").compare(type) == 0) {
return new SWGWFMModReport();
}

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 "SWGUDPSinkReport.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGUDPSinkReport::SWGUDPSinkReport(QString* json) {
init();
this->fromJson(*json);
}
SWGUDPSinkReport::SWGUDPSinkReport() {
channel_power_db = 0.0f;
m_channel_power_db_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
}
SWGUDPSinkReport::~SWGUDPSinkReport() {
this->cleanup();
}
void
SWGUDPSinkReport::init() {
channel_power_db = 0.0f;
m_channel_power_db_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
}
void
SWGUDPSinkReport::cleanup() {
}
SWGUDPSinkReport*
SWGUDPSinkReport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGUDPSinkReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
}
QString
SWGUDPSinkReport::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGUDPSinkReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_channel_power_db_isSet){
obj->insert("channelPowerDB", QJsonValue(channel_power_db));
}
if(m_channel_sample_rate_isSet){
obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
}
return obj;
}
float
SWGUDPSinkReport::getChannelPowerDb() {
return channel_power_db;
}
void
SWGUDPSinkReport::setChannelPowerDb(float channel_power_db) {
this->channel_power_db = channel_power_db;
this->m_channel_power_db_isSet = true;
}
qint32
SWGUDPSinkReport::getChannelSampleRate() {
return channel_sample_rate;
}
void
SWGUDPSinkReport::setChannelSampleRate(qint32 channel_sample_rate) {
this->channel_sample_rate = channel_sample_rate;
this->m_channel_sample_rate_isSet = true;
}
bool
SWGUDPSinkReport::isSet(){
bool isObjectUpdated = false;
do{
if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
if(m_channel_sample_rate_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.
*/
/*
* SWGUDPSinkReport.h
*
* UDPSink
*/
#ifndef SWGUDPSinkReport_H_
#define SWGUDPSinkReport_H_
#include <QJsonObject>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGUDPSinkReport: public SWGObject {
public:
SWGUDPSinkReport();
SWGUDPSinkReport(QString* json);
virtual ~SWGUDPSinkReport();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGUDPSinkReport* fromJson(QString &jsonString) override;
float getChannelPowerDb();
void setChannelPowerDb(float channel_power_db);
qint32 getChannelSampleRate();
void setChannelSampleRate(qint32 channel_sample_rate);
virtual bool isSet() override;
private:
float channel_power_db;
bool m_channel_power_db_isSet;
qint32 channel_sample_rate;
bool m_channel_sample_rate_isSet;
};
}
#endif /* SWGUDPSinkReport_H_ */

View File

@ -0,0 +1,488 @@
/**
* 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 "SWGUDPSinkSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGUDPSinkSettings::SWGUDPSinkSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGUDPSinkSettings::SWGUDPSinkSettings() {
sample_format = 0;
m_sample_format_isSet = false;
input_sample_rate = 0.0f;
m_input_sample_rate_isSet = false;
input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
low_cutoff = 0.0f;
m_low_cutoff_isSet = false;
fm_deviation = 0;
m_fm_deviation_isSet = false;
am_mod_factor = 0.0f;
m_am_mod_factor_isSet = false;
channel_mute = 0;
m_channel_mute_isSet = false;
gain_in = 0.0f;
m_gain_in_isSet = false;
gain_out = 0.0f;
m_gain_out_isSet = false;
squelch = 0.0f;
m_squelch_isSet = false;
squelch_gate = 0.0f;
m_squelch_gate_isSet = false;
squelch_enabled = 0;
m_squelch_enabled_isSet = false;
auto_rw_balance = 0;
m_auto_rw_balance_isSet = false;
stereo_input = 0;
m_stereo_input_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
udp_address = nullptr;
m_udp_address_isSet = false;
udp_port = 0;
m_udp_port_isSet = false;
title = nullptr;
m_title_isSet = false;
}
SWGUDPSinkSettings::~SWGUDPSinkSettings() {
this->cleanup();
}
void
SWGUDPSinkSettings::init() {
sample_format = 0;
m_sample_format_isSet = false;
input_sample_rate = 0.0f;
m_input_sample_rate_isSet = false;
input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
low_cutoff = 0.0f;
m_low_cutoff_isSet = false;
fm_deviation = 0;
m_fm_deviation_isSet = false;
am_mod_factor = 0.0f;
m_am_mod_factor_isSet = false;
channel_mute = 0;
m_channel_mute_isSet = false;
gain_in = 0.0f;
m_gain_in_isSet = false;
gain_out = 0.0f;
m_gain_out_isSet = false;
squelch = 0.0f;
m_squelch_isSet = false;
squelch_gate = 0.0f;
m_squelch_gate_isSet = false;
squelch_enabled = 0;
m_squelch_enabled_isSet = false;
auto_rw_balance = 0;
m_auto_rw_balance_isSet = false;
stereo_input = 0;
m_stereo_input_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
udp_address = new QString("");
m_udp_address_isSet = false;
udp_port = 0;
m_udp_port_isSet = false;
title = new QString("");
m_title_isSet = false;
}
void
SWGUDPSinkSettings::cleanup() {
if(udp_address != nullptr) {
delete udp_address;
}
if(title != nullptr) {
delete title;
}
}
SWGUDPSinkSettings*
SWGUDPSinkSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGUDPSinkSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_format, pJson["sampleFormat"], "qint32", "");
::SWGSDRangel::setValue(&input_sample_rate, pJson["inputSampleRate"], "float", "");
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
::SWGSDRangel::setValue(&low_cutoff, pJson["lowCutoff"], "float", "");
::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", "");
::SWGSDRangel::setValue(&am_mod_factor, pJson["amModFactor"], "float", "");
::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", "");
::SWGSDRangel::setValue(&gain_in, pJson["gainIn"], "float", "");
::SWGSDRangel::setValue(&gain_out, pJson["gainOut"], "float", "");
::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", "");
::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "float", "");
::SWGSDRangel::setValue(&squelch_enabled, pJson["squelchEnabled"], "qint32", "");
::SWGSDRangel::setValue(&auto_rw_balance, pJson["autoRWBalance"], "qint32", "");
::SWGSDRangel::setValue(&stereo_input, pJson["stereoInput"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString");
::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
}
QString
SWGUDPSinkSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGUDPSinkSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_sample_format_isSet){
obj->insert("sampleFormat", QJsonValue(sample_format));
}
if(m_input_sample_rate_isSet){
obj->insert("inputSampleRate", QJsonValue(input_sample_rate));
}
if(m_input_frequency_offset_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
}
if(m_rf_bandwidth_isSet){
obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
}
if(m_low_cutoff_isSet){
obj->insert("lowCutoff", QJsonValue(low_cutoff));
}
if(m_fm_deviation_isSet){
obj->insert("fmDeviation", QJsonValue(fm_deviation));
}
if(m_am_mod_factor_isSet){
obj->insert("amModFactor", QJsonValue(am_mod_factor));
}
if(m_channel_mute_isSet){
obj->insert("channelMute", QJsonValue(channel_mute));
}
if(m_gain_in_isSet){
obj->insert("gainIn", QJsonValue(gain_in));
}
if(m_gain_out_isSet){
obj->insert("gainOut", QJsonValue(gain_out));
}
if(m_squelch_isSet){
obj->insert("squelch", QJsonValue(squelch));
}
if(m_squelch_gate_isSet){
obj->insert("squelchGate", QJsonValue(squelch_gate));
}
if(m_squelch_enabled_isSet){
obj->insert("squelchEnabled", QJsonValue(squelch_enabled));
}
if(m_auto_rw_balance_isSet){
obj->insert("autoRWBalance", QJsonValue(auto_rw_balance));
}
if(m_stereo_input_isSet){
obj->insert("stereoInput", QJsonValue(stereo_input));
}
if(m_rgb_color_isSet){
obj->insert("rgbColor", QJsonValue(rgb_color));
}
if(udp_address != nullptr && *udp_address != QString("")){
toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString"));
}
if(m_udp_port_isSet){
obj->insert("udpPort", QJsonValue(udp_port));
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString"));
}
return obj;
}
qint32
SWGUDPSinkSettings::getSampleFormat() {
return sample_format;
}
void
SWGUDPSinkSettings::setSampleFormat(qint32 sample_format) {
this->sample_format = sample_format;
this->m_sample_format_isSet = true;
}
float
SWGUDPSinkSettings::getInputSampleRate() {
return input_sample_rate;
}
void
SWGUDPSinkSettings::setInputSampleRate(float input_sample_rate) {
this->input_sample_rate = input_sample_rate;
this->m_input_sample_rate_isSet = true;
}
qint64
SWGUDPSinkSettings::getInputFrequencyOffset() {
return input_frequency_offset;
}
void
SWGUDPSinkSettings::setInputFrequencyOffset(qint64 input_frequency_offset) {
this->input_frequency_offset = input_frequency_offset;
this->m_input_frequency_offset_isSet = true;
}
float
SWGUDPSinkSettings::getRfBandwidth() {
return rf_bandwidth;
}
void
SWGUDPSinkSettings::setRfBandwidth(float rf_bandwidth) {
this->rf_bandwidth = rf_bandwidth;
this->m_rf_bandwidth_isSet = true;
}
float
SWGUDPSinkSettings::getLowCutoff() {
return low_cutoff;
}
void
SWGUDPSinkSettings::setLowCutoff(float low_cutoff) {
this->low_cutoff = low_cutoff;
this->m_low_cutoff_isSet = true;
}
qint32
SWGUDPSinkSettings::getFmDeviation() {
return fm_deviation;
}
void
SWGUDPSinkSettings::setFmDeviation(qint32 fm_deviation) {
this->fm_deviation = fm_deviation;
this->m_fm_deviation_isSet = true;
}
float
SWGUDPSinkSettings::getAmModFactor() {
return am_mod_factor;
}
void
SWGUDPSinkSettings::setAmModFactor(float am_mod_factor) {
this->am_mod_factor = am_mod_factor;
this->m_am_mod_factor_isSet = true;
}
qint32
SWGUDPSinkSettings::getChannelMute() {
return channel_mute;
}
void
SWGUDPSinkSettings::setChannelMute(qint32 channel_mute) {
this->channel_mute = channel_mute;
this->m_channel_mute_isSet = true;
}
float
SWGUDPSinkSettings::getGainIn() {
return gain_in;
}
void
SWGUDPSinkSettings::setGainIn(float gain_in) {
this->gain_in = gain_in;
this->m_gain_in_isSet = true;
}
float
SWGUDPSinkSettings::getGainOut() {
return gain_out;
}
void
SWGUDPSinkSettings::setGainOut(float gain_out) {
this->gain_out = gain_out;
this->m_gain_out_isSet = true;
}
float
SWGUDPSinkSettings::getSquelch() {
return squelch;
}
void
SWGUDPSinkSettings::setSquelch(float squelch) {
this->squelch = squelch;
this->m_squelch_isSet = true;
}
float
SWGUDPSinkSettings::getSquelchGate() {
return squelch_gate;
}
void
SWGUDPSinkSettings::setSquelchGate(float squelch_gate) {
this->squelch_gate = squelch_gate;
this->m_squelch_gate_isSet = true;
}
qint32
SWGUDPSinkSettings::getSquelchEnabled() {
return squelch_enabled;
}
void
SWGUDPSinkSettings::setSquelchEnabled(qint32 squelch_enabled) {
this->squelch_enabled = squelch_enabled;
this->m_squelch_enabled_isSet = true;
}
qint32
SWGUDPSinkSettings::getAutoRwBalance() {
return auto_rw_balance;
}
void
SWGUDPSinkSettings::setAutoRwBalance(qint32 auto_rw_balance) {
this->auto_rw_balance = auto_rw_balance;
this->m_auto_rw_balance_isSet = true;
}
qint32
SWGUDPSinkSettings::getStereoInput() {
return stereo_input;
}
void
SWGUDPSinkSettings::setStereoInput(qint32 stereo_input) {
this->stereo_input = stereo_input;
this->m_stereo_input_isSet = true;
}
qint32
SWGUDPSinkSettings::getRgbColor() {
return rgb_color;
}
void
SWGUDPSinkSettings::setRgbColor(qint32 rgb_color) {
this->rgb_color = rgb_color;
this->m_rgb_color_isSet = true;
}
QString*
SWGUDPSinkSettings::getUdpAddress() {
return udp_address;
}
void
SWGUDPSinkSettings::setUdpAddress(QString* udp_address) {
this->udp_address = udp_address;
this->m_udp_address_isSet = true;
}
qint32
SWGUDPSinkSettings::getUdpPort() {
return udp_port;
}
void
SWGUDPSinkSettings::setUdpPort(qint32 udp_port) {
this->udp_port = udp_port;
this->m_udp_port_isSet = true;
}
QString*
SWGUDPSinkSettings::getTitle() {
return title;
}
void
SWGUDPSinkSettings::setTitle(QString* title) {
this->title = title;
this->m_title_isSet = true;
}
bool
SWGUDPSinkSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_sample_format_isSet){ isObjectUpdated = true; break;}
if(m_input_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_low_cutoff_isSet){ isObjectUpdated = true; break;}
if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
if(m_am_mod_factor_isSet){ isObjectUpdated = true; break;}
if(m_channel_mute_isSet){ isObjectUpdated = true; break;}
if(m_gain_in_isSet){ isObjectUpdated = true; break;}
if(m_gain_out_isSet){ isObjectUpdated = true; break;}
if(m_squelch_isSet){ isObjectUpdated = true; break;}
if(m_squelch_gate_isSet){ isObjectUpdated = true; break;}
if(m_squelch_enabled_isSet){ isObjectUpdated = true; break;}
if(m_auto_rw_balance_isSet){ isObjectUpdated = true; break;}
if(m_stereo_input_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(udp_address != nullptr && *udp_address != QString("")){ isObjectUpdated = true; break;}
if(m_udp_port_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,167 @@
/**
* 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.
*/
/*
* SWGUDPSinkSettings.h
*
* UDPSink
*/
#ifndef SWGUDPSinkSettings_H_
#define SWGUDPSinkSettings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGUDPSinkSettings: public SWGObject {
public:
SWGUDPSinkSettings();
SWGUDPSinkSettings(QString* json);
virtual ~SWGUDPSinkSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGUDPSinkSettings* fromJson(QString &jsonString) override;
qint32 getSampleFormat();
void setSampleFormat(qint32 sample_format);
float getInputSampleRate();
void setInputSampleRate(float input_sample_rate);
qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset);
float getRfBandwidth();
void setRfBandwidth(float rf_bandwidth);
float getLowCutoff();
void setLowCutoff(float low_cutoff);
qint32 getFmDeviation();
void setFmDeviation(qint32 fm_deviation);
float getAmModFactor();
void setAmModFactor(float am_mod_factor);
qint32 getChannelMute();
void setChannelMute(qint32 channel_mute);
float getGainIn();
void setGainIn(float gain_in);
float getGainOut();
void setGainOut(float gain_out);
float getSquelch();
void setSquelch(float squelch);
float getSquelchGate();
void setSquelchGate(float squelch_gate);
qint32 getSquelchEnabled();
void setSquelchEnabled(qint32 squelch_enabled);
qint32 getAutoRwBalance();
void setAutoRwBalance(qint32 auto_rw_balance);
qint32 getStereoInput();
void setStereoInput(qint32 stereo_input);
qint32 getRgbColor();
void setRgbColor(qint32 rgb_color);
QString* getUdpAddress();
void setUdpAddress(QString* udp_address);
qint32 getUdpPort();
void setUdpPort(qint32 udp_port);
QString* getTitle();
void setTitle(QString* title);
virtual bool isSet() override;
private:
qint32 sample_format;
bool m_sample_format_isSet;
float input_sample_rate;
bool m_input_sample_rate_isSet;
qint64 input_frequency_offset;
bool m_input_frequency_offset_isSet;
float rf_bandwidth;
bool m_rf_bandwidth_isSet;
float low_cutoff;
bool m_low_cutoff_isSet;
qint32 fm_deviation;
bool m_fm_deviation_isSet;
float am_mod_factor;
bool m_am_mod_factor_isSet;
qint32 channel_mute;
bool m_channel_mute_isSet;
float gain_in;
bool m_gain_in_isSet;
float gain_out;
bool m_gain_out_isSet;
float squelch;
bool m_squelch_isSet;
float squelch_gate;
bool m_squelch_gate_isSet;
qint32 squelch_enabled;
bool m_squelch_enabled_isSet;
qint32 auto_rw_balance;
bool m_auto_rw_balance_isSet;
qint32 stereo_input;
bool m_stereo_input_isSet;
qint32 rgb_color;
bool m_rgb_color_isSet;
QString* udp_address;
bool m_udp_address_isSet;
qint32 udp_port;
bool m_udp_port_isSet;
QString* title;
bool m_title_isSet;
};
}
#endif /* SWGUDPSinkSettings_H_ */

View File

@ -204,6 +204,17 @@ def setupChannel(options):
settings["SSBModSettings"]["toneFrequency"] = 600
settings["SSBModSettings"]["bandwidth"] = 1000
settings["SSBModSettings"]["lowCut"] = 300
elif options.channel_id == "UDPSink":
settings["UDPSinkSettings"]["title"] = "Test UDP Sink"
settings["UDPSinkSettings"]["inputFrequencyOffset"] = options.channel_freq
settings["UDPSinkSettings"]["rfBandwidth"] = 12500
settings["UDPSinkSettings"]["fmDeviation"] = 5000
settings["UDPSinkSettings"]["autoRWBalance"] = 0
settings["UDPSinkSettings"]["stereoInput"] = 0
settings["UDPSinkSettings"]["udpAddress"] = "127.0.0.1"
settings["UDPSinkSettings"]["udpPort"] = 9998
settings["UDPSinkSettings"]["inputSampleRate"] = 24000
settings["UDPSinkSettings"]["sampleFormat"] = 1 # FormatNFM
elif options.channel_id == "WFMMod":
settings["WFMModSettings"]["title"] = "Test WFM"
settings["WFMModSettings"]["inputFrequencyOffset"] = options.channel_freq