mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-21 19:09:22 -04:00
Perseus input: implemeted WEB API
This commit is contained in:
parent
4c31da6c17
commit
73a3291008
plugins/samplesource/perseus
sdrbase
resources
webapi
swagger/sdrangel
@ -18,6 +18,8 @@
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGPerseusReport.h"
|
||||
|
||||
#include "dsp/filerecord.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
@ -423,3 +425,112 @@ int PerseusInput::webapiRun(
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PerseusInput::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setPerseusSettings(new SWGSDRangel::SWGPerseusSettings());
|
||||
response.getPerseusSettings()->init();
|
||||
webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PerseusInput::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
PerseusSettings settings = m_settings;
|
||||
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getPerseusSettings()->getCenterFrequency();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("LOppmTenths")) {
|
||||
settings.m_LOppmTenths = response.getPerseusSettings()->getLOppmTenths();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("devSampleRateIndex")) {
|
||||
settings.m_devSampleRateIndex = response.getPerseusSettings()->getDevSampleRateIndex();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("log2Decim")) {
|
||||
settings.m_log2Decim = response.getPerseusSettings()->getLog2Decim();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("adcDither")) {
|
||||
settings.m_adcDither = response.getPerseusSettings()->getAdcDither() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("adcPreamp")) {
|
||||
settings.m_adcPreamp = response.getPerseusSettings()->getAdcPreamp() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("wideBand")) {
|
||||
settings.m_wideBand = response.getPerseusSettings()->getWideBand() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("attenuator")) {
|
||||
int attenuator = response.getPerseusSettings()->getAttenuator();
|
||||
attenuator = attenuator < 0 ? 0 : attenuator > 3 ? 3 : attenuator;
|
||||
settings.m_attenuator = (PerseusSettings::Attenuator) attenuator;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
|
||||
settings.m_transverterDeltaFrequency = response.getPerseusSettings()->getTransverterDeltaFrequency();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("transverterMode")) {
|
||||
settings.m_transverterMode = response.getPerseusSettings()->getTransverterMode() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("fileRecordName")) {
|
||||
settings.m_fileRecordName = *response.getPerseusSettings()->getFileRecordName();
|
||||
}
|
||||
|
||||
MsgConfigurePerseus *msg = MsgConfigurePerseus::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePerseus *msgToGUI = MsgConfigurePerseus::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PerseusInput::webapiReportGet(
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setPerseusReport(new SWGSDRangel::SWGPerseusReport());
|
||||
response.getPerseusReport()->init();
|
||||
webapiFormatDeviceReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void PerseusInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PerseusSettings& settings)
|
||||
{
|
||||
response.getPerseusSettings()->setCenterFrequency(settings.m_centerFrequency);
|
||||
response.getPerseusSettings()->setLOppmTenths(settings.m_LOppmTenths);
|
||||
response.getPerseusSettings()->setDevSampleRateIndex(settings.m_devSampleRateIndex);
|
||||
response.getPerseusSettings()->setLog2Decim(settings.m_log2Decim);
|
||||
response.getPerseusSettings()->setAdcDither(settings.m_adcDither ? 1 : 0);
|
||||
response.getPerseusSettings()->setAdcPreamp(settings.m_adcPreamp ? 1 : 0);
|
||||
response.getPerseusSettings()->setWideBand(settings.m_wideBand ? 1 : 0);
|
||||
response.getPerseusSettings()->setAttenuator((int) settings.m_attenuator);
|
||||
response.getPerseusSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
|
||||
response.getPerseusSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
|
||||
|
||||
if (response.getPerseusSettings()->getFileRecordName()) {
|
||||
*response.getPerseusSettings()->getFileRecordName() = settings.m_fileRecordName;
|
||||
} else {
|
||||
response.getPerseusSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
}
|
||||
|
||||
void PerseusInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
||||
{
|
||||
response.getPerseusReport()->setSampleRates(new QList<SWGSDRangel::SWGAirspyReport_sampleRates*>);
|
||||
|
||||
for (std::vector<uint32_t>::const_iterator it = getSampleRates().begin(); it != getSampleRates().end(); ++it)
|
||||
{
|
||||
response.getPerseusReport()->getSampleRates()->append(new SWGSDRangel::SWGAirspyReport_sampleRates);
|
||||
response.getPerseusReport()->getSampleRates()->back()->setSampleRate(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,6 +110,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);
|
||||
@ -135,6 +149,8 @@ private:
|
||||
void closeDevice();
|
||||
void setDeviceCenterFrequency(quint64 freq, const PerseusSettings& settings);
|
||||
bool applySettings(const PerseusSettings& settings, bool force = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PerseusSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSINPUT_H_ */
|
||||
|
@ -2,26 +2,29 @@
|
||||
<qresource prefix="/">
|
||||
<file>webapi/doc/html2/index.html</file>
|
||||
<file>webapi/doc/swagger/swagger.yaml</file>
|
||||
<file>webapi/doc/swagger/include/CWKeyer.yaml</file>
|
||||
<file>webapi/doc/swagger/include/Airspy.yaml</file>
|
||||
<file>webapi/doc/swagger/include/AirspyHF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/BladeRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/FileSource.yaml</file>
|
||||
<file>webapi/doc/swagger/include/HackRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/LimeSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/AMDemod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/AMMod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/ATVMod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/BFMDemod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/BladeRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/CWKeyer.yaml</file>
|
||||
<file>webapi/doc/swagger/include/DSDDemod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/FCDPro.yaml</file>
|
||||
<file>webapi/doc/swagger/include/FCDProPlus.yaml</file>
|
||||
<file>webapi/doc/swagger/include/FileSource.yaml</file>
|
||||
<file>webapi/doc/swagger/include/HackRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/LimeSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/NFMDemod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/NFMMod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/Perseus.yaml</file>
|
||||
<file>webapi/doc/swagger/include/RtlSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/SSBMod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/UDPSink.yaml</file>
|
||||
<file>webapi/doc/swagger/include/UDPSrc.yaml</file>
|
||||
<file>webapi/doc/swagger/include/WFMDemod.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>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui.js</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui.css.map</file>
|
||||
|
@ -1714,6 +1714,9 @@ margin-bottom: 20px;
|
||||
},
|
||||
"fileSourceReport" : {
|
||||
"$ref" : "#/definitions/FileSourceReport"
|
||||
},
|
||||
"perseusReport" : {
|
||||
"$ref" : "#/definitions/PerseusReport"
|
||||
}
|
||||
},
|
||||
"description" : "Base device report. The specific device report present depeds on deviceHwType"
|
||||
@ -1803,6 +1806,9 @@ margin-bottom: 20px;
|
||||
"limeSdrOutputSettings" : {
|
||||
"$ref" : "#/definitions/LimeSdrOutputSettings"
|
||||
},
|
||||
"perseusSettings" : {
|
||||
"$ref" : "#/definitions/PerseusSettings"
|
||||
},
|
||||
"rtlSdrSettings" : {
|
||||
"$ref" : "#/definitions/RtlSdrSettings"
|
||||
}
|
||||
@ -2463,6 +2469,61 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "NFMMod"
|
||||
};
|
||||
defs.PerseusReport = {
|
||||
"properties" : {
|
||||
"sampleRates" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"$ref" : "#/definitions/AirspyReport_sampleRates"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Perseus"
|
||||
};
|
||||
defs.PerseusSettings = {
|
||||
"properties" : {
|
||||
"centerFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"LOppmTenths" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"devSampleRateIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"log2Decim" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"adcDither" : {
|
||||
"type" : "integer",
|
||||
"description" : "ADC dithering (1 if active else 0)"
|
||||
},
|
||||
"adcPreamp" : {
|
||||
"type" : "integer",
|
||||
"description" : "ADC preamplifier (1 if active else 0)"
|
||||
},
|
||||
"wideBand" : {
|
||||
"type" : "integer",
|
||||
"description" : "Wideband mode i.e. bypass automatic RF filter (1 if active else 0)"
|
||||
},
|
||||
"transverterMode" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"transverterDeltaFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"fileRecordName" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"attenuator" : {
|
||||
"type" : "integer",
|
||||
"description" : "Attenuator setting in Bels (0, 10, 20 30 dB)"
|
||||
}
|
||||
},
|
||||
"description" : "Perseus"
|
||||
};
|
||||
defs.PresetExport = {
|
||||
"properties" : {
|
||||
@ -21861,7 +21922,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-05-26T11:35:33.686+02:00
|
||||
Generated 2018-05-26T12:32:33.813+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
44
sdrbase/resources/webapi/doc/swagger/include/Perseus.yaml
Normal file
44
sdrbase/resources/webapi/doc/swagger/include/Perseus.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
PerseusSettings:
|
||||
description: Perseus
|
||||
properties:
|
||||
centerFrequency:
|
||||
type: integer
|
||||
format: int64
|
||||
LOppmTenths:
|
||||
type: integer
|
||||
devSampleRateIndex:
|
||||
type: integer
|
||||
log2Decim:
|
||||
type: integer
|
||||
adcDither:
|
||||
description: ADC dithering (1 if active else 0)
|
||||
type: integer
|
||||
adcPreamp:
|
||||
description: ADC preamplifier (1 if active else 0)
|
||||
type: integer
|
||||
wideBand:
|
||||
description: Wideband mode i.e. bypass automatic RF filter (1 if active else 0)
|
||||
type: integer
|
||||
transverterMode:
|
||||
type: integer
|
||||
transverterDeltaFrequency:
|
||||
type: integer
|
||||
format: int64
|
||||
fileRecordName:
|
||||
type: string
|
||||
attenuator:
|
||||
description: Attenuator setting in Bels (0, 10, 20 30 dB)
|
||||
type: integer
|
||||
|
||||
PerseusReport:
|
||||
description: Perseus
|
||||
properties:
|
||||
sampleRates:
|
||||
type: array
|
||||
items:
|
||||
properties:
|
||||
sampleRate:
|
||||
description: sample rate in S/s
|
||||
type: integer
|
||||
|
||||
|
@ -1767,6 +1767,8 @@ definitions:
|
||||
$ref: "/doc/swagger/include/LimeSdr.yaml#/LimeSdrInputSettings"
|
||||
limeSdrOutputSettings:
|
||||
$ref: "/doc/swagger/include/LimeSdr.yaml#/LimeSdrOutputSettings"
|
||||
perseusSettings:
|
||||
$ref: "/doc/swagger/include/Perseus.yaml#/PerseusSettings"
|
||||
rtlSdrSettings:
|
||||
$ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
|
||||
|
||||
@ -1789,6 +1791,8 @@ definitions:
|
||||
$ref: "/doc/swagger/include/AirspyHF.yaml#/AirspyHFReport"
|
||||
fileSourceReport:
|
||||
$ref: "/doc/swagger/include/FileSource.yaml#/FileSourceReport"
|
||||
perseusReport:
|
||||
$ref: "/doc/swagger/include/Perseus.yaml#/PerseusReport"
|
||||
|
||||
ChannelSettings:
|
||||
description: Base channel settings. The specific channel settings present depends on channelType.
|
||||
|
@ -1706,22 +1706,7 @@ bool WebAPIRequestMapper::validateDeviceSettings(
|
||||
|
||||
QString *deviceHwType = deviceSettings.getDeviceHwType();
|
||||
|
||||
if (*deviceHwType == "FileSource")
|
||||
{
|
||||
if (jsonObject.contains("fileSourceSettings") && jsonObject["fileSourceSettings"].isObject())
|
||||
{
|
||||
QJsonObject fileSourceSettingsJsonObject = jsonObject["fileSourceSettings"].toObject();
|
||||
deviceSettingsKeys = fileSourceSettingsJsonObject.keys();
|
||||
deviceSettings.setFileSourceSettings(new SWGSDRangel::SWGFileSourceSettings());
|
||||
deviceSettings.getFileSourceSettings()->fromJsonObject(fileSourceSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ((*deviceHwType == "Airspy") && (deviceSettings.getTx() == 0))
|
||||
if ((*deviceHwType == "Airspy") && (deviceSettings.getTx() == 0))
|
||||
{
|
||||
if (jsonObject.contains("airspySettings") && jsonObject["airspySettings"].isObject())
|
||||
{
|
||||
@ -1781,6 +1766,51 @@ bool WebAPIRequestMapper::validateDeviceSettings(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*deviceHwType == "FCDPro")
|
||||
{
|
||||
if (jsonObject.contains("fcdProSettings") && jsonObject["fcdProSettings"].isObject())
|
||||
{
|
||||
QJsonObject fcdProSettingsJsonObject = jsonObject["fcdProSettings"].toObject();
|
||||
deviceSettingsKeys = fcdProSettingsJsonObject.keys();
|
||||
deviceSettings.setFcdProSettings(new SWGSDRangel::SWGFCDProSettings());
|
||||
deviceSettings.getFcdProSettings()->fromJsonObject(fcdProSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*deviceHwType == "FCDProPlus")
|
||||
{
|
||||
if (jsonObject.contains("fcdProPlusSettings") && jsonObject["fcdProPlusSettings"].isObject())
|
||||
{
|
||||
QJsonObject fcdProPlusSettingsJsonObject = jsonObject["fcdProPlusSettings"].toObject();
|
||||
deviceSettingsKeys = fcdProPlusSettingsJsonObject.keys();
|
||||
deviceSettings.setFcdProPlusSettings(new SWGSDRangel::SWGFCDProPlusSettings());
|
||||
deviceSettings.getFcdProPlusSettings()->fromJsonObject(fcdProPlusSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*deviceHwType == "FileSource")
|
||||
{
|
||||
if (jsonObject.contains("fileSourceSettings") && jsonObject["fileSourceSettings"].isObject())
|
||||
{
|
||||
QJsonObject fileSourceSettingsJsonObject = jsonObject["fileSourceSettings"].toObject();
|
||||
deviceSettingsKeys = fileSourceSettingsJsonObject.keys();
|
||||
deviceSettings.setFileSourceSettings(new SWGSDRangel::SWGFileSourceSettings());
|
||||
deviceSettings.getFileSourceSettings()->fromJsonObject(fileSourceSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ((*deviceHwType == "HackRF") && (deviceSettings.getTx() == 0))
|
||||
{
|
||||
if (jsonObject.contains("hackRFInputSettings") && jsonObject["hackRFInputSettings"].isObject())
|
||||
@ -1841,6 +1871,21 @@ bool WebAPIRequestMapper::validateDeviceSettings(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*deviceHwType == "Perseus")
|
||||
{
|
||||
if (jsonObject.contains("perseusSettings") && jsonObject["perseusSettings"].isObject())
|
||||
{
|
||||
QJsonObject perseusSettingsJsonObject = jsonObject["perseusSettings"].toObject();
|
||||
deviceSettingsKeys = perseusSettingsJsonObject.keys();
|
||||
deviceSettings.setPerseusSettings(new SWGSDRangel::SWGPerseusSettings());
|
||||
deviceSettings.getPerseusSettings()->fromJsonObject(perseusSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*deviceHwType == "RTLSDR")
|
||||
{
|
||||
if (jsonObject.contains("rtlSdrSettings") && jsonObject["rtlSdrSettings"].isObject())
|
||||
|
44
swagger/sdrangel/api/swagger/include/Perseus.yaml
Normal file
44
swagger/sdrangel/api/swagger/include/Perseus.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
PerseusSettings:
|
||||
description: Perseus
|
||||
properties:
|
||||
centerFrequency:
|
||||
type: integer
|
||||
format: int64
|
||||
LOppmTenths:
|
||||
type: integer
|
||||
devSampleRateIndex:
|
||||
type: integer
|
||||
log2Decim:
|
||||
type: integer
|
||||
adcDither:
|
||||
description: ADC dithering (1 if active else 0)
|
||||
type: integer
|
||||
adcPreamp:
|
||||
description: ADC preamplifier (1 if active else 0)
|
||||
type: integer
|
||||
wideBand:
|
||||
description: Wideband mode i.e. bypass automatic RF filter (1 if active else 0)
|
||||
type: integer
|
||||
transverterMode:
|
||||
type: integer
|
||||
transverterDeltaFrequency:
|
||||
type: integer
|
||||
format: int64
|
||||
fileRecordName:
|
||||
type: string
|
||||
attenuator:
|
||||
description: Attenuator setting in Bels (0, 10, 20 30 dB)
|
||||
type: integer
|
||||
|
||||
PerseusReport:
|
||||
description: Perseus
|
||||
properties:
|
||||
sampleRates:
|
||||
type: array
|
||||
items:
|
||||
properties:
|
||||
sampleRate:
|
||||
description: sample rate in S/s
|
||||
type: integer
|
||||
|
||||
|
@ -1767,6 +1767,8 @@ definitions:
|
||||
$ref: "http://localhost:8081/api/swagger/include/LimeSdr.yaml#/LimeSdrInputSettings"
|
||||
limeSdrOutputSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/LimeSdr.yaml#/LimeSdrOutputSettings"
|
||||
perseusSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Perseus.yaml#/PerseusSettings"
|
||||
rtlSdrSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
|
||||
|
||||
@ -1789,6 +1791,8 @@ definitions:
|
||||
$ref: "http://localhost:8081/api/swagger/include/AirspyHF.yaml#/AirspyHFReport"
|
||||
fileSourceReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/FileSource.yaml#/FileSourceReport"
|
||||
perseusReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Perseus.yaml#/PerseusReport"
|
||||
|
||||
ChannelSettings:
|
||||
description: Base channel settings. The specific channel settings present depends on channelType.
|
||||
|
@ -1714,6 +1714,9 @@ margin-bottom: 20px;
|
||||
},
|
||||
"fileSourceReport" : {
|
||||
"$ref" : "#/definitions/FileSourceReport"
|
||||
},
|
||||
"perseusReport" : {
|
||||
"$ref" : "#/definitions/PerseusReport"
|
||||
}
|
||||
},
|
||||
"description" : "Base device report. The specific device report present depeds on deviceHwType"
|
||||
@ -1803,6 +1806,9 @@ margin-bottom: 20px;
|
||||
"limeSdrOutputSettings" : {
|
||||
"$ref" : "#/definitions/LimeSdrOutputSettings"
|
||||
},
|
||||
"perseusSettings" : {
|
||||
"$ref" : "#/definitions/PerseusSettings"
|
||||
},
|
||||
"rtlSdrSettings" : {
|
||||
"$ref" : "#/definitions/RtlSdrSettings"
|
||||
}
|
||||
@ -2463,6 +2469,61 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "NFMMod"
|
||||
};
|
||||
defs.PerseusReport = {
|
||||
"properties" : {
|
||||
"sampleRates" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"$ref" : "#/definitions/AirspyReport_sampleRates"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Perseus"
|
||||
};
|
||||
defs.PerseusSettings = {
|
||||
"properties" : {
|
||||
"centerFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"LOppmTenths" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"devSampleRateIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"log2Decim" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"adcDither" : {
|
||||
"type" : "integer",
|
||||
"description" : "ADC dithering (1 if active else 0)"
|
||||
},
|
||||
"adcPreamp" : {
|
||||
"type" : "integer",
|
||||
"description" : "ADC preamplifier (1 if active else 0)"
|
||||
},
|
||||
"wideBand" : {
|
||||
"type" : "integer",
|
||||
"description" : "Wideband mode i.e. bypass automatic RF filter (1 if active else 0)"
|
||||
},
|
||||
"transverterMode" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"transverterDeltaFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"fileRecordName" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"attenuator" : {
|
||||
"type" : "integer",
|
||||
"description" : "Attenuator setting in Bels (0, 10, 20 30 dB)"
|
||||
}
|
||||
},
|
||||
"description" : "Perseus"
|
||||
};
|
||||
defs.PresetExport = {
|
||||
"properties" : {
|
||||
@ -21861,7 +21922,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-05-26T11:35:33.686+02:00
|
||||
Generated 2018-05-26T12:32:33.813+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -38,6 +38,8 @@ SWGDeviceReport::SWGDeviceReport() {
|
||||
m_airspy_hf_report_isSet = false;
|
||||
file_source_report = nullptr;
|
||||
m_file_source_report_isSet = false;
|
||||
perseus_report = nullptr;
|
||||
m_perseus_report_isSet = false;
|
||||
}
|
||||
|
||||
SWGDeviceReport::~SWGDeviceReport() {
|
||||
@ -56,6 +58,8 @@ SWGDeviceReport::init() {
|
||||
m_airspy_hf_report_isSet = false;
|
||||
file_source_report = new SWGFileSourceReport();
|
||||
m_file_source_report_isSet = false;
|
||||
perseus_report = new SWGPerseusReport();
|
||||
m_perseus_report_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -73,6 +77,9 @@ SWGDeviceReport::cleanup() {
|
||||
if(file_source_report != nullptr) {
|
||||
delete file_source_report;
|
||||
}
|
||||
if(perseus_report != nullptr) {
|
||||
delete perseus_report;
|
||||
}
|
||||
}
|
||||
|
||||
SWGDeviceReport*
|
||||
@ -96,6 +103,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&file_source_report, pJson["fileSourceReport"], "SWGFileSourceReport", "SWGFileSourceReport");
|
||||
|
||||
::SWGSDRangel::setValue(&perseus_report, pJson["perseusReport"], "SWGPerseusReport", "SWGPerseusReport");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -127,6 +136,9 @@ SWGDeviceReport::asJsonObject() {
|
||||
if((file_source_report != nullptr) && (file_source_report->isSet())){
|
||||
toJsonValue(QString("fileSourceReport"), file_source_report, obj, QString("SWGFileSourceReport"));
|
||||
}
|
||||
if((perseus_report != nullptr) && (perseus_report->isSet())){
|
||||
toJsonValue(QString("perseusReport"), perseus_report, obj, QString("SWGPerseusReport"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -181,6 +193,16 @@ SWGDeviceReport::setFileSourceReport(SWGFileSourceReport* file_source_report) {
|
||||
this->m_file_source_report_isSet = true;
|
||||
}
|
||||
|
||||
SWGPerseusReport*
|
||||
SWGDeviceReport::getPerseusReport() {
|
||||
return perseus_report;
|
||||
}
|
||||
void
|
||||
SWGDeviceReport::setPerseusReport(SWGPerseusReport* perseus_report) {
|
||||
this->perseus_report = perseus_report;
|
||||
this->m_perseus_report_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGDeviceReport::isSet(){
|
||||
@ -191,6 +213,7 @@ SWGDeviceReport::isSet(){
|
||||
if(airspy_report != nullptr && airspy_report->isSet()){ isObjectUpdated = true; break;}
|
||||
if(airspy_hf_report != nullptr && airspy_hf_report->isSet()){ isObjectUpdated = true; break;}
|
||||
if(file_source_report != nullptr && file_source_report->isSet()){ isObjectUpdated = true; break;}
|
||||
if(perseus_report != nullptr && perseus_report->isSet()){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "SWGAirspyHFReport.h"
|
||||
#include "SWGAirspyReport.h"
|
||||
#include "SWGFileSourceReport.h"
|
||||
#include "SWGPerseusReport.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
@ -60,6 +61,9 @@ public:
|
||||
SWGFileSourceReport* getFileSourceReport();
|
||||
void setFileSourceReport(SWGFileSourceReport* file_source_report);
|
||||
|
||||
SWGPerseusReport* getPerseusReport();
|
||||
void setPerseusReport(SWGPerseusReport* perseus_report);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -79,6 +83,9 @@ private:
|
||||
SWGFileSourceReport* file_source_report;
|
||||
bool m_file_source_report_isSet;
|
||||
|
||||
SWGPerseusReport* perseus_report;
|
||||
bool m_perseus_report_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ SWGDeviceSettings::SWGDeviceSettings() {
|
||||
m_lime_sdr_input_settings_isSet = false;
|
||||
lime_sdr_output_settings = nullptr;
|
||||
m_lime_sdr_output_settings_isSet = false;
|
||||
perseus_settings = nullptr;
|
||||
m_perseus_settings_isSet = false;
|
||||
rtl_sdr_settings = nullptr;
|
||||
m_rtl_sdr_settings_isSet = false;
|
||||
}
|
||||
@ -90,6 +92,8 @@ SWGDeviceSettings::init() {
|
||||
m_lime_sdr_input_settings_isSet = false;
|
||||
lime_sdr_output_settings = new SWGLimeSdrOutputSettings();
|
||||
m_lime_sdr_output_settings_isSet = false;
|
||||
perseus_settings = new SWGPerseusSettings();
|
||||
m_perseus_settings_isSet = false;
|
||||
rtl_sdr_settings = new SWGRtlSdrSettings();
|
||||
m_rtl_sdr_settings_isSet = false;
|
||||
}
|
||||
@ -133,6 +137,9 @@ SWGDeviceSettings::cleanup() {
|
||||
if(lime_sdr_output_settings != nullptr) {
|
||||
delete lime_sdr_output_settings;
|
||||
}
|
||||
if(perseus_settings != nullptr) {
|
||||
delete perseus_settings;
|
||||
}
|
||||
if(rtl_sdr_settings != nullptr) {
|
||||
delete rtl_sdr_settings;
|
||||
}
|
||||
@ -175,6 +182,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&lime_sdr_output_settings, pJson["limeSdrOutputSettings"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&perseus_settings, pJson["perseusSettings"], "SWGPerseusSettings", "SWGPerseusSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&rtl_sdr_settings, pJson["rtlSdrSettings"], "SWGRtlSdrSettings", "SWGRtlSdrSettings");
|
||||
|
||||
}
|
||||
@ -232,6 +241,9 @@ SWGDeviceSettings::asJsonObject() {
|
||||
if((lime_sdr_output_settings != nullptr) && (lime_sdr_output_settings->isSet())){
|
||||
toJsonValue(QString("limeSdrOutputSettings"), lime_sdr_output_settings, obj, QString("SWGLimeSdrOutputSettings"));
|
||||
}
|
||||
if((perseus_settings != nullptr) && (perseus_settings->isSet())){
|
||||
toJsonValue(QString("perseusSettings"), perseus_settings, obj, QString("SWGPerseusSettings"));
|
||||
}
|
||||
if((rtl_sdr_settings != nullptr) && (rtl_sdr_settings->isSet())){
|
||||
toJsonValue(QString("rtlSdrSettings"), rtl_sdr_settings, obj, QString("SWGRtlSdrSettings"));
|
||||
}
|
||||
@ -369,6 +381,16 @@ SWGDeviceSettings::setLimeSdrOutputSettings(SWGLimeSdrOutputSettings* lime_sdr_o
|
||||
this->m_lime_sdr_output_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGPerseusSettings*
|
||||
SWGDeviceSettings::getPerseusSettings() {
|
||||
return perseus_settings;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setPerseusSettings(SWGPerseusSettings* perseus_settings) {
|
||||
this->perseus_settings = perseus_settings;
|
||||
this->m_perseus_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGRtlSdrSettings*
|
||||
SWGDeviceSettings::getRtlSdrSettings() {
|
||||
return rtl_sdr_settings;
|
||||
@ -397,6 +419,7 @@ SWGDeviceSettings::isSet(){
|
||||
if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(lime_sdr_input_settings != nullptr && lime_sdr_input_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(lime_sdr_output_settings != nullptr && lime_sdr_output_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(perseus_settings != nullptr && perseus_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(rtl_sdr_settings != nullptr && rtl_sdr_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "SWGHackRFOutputSettings.h"
|
||||
#include "SWGLimeSdrInputSettings.h"
|
||||
#include "SWGLimeSdrOutputSettings.h"
|
||||
#include "SWGPerseusSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include <QString>
|
||||
|
||||
@ -93,6 +94,9 @@ public:
|
||||
SWGLimeSdrOutputSettings* getLimeSdrOutputSettings();
|
||||
void setLimeSdrOutputSettings(SWGLimeSdrOutputSettings* lime_sdr_output_settings);
|
||||
|
||||
SWGPerseusSettings* getPerseusSettings();
|
||||
void setPerseusSettings(SWGPerseusSettings* perseus_settings);
|
||||
|
||||
SWGRtlSdrSettings* getRtlSdrSettings();
|
||||
void setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings);
|
||||
|
||||
@ -139,6 +143,9 @@ private:
|
||||
SWGLimeSdrOutputSettings* lime_sdr_output_settings;
|
||||
bool m_lime_sdr_output_settings_isSet;
|
||||
|
||||
SWGPerseusSettings* perseus_settings;
|
||||
bool m_perseus_settings_isSet;
|
||||
|
||||
SWGRtlSdrSettings* rtl_sdr_settings;
|
||||
bool m_rtl_sdr_settings_isSet;
|
||||
|
||||
|
@ -66,6 +66,8 @@
|
||||
#include "SWGNFMDemodSettings.h"
|
||||
#include "SWGNFMModReport.h"
|
||||
#include "SWGNFMModSettings.h"
|
||||
#include "SWGPerseusReport.h"
|
||||
#include "SWGPerseusSettings.h"
|
||||
#include "SWGPresetExport.h"
|
||||
#include "SWGPresetGroup.h"
|
||||
#include "SWGPresetIdentifier.h"
|
||||
@ -248,6 +250,12 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGNFMModSettings").compare(type) == 0) {
|
||||
return new SWGNFMModSettings();
|
||||
}
|
||||
if(QString("SWGPerseusReport").compare(type) == 0) {
|
||||
return new SWGPerseusReport();
|
||||
}
|
||||
if(QString("SWGPerseusSettings").compare(type) == 0) {
|
||||
return new SWGPerseusSettings();
|
||||
}
|
||||
if(QString("SWGPresetExport").compare(type) == 0) {
|
||||
return new SWGPresetExport();
|
||||
}
|
||||
|
112
swagger/sdrangel/code/qt5/client/SWGPerseusReport.cpp
Normal file
112
swagger/sdrangel/code/qt5/client/SWGPerseusReport.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* 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 "SWGPerseusReport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGPerseusReport::SWGPerseusReport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGPerseusReport::SWGPerseusReport() {
|
||||
sample_rates = nullptr;
|
||||
m_sample_rates_isSet = false;
|
||||
}
|
||||
|
||||
SWGPerseusReport::~SWGPerseusReport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGPerseusReport::init() {
|
||||
sample_rates = new QList<SWGAirspyReport_sampleRates*>();
|
||||
m_sample_rates_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGPerseusReport::cleanup() {
|
||||
if(sample_rates != nullptr) {
|
||||
auto arr = sample_rates;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete sample_rates;
|
||||
}
|
||||
}
|
||||
|
||||
SWGPerseusReport*
|
||||
SWGPerseusReport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGPerseusReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&sample_rates, pJson["sampleRates"], "QList", "SWGAirspyReport_sampleRates");
|
||||
}
|
||||
|
||||
QString
|
||||
SWGPerseusReport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGPerseusReport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(sample_rates->size() > 0){
|
||||
toJsonArray((QList<void*>*)sample_rates, obj, "sampleRates", "SWGAirspyReport_sampleRates");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QList<SWGAirspyReport_sampleRates*>*
|
||||
SWGPerseusReport::getSampleRates() {
|
||||
return sample_rates;
|
||||
}
|
||||
void
|
||||
SWGPerseusReport::setSampleRates(QList<SWGAirspyReport_sampleRates*>* sample_rates) {
|
||||
this->sample_rates = sample_rates;
|
||||
this->m_sample_rates_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGPerseusReport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(sample_rates->size() > 0){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
60
swagger/sdrangel/code/qt5/client/SWGPerseusReport.h
Normal file
60
swagger/sdrangel/code/qt5/client/SWGPerseusReport.h
Normal file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGPerseusReport.h
|
||||
*
|
||||
* Perseus
|
||||
*/
|
||||
|
||||
#ifndef SWGPerseusReport_H_
|
||||
#define SWGPerseusReport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGAirspyReport_sampleRates.h"
|
||||
#include <QList>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGPerseusReport: public SWGObject {
|
||||
public:
|
||||
SWGPerseusReport();
|
||||
SWGPerseusReport(QString* json);
|
||||
virtual ~SWGPerseusReport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGPerseusReport* fromJson(QString &jsonString) override;
|
||||
|
||||
QList<SWGAirspyReport_sampleRates*>* getSampleRates();
|
||||
void setSampleRates(QList<SWGAirspyReport_sampleRates*>* sample_rates);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QList<SWGAirspyReport_sampleRates*>* sample_rates;
|
||||
bool m_sample_rates_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGPerseusReport_H_ */
|
318
swagger/sdrangel/code/qt5/client/SWGPerseusSettings.cpp
Normal file
318
swagger/sdrangel/code/qt5/client/SWGPerseusSettings.cpp
Normal file
@ -0,0 +1,318 @@
|
||||
/**
|
||||
* 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 "SWGPerseusSettings.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGPerseusSettings::SWGPerseusSettings(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGPerseusSettings::SWGPerseusSettings() {
|
||||
center_frequency = 0L;
|
||||
m_center_frequency_isSet = false;
|
||||
l_oppm_tenths = 0;
|
||||
m_l_oppm_tenths_isSet = false;
|
||||
dev_sample_rate_index = 0;
|
||||
m_dev_sample_rate_index_isSet = false;
|
||||
log2_decim = 0;
|
||||
m_log2_decim_isSet = false;
|
||||
adc_dither = 0;
|
||||
m_adc_dither_isSet = false;
|
||||
adc_preamp = 0;
|
||||
m_adc_preamp_isSet = false;
|
||||
wide_band = 0;
|
||||
m_wide_band_isSet = false;
|
||||
transverter_mode = 0;
|
||||
m_transverter_mode_isSet = false;
|
||||
transverter_delta_frequency = 0L;
|
||||
m_transverter_delta_frequency_isSet = false;
|
||||
file_record_name = nullptr;
|
||||
m_file_record_name_isSet = false;
|
||||
attenuator = 0;
|
||||
m_attenuator_isSet = false;
|
||||
}
|
||||
|
||||
SWGPerseusSettings::~SWGPerseusSettings() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGPerseusSettings::init() {
|
||||
center_frequency = 0L;
|
||||
m_center_frequency_isSet = false;
|
||||
l_oppm_tenths = 0;
|
||||
m_l_oppm_tenths_isSet = false;
|
||||
dev_sample_rate_index = 0;
|
||||
m_dev_sample_rate_index_isSet = false;
|
||||
log2_decim = 0;
|
||||
m_log2_decim_isSet = false;
|
||||
adc_dither = 0;
|
||||
m_adc_dither_isSet = false;
|
||||
adc_preamp = 0;
|
||||
m_adc_preamp_isSet = false;
|
||||
wide_band = 0;
|
||||
m_wide_band_isSet = false;
|
||||
transverter_mode = 0;
|
||||
m_transverter_mode_isSet = false;
|
||||
transverter_delta_frequency = 0L;
|
||||
m_transverter_delta_frequency_isSet = false;
|
||||
file_record_name = new QString("");
|
||||
m_file_record_name_isSet = false;
|
||||
attenuator = 0;
|
||||
m_attenuator_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGPerseusSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(file_record_name != nullptr) {
|
||||
delete file_record_name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWGPerseusSettings*
|
||||
SWGPerseusSettings::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGPerseusSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&dev_sample_rate_index, pJson["devSampleRateIndex"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&adc_dither, pJson["adcDither"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&adc_preamp, pJson["adcPreamp"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&wide_band, pJson["wideBand"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&attenuator, pJson["attenuator"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGPerseusSettings::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGPerseusSettings::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_center_frequency_isSet){
|
||||
obj->insert("centerFrequency", QJsonValue(center_frequency));
|
||||
}
|
||||
if(m_l_oppm_tenths_isSet){
|
||||
obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
|
||||
}
|
||||
if(m_dev_sample_rate_index_isSet){
|
||||
obj->insert("devSampleRateIndex", QJsonValue(dev_sample_rate_index));
|
||||
}
|
||||
if(m_log2_decim_isSet){
|
||||
obj->insert("log2Decim", QJsonValue(log2_decim));
|
||||
}
|
||||
if(m_adc_dither_isSet){
|
||||
obj->insert("adcDither", QJsonValue(adc_dither));
|
||||
}
|
||||
if(m_adc_preamp_isSet){
|
||||
obj->insert("adcPreamp", QJsonValue(adc_preamp));
|
||||
}
|
||||
if(m_wide_band_isSet){
|
||||
obj->insert("wideBand", QJsonValue(wide_band));
|
||||
}
|
||||
if(m_transverter_mode_isSet){
|
||||
obj->insert("transverterMode", QJsonValue(transverter_mode));
|
||||
}
|
||||
if(m_transverter_delta_frequency_isSet){
|
||||
obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
|
||||
}
|
||||
if(file_record_name != nullptr && *file_record_name != QString("")){
|
||||
toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
|
||||
}
|
||||
if(m_attenuator_isSet){
|
||||
obj->insert("attenuator", QJsonValue(attenuator));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGPerseusSettings::getCenterFrequency() {
|
||||
return center_frequency;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setCenterFrequency(qint64 center_frequency) {
|
||||
this->center_frequency = center_frequency;
|
||||
this->m_center_frequency_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getLOppmTenths() {
|
||||
return l_oppm_tenths;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setLOppmTenths(qint32 l_oppm_tenths) {
|
||||
this->l_oppm_tenths = l_oppm_tenths;
|
||||
this->m_l_oppm_tenths_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getDevSampleRateIndex() {
|
||||
return dev_sample_rate_index;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setDevSampleRateIndex(qint32 dev_sample_rate_index) {
|
||||
this->dev_sample_rate_index = dev_sample_rate_index;
|
||||
this->m_dev_sample_rate_index_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getLog2Decim() {
|
||||
return log2_decim;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setLog2Decim(qint32 log2_decim) {
|
||||
this->log2_decim = log2_decim;
|
||||
this->m_log2_decim_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getAdcDither() {
|
||||
return adc_dither;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setAdcDither(qint32 adc_dither) {
|
||||
this->adc_dither = adc_dither;
|
||||
this->m_adc_dither_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getAdcPreamp() {
|
||||
return adc_preamp;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setAdcPreamp(qint32 adc_preamp) {
|
||||
this->adc_preamp = adc_preamp;
|
||||
this->m_adc_preamp_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getWideBand() {
|
||||
return wide_band;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setWideBand(qint32 wide_band) {
|
||||
this->wide_band = wide_band;
|
||||
this->m_wide_band_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getTransverterMode() {
|
||||
return transverter_mode;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setTransverterMode(qint32 transverter_mode) {
|
||||
this->transverter_mode = transverter_mode;
|
||||
this->m_transverter_mode_isSet = true;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGPerseusSettings::getTransverterDeltaFrequency() {
|
||||
return transverter_delta_frequency;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) {
|
||||
this->transverter_delta_frequency = transverter_delta_frequency;
|
||||
this->m_transverter_delta_frequency_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGPerseusSettings::getFileRecordName() {
|
||||
return file_record_name;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setFileRecordName(QString* file_record_name) {
|
||||
this->file_record_name = file_record_name;
|
||||
this->m_file_record_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPerseusSettings::getAttenuator() {
|
||||
return attenuator;
|
||||
}
|
||||
void
|
||||
SWGPerseusSettings::setAttenuator(qint32 attenuator) {
|
||||
this->attenuator = attenuator;
|
||||
this->m_attenuator_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGPerseusSettings::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_dev_sample_rate_index_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_adc_dither_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_adc_preamp_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_wide_band_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
|
||||
if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_attenuator_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
119
swagger/sdrangel/code/qt5/client/SWGPerseusSettings.h
Normal file
119
swagger/sdrangel/code/qt5/client/SWGPerseusSettings.h
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGPerseusSettings.h
|
||||
*
|
||||
* Perseus
|
||||
*/
|
||||
|
||||
#ifndef SWGPerseusSettings_H_
|
||||
#define SWGPerseusSettings_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGPerseusSettings: public SWGObject {
|
||||
public:
|
||||
SWGPerseusSettings();
|
||||
SWGPerseusSettings(QString* json);
|
||||
virtual ~SWGPerseusSettings();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGPerseusSettings* fromJson(QString &jsonString) override;
|
||||
|
||||
qint64 getCenterFrequency();
|
||||
void setCenterFrequency(qint64 center_frequency);
|
||||
|
||||
qint32 getLOppmTenths();
|
||||
void setLOppmTenths(qint32 l_oppm_tenths);
|
||||
|
||||
qint32 getDevSampleRateIndex();
|
||||
void setDevSampleRateIndex(qint32 dev_sample_rate_index);
|
||||
|
||||
qint32 getLog2Decim();
|
||||
void setLog2Decim(qint32 log2_decim);
|
||||
|
||||
qint32 getAdcDither();
|
||||
void setAdcDither(qint32 adc_dither);
|
||||
|
||||
qint32 getAdcPreamp();
|
||||
void setAdcPreamp(qint32 adc_preamp);
|
||||
|
||||
qint32 getWideBand();
|
||||
void setWideBand(qint32 wide_band);
|
||||
|
||||
qint32 getTransverterMode();
|
||||
void setTransverterMode(qint32 transverter_mode);
|
||||
|
||||
qint64 getTransverterDeltaFrequency();
|
||||
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency);
|
||||
|
||||
QString* getFileRecordName();
|
||||
void setFileRecordName(QString* file_record_name);
|
||||
|
||||
qint32 getAttenuator();
|
||||
void setAttenuator(qint32 attenuator);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
qint64 center_frequency;
|
||||
bool m_center_frequency_isSet;
|
||||
|
||||
qint32 l_oppm_tenths;
|
||||
bool m_l_oppm_tenths_isSet;
|
||||
|
||||
qint32 dev_sample_rate_index;
|
||||
bool m_dev_sample_rate_index_isSet;
|
||||
|
||||
qint32 log2_decim;
|
||||
bool m_log2_decim_isSet;
|
||||
|
||||
qint32 adc_dither;
|
||||
bool m_adc_dither_isSet;
|
||||
|
||||
qint32 adc_preamp;
|
||||
bool m_adc_preamp_isSet;
|
||||
|
||||
qint32 wide_band;
|
||||
bool m_wide_band_isSet;
|
||||
|
||||
qint32 transverter_mode;
|
||||
bool m_transverter_mode_isSet;
|
||||
|
||||
qint64 transverter_delta_frequency;
|
||||
bool m_transverter_delta_frequency_isSet;
|
||||
|
||||
QString* file_record_name;
|
||||
bool m_file_record_name_isSet;
|
||||
|
||||
qint32 attenuator;
|
||||
bool m_attenuator_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGPerseusSettings_H_ */
|
@ -152,6 +152,15 @@ def setupDevice(deviceset_url, options):
|
||||
settings['hackRFInputSettings']['lnaGain'] = 32
|
||||
settings['hackRFInputSettings']['log2Decim'] = options.log2_decim
|
||||
settings['hackRFInputSettings']['vgaGain'] = 24
|
||||
elif options.device_hwid == "Perseus":
|
||||
settings['perseusSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
||||
settings['perseusSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings["perseusSettings"]["devSampleRateIndex"] = 0
|
||||
settings['perseusSettings']['log2Decim'] = options.log2_decim
|
||||
settings['perseusSettings']['adcDither'] = 0
|
||||
settings['perseusSettings']['adcPreamp'] = 0
|
||||
settings['perseusSettings']['wideBand'] = 0
|
||||
settings['perseusSettings']['attenuator'] = 0
|
||||
|
||||
r = callAPI(deviceset_url + "/device/settings", "PATCH", None, settings, "Patch device settings")
|
||||
if r is None:
|
||||
|
Loading…
Reference in New Issue
Block a user