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

Airspy input: implemeted WEB API

This commit is contained in:
f4exb 2018-05-25 19:28:57 +02:00
parent 3d8d9d34e0
commit 3203a5511d
29 changed files with 954 additions and 4 deletions

View File

@ -8,7 +8,7 @@
const PluginDescriptor WFMPlugin::m_pluginDescriptor = {
QString("WFM Demodulator"),
QString("3.14.5"),
QString("4.0.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -25,7 +25,7 @@
const PluginDescriptor UDPSrcPlugin::m_pluginDescriptor = {
QString("UDP Channel Source"),
QString("3.14.5"),
QString("4.0.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -56,6 +56,7 @@ AirspyGui::AirspyGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_rates = ((AirspyInput*) m_sampleSource)->getSampleRates();
displaySampleRates();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
sendSettings();
}

View File

@ -616,3 +616,110 @@ int AirspyInput::webapiRun(
return 200;
}
int AirspyInput::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage __attribute__((unused)))
{
response.setAirspySettings(new SWGSDRangel::SWGAirspySettings());
response.getAirspySettings()->init();
webapiFormatDeviceSettings(response, m_settings);
return 200;
}
int AirspyInput::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage __attribute__((unused)))
{
AirspySettings settings = m_settings;
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getAirspySettings()->getCenterFrequency();
}
if (deviceSettingsKeys.contains("LOppmTenths")) {
settings.m_LOppmTenths = response.getAirspySettings()->getLOppmTenths();
}
if (deviceSettingsKeys.contains("devSampleRateIndex")) {
settings.m_devSampleRateIndex = response.getAirspySettings()->getDevSampleRateIndex();
}
if (deviceSettingsKeys.contains("lnaGain")) {
settings.m_lnaGain = response.getAirspySettings()->getLnaGain();
}
if (deviceSettingsKeys.contains("mixerGain")) {
settings.m_mixerGain = response.getAirspySettings()->getMixerGain();
}
if (deviceSettingsKeys.contains("vgaGain")) {
settings.m_vgaGain = response.getAirspySettings()->getVgaGain();
}
if (deviceSettingsKeys.contains("vgaGain")) {
settings.m_vgaGain = response.getAirspySettings()->getVgaGain();
}
if (deviceSettingsKeys.contains("lnaAGC")) {
settings.m_lnaAGC = response.getAirspySettings()->getLnaAgc() != 0;
}
if (deviceSettingsKeys.contains("mixerAGC")) {
settings.m_mixerAGC = response.getAirspySettings()->getMixerAgc() != 0;
}
if (deviceSettingsKeys.contains("log2Decim")) {
settings.m_log2Decim = response.getAirspySettings()->getLog2Decim();
}
if (deviceSettingsKeys.contains("fcPos")) {
settings.m_fcPos = (AirspySettings::fcPos_t) response.getAirspySettings()->getFcPos();
}
if (deviceSettingsKeys.contains("biasT")) {
settings.m_biasT = response.getAirspySettings()->getBiasT() != 0;
}
if (deviceSettingsKeys.contains("dcBlock")) {
settings.m_dcBlock = response.getAirspySettings()->getDcBlock() != 0;
}
if (deviceSettingsKeys.contains("iqCorrection")) {
settings.m_iqCorrection = response.getAirspySettings()->getIqCorrection() != 0;
}
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
settings.m_transverterDeltaFrequency = response.getAirspySettings()->getTransverterDeltaFrequency();
}
if (deviceSettingsKeys.contains("transverterMode")) {
settings.m_transverterMode = response.getAirspySettings()->getTransverterMode() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getAirspySettings()->getFileRecordName();
}
MsgConfigureAirspy *msg = MsgConfigureAirspy::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureAirspy *msgToGUI = MsgConfigureAirspy::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatDeviceSettings(response, settings);
return 200;
}
void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings)
{
response.getAirspySettings()->setCenterFrequency(settings.m_centerFrequency);
response.getAirspySettings()->setLOppmTenths(settings.m_LOppmTenths);
response.getAirspySettings()->setDevSampleRateIndex(settings.m_devSampleRateIndex);
response.getAirspySettings()->setLnaGain(settings.m_lnaGain);
response.getAirspySettings()->setMixerGain(settings.m_mixerGain);
response.getAirspySettings()->setVgaGain(settings.m_vgaGain);
response.getAirspySettings()->setLnaAgc(settings.m_lnaAGC ? 1 : 0);
response.getAirspySettings()->setMixerAgc(settings.m_mixerAGC ? 1 : 0);
response.getAirspySettings()->setLog2Decim(settings.m_log2Decim);
response.getAirspySettings()->setFcPos((int) settings.m_fcPos);
response.getAirspySettings()->setBiasT(settings.m_biasT ? 1 : 0);
response.getAirspySettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
response.getAirspySettings()->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
response.getAirspySettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getAirspySettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
if (response.getAirspySettings()->getFileRecordName()) {
*response.getAirspySettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getAirspySettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
}

View File

@ -111,6 +111,16 @@ 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 webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);
@ -129,6 +139,7 @@ private:
bool applySettings(const AirspySettings& settings, bool force);
struct airspy_device *open_airspy_from_sequence(int sequence);
void setDeviceCenterFrequency(quint64 freq);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings);
DeviceSourceAPI *m_deviceAPI;
QMutex m_mutex;

View File

@ -55,6 +55,7 @@ AirspyHFGui::AirspyHFGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_rates = ((AirspyHFInput*) m_sampleSource)->getSampleRates();
displaySampleRates();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
sendSettings();
}

View File

@ -63,6 +63,7 @@ BladerfInputGui::BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
sendSettings();
}

View File

@ -146,6 +146,7 @@ FCDProGui::FCDProGui(DeviceUISet *deviceUISet, QWidget* parent) :
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
FCDProGui::~FCDProGui()

View File

@ -64,6 +64,7 @@ FCDProPlusGui::FCDProPlusGui(DeviceUISet *deviceUISet, QWidget* parent) :
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
FCDProPlusGui::~FCDProPlusGui()

View File

@ -71,6 +71,7 @@ FileSourceGui::FileSourceGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleSource = m_deviceUISet->m_deviceSourceAPI->getSampleSource();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
FileSourceGui::~FileSourceGui()

View File

@ -59,6 +59,7 @@ HackRFInputGui::HackRFInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
displayBandwidths();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
sendSettings();
}

View File

@ -76,6 +76,7 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_limeSDRInput->setMessageQueueToGUI(&m_inputMessageQueue);
}
LimeSDRInputGUI::~LimeSDRInputGUI()

View File

@ -53,6 +53,7 @@ PerseusGui::PerseusGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_rates = m_sampleSource->getSampleRates();
displaySampleRates();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
sendSettings();
}

View File

@ -68,6 +68,7 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_statusTimer.start(500);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
PlutoSDRInputGui::~PlutoSDRInputGui()

View File

@ -62,6 +62,7 @@ RTLSDRGui::RTLSDRGui(DeviceUISet *deviceUISet, QWidget* parent) :
displayGains();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
RTLSDRGui::~RTLSDRGui()

View File

@ -96,6 +96,7 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceUISet *deviceUISet, QWidget* parent
m_sampleSource = (SDRdaemonSourceInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
m_eventsTime.start();
displayEventCounts();

View File

@ -73,6 +73,7 @@ SDRPlayGui::SDRPlayGui(DeviceUISet *deviceUISet, QWidget* parent) :
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
SDRPlayGui::~SDRPlayGui()

View File

@ -65,6 +65,7 @@ TestSourceGui::TestSourceGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_statusTimer.start(500);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
}
TestSourceGui::~TestSourceGui()

View File

@ -942,6 +942,65 @@ margin-bottom: 20px;
}
},
"description" : "AirspyHF"
};
defs.AirspySettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"LOppmTenths" : {
"type" : "integer"
},
"devSampleRateIndex" : {
"type" : "integer"
},
"lnaGain" : {
"type" : "integer"
},
"mixerGain" : {
"type" : "integer"
},
"vgaGain" : {
"type" : "integer"
},
"lnaAGC" : {
"type" : "integer",
"description" : "LNA AGC (1 if active else 0)"
},
"mixerAGC" : {
"type" : "integer",
"description" : "Mixer AGC (1 if active else 0)"
},
"log2Decim" : {
"type" : "integer"
},
"fcPos" : {
"type" : "integer",
"description" : "0=Infra 1=Supra 2=Center"
},
"biasT" : {
"type" : "integer",
"description" : "Bias tee (1 if active else 0)"
},
"dcBlock" : {
"type" : "integer"
},
"iqCorrection" : {
"type" : "integer"
},
"transverterMode" : {
"type" : "integer"
},
"transverterDeltaFrequency" : {
"type" : "integer",
"format" : "int64"
},
"fileRecordName" : {
"type" : "string"
}
},
"description" : "Airspy"
};
defs.AudioDevices = {
"required" : [ "nbInputDevices", "nbOutputDevices" ],
@ -1657,6 +1716,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Not zero if it is a tx device else it is a rx device"
},
"airspySettings" : {
"$ref" : "#/definitions/AirspySettings"
},
"airspyHFSettings" : {
"$ref" : "#/definitions/AirspyHFSettings"
},
@ -21118,7 +21180,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-25T10:44:21.402+02:00
Generated 2018-05-25T18:55:39.036+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,42 @@
AirspySettings:
description: Airspy
properties:
centerFrequency:
type: integer
format: int64
LOppmTenths:
type: integer
devSampleRateIndex:
type: integer
lnaGain:
type: integer
mixerGain:
type: integer
vgaGain:
type: integer
lnaAGC:
description: LNA AGC (1 if active else 0)
type: integer
mixerAGC:
description: Mixer AGC (1 if active else 0)
type: integer
log2Decim:
type: integer
fcPos:
description: 0=Infra 1=Supra 2=Center
type: integer
biasT:
description: Bias tee (1 if active else 0)
type: integer
dcBlock:
type: integer
iqCorrection:
type: integer
transverterMode:
type: integer
transverterDeltaFrequency:
type: integer
format: int64
fileRecordName:
type: string

View File

@ -1713,6 +1713,8 @@ definitions:
tx:
description: Not zero if it is a tx device else it is a rx device
type: integer
airspySettings:
$ref: "/doc/swagger/include/Airspy.yaml#/AirspySettings"
airspyHFSettings:
$ref: "/doc/swagger/include/AirspyHF.yaml#/AirspyHFSettings"
bladeRFInputSettings:

View File

@ -0,0 +1,42 @@
AirspySettings:
description: Airspy
properties:
centerFrequency:
type: integer
format: int64
LOppmTenths:
type: integer
devSampleRateIndex:
type: integer
lnaGain:
type: integer
mixerGain:
type: integer
vgaGain:
type: integer
lnaAGC:
description: LNA AGC (1 if active else 0)
type: integer
mixerAGC:
description: Mixer AGC (1 if active else 0)
type: integer
log2Decim:
type: integer
fcPos:
description: 0=Infra 1=Supra 2=Center
type: integer
biasT:
description: Bias tee (1 if active else 0)
type: integer
dcBlock:
type: integer
iqCorrection:
type: integer
transverterMode:
type: integer
transverterDeltaFrequency:
type: integer
format: int64
fileRecordName:
type: string

View File

@ -1713,6 +1713,8 @@ definitions:
tx:
description: Not zero if it is a tx device else it is a rx device
type: integer
airspySettings:
$ref: "http://localhost:8081/api/swagger/include/Airspy.yaml#/AirspySettings"
airspyHFSettings:
$ref: "http://localhost:8081/api/swagger/include/AirspyHF.yaml#/AirspyHFSettings"
bladeRFInputSettings:

View File

@ -942,6 +942,65 @@ margin-bottom: 20px;
}
},
"description" : "AirspyHF"
};
defs.AirspySettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"LOppmTenths" : {
"type" : "integer"
},
"devSampleRateIndex" : {
"type" : "integer"
},
"lnaGain" : {
"type" : "integer"
},
"mixerGain" : {
"type" : "integer"
},
"vgaGain" : {
"type" : "integer"
},
"lnaAGC" : {
"type" : "integer",
"description" : "LNA AGC (1 if active else 0)"
},
"mixerAGC" : {
"type" : "integer",
"description" : "Mixer AGC (1 if active else 0)"
},
"log2Decim" : {
"type" : "integer"
},
"fcPos" : {
"type" : "integer",
"description" : "0=Infra 1=Supra 2=Center"
},
"biasT" : {
"type" : "integer",
"description" : "Bias tee (1 if active else 0)"
},
"dcBlock" : {
"type" : "integer"
},
"iqCorrection" : {
"type" : "integer"
},
"transverterMode" : {
"type" : "integer"
},
"transverterDeltaFrequency" : {
"type" : "integer",
"format" : "int64"
},
"fileRecordName" : {
"type" : "string"
}
},
"description" : "Airspy"
};
defs.AudioDevices = {
"required" : [ "nbInputDevices", "nbOutputDevices" ],
@ -1657,6 +1716,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Not zero if it is a tx device else it is a rx device"
},
"airspySettings" : {
"$ref" : "#/definitions/AirspySettings"
},
"airspyHFSettings" : {
"$ref" : "#/definitions/AirspyHFSettings"
},
@ -21118,7 +21180,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-25T10:44:21.402+02:00
Generated 2018-05-25T18:55:39.036+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,423 @@
/**
* 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 "SWGAirspySettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGAirspySettings::SWGAirspySettings(QString* json) {
init();
this->fromJson(*json);
}
SWGAirspySettings::SWGAirspySettings() {
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;
lna_gain = 0;
m_lna_gain_isSet = false;
mixer_gain = 0;
m_mixer_gain_isSet = false;
vga_gain = 0;
m_vga_gain_isSet = false;
lna_agc = 0;
m_lna_agc_isSet = false;
mixer_agc = 0;
m_mixer_agc_isSet = false;
log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0;
m_fc_pos_isSet = false;
bias_t = 0;
m_bias_t_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0;
m_iq_correction_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;
}
SWGAirspySettings::~SWGAirspySettings() {
this->cleanup();
}
void
SWGAirspySettings::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;
lna_gain = 0;
m_lna_gain_isSet = false;
mixer_gain = 0;
m_mixer_gain_isSet = false;
vga_gain = 0;
m_vga_gain_isSet = false;
lna_agc = 0;
m_lna_agc_isSet = false;
mixer_agc = 0;
m_mixer_agc_isSet = false;
log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0;
m_fc_pos_isSet = false;
bias_t = 0;
m_bias_t_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0;
m_iq_correction_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;
}
void
SWGAirspySettings::cleanup() {
if(file_record_name != nullptr) {
delete file_record_name;
}
}
SWGAirspySettings*
SWGAirspySettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGAirspySettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
::SWGSDRangel::setValue(&dev_sample_rate_index, pJson["devSampleRateIndex"], "qint32", "");
::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
::SWGSDRangel::setValue(&mixer_gain, pJson["mixerGain"], "qint32", "");
::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", "");
::SWGSDRangel::setValue(&lna_agc, pJson["lnaAGC"], "qint32", "");
::SWGSDRangel::setValue(&mixer_agc, pJson["mixerAGC"], "qint32", "");
::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "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");
}
QString
SWGAirspySettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGAirspySettings::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_lna_gain_isSet){
obj->insert("lnaGain", QJsonValue(lna_gain));
}
if(m_mixer_gain_isSet){
obj->insert("mixerGain", QJsonValue(mixer_gain));
}
if(m_vga_gain_isSet){
obj->insert("vgaGain", QJsonValue(vga_gain));
}
if(m_lna_agc_isSet){
obj->insert("lnaAGC", QJsonValue(lna_agc));
}
if(m_mixer_agc_isSet){
obj->insert("mixerAGC", QJsonValue(mixer_agc));
}
if(m_log2_decim_isSet){
obj->insert("log2Decim", QJsonValue(log2_decim));
}
if(m_fc_pos_isSet){
obj->insert("fcPos", QJsonValue(fc_pos));
}
if(m_bias_t_isSet){
obj->insert("biasT", QJsonValue(bias_t));
}
if(m_dc_block_isSet){
obj->insert("dcBlock", QJsonValue(dc_block));
}
if(m_iq_correction_isSet){
obj->insert("iqCorrection", QJsonValue(iq_correction));
}
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"));
}
return obj;
}
qint64
SWGAirspySettings::getCenterFrequency() {
return center_frequency;
}
void
SWGAirspySettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
qint32
SWGAirspySettings::getLOppmTenths() {
return l_oppm_tenths;
}
void
SWGAirspySettings::setLOppmTenths(qint32 l_oppm_tenths) {
this->l_oppm_tenths = l_oppm_tenths;
this->m_l_oppm_tenths_isSet = true;
}
qint32
SWGAirspySettings::getDevSampleRateIndex() {
return dev_sample_rate_index;
}
void
SWGAirspySettings::setDevSampleRateIndex(qint32 dev_sample_rate_index) {
this->dev_sample_rate_index = dev_sample_rate_index;
this->m_dev_sample_rate_index_isSet = true;
}
qint32
SWGAirspySettings::getLnaGain() {
return lna_gain;
}
void
SWGAirspySettings::setLnaGain(qint32 lna_gain) {
this->lna_gain = lna_gain;
this->m_lna_gain_isSet = true;
}
qint32
SWGAirspySettings::getMixerGain() {
return mixer_gain;
}
void
SWGAirspySettings::setMixerGain(qint32 mixer_gain) {
this->mixer_gain = mixer_gain;
this->m_mixer_gain_isSet = true;
}
qint32
SWGAirspySettings::getVgaGain() {
return vga_gain;
}
void
SWGAirspySettings::setVgaGain(qint32 vga_gain) {
this->vga_gain = vga_gain;
this->m_vga_gain_isSet = true;
}
qint32
SWGAirspySettings::getLnaAgc() {
return lna_agc;
}
void
SWGAirspySettings::setLnaAgc(qint32 lna_agc) {
this->lna_agc = lna_agc;
this->m_lna_agc_isSet = true;
}
qint32
SWGAirspySettings::getMixerAgc() {
return mixer_agc;
}
void
SWGAirspySettings::setMixerAgc(qint32 mixer_agc) {
this->mixer_agc = mixer_agc;
this->m_mixer_agc_isSet = true;
}
qint32
SWGAirspySettings::getLog2Decim() {
return log2_decim;
}
void
SWGAirspySettings::setLog2Decim(qint32 log2_decim) {
this->log2_decim = log2_decim;
this->m_log2_decim_isSet = true;
}
qint32
SWGAirspySettings::getFcPos() {
return fc_pos;
}
void
SWGAirspySettings::setFcPos(qint32 fc_pos) {
this->fc_pos = fc_pos;
this->m_fc_pos_isSet = true;
}
qint32
SWGAirspySettings::getBiasT() {
return bias_t;
}
void
SWGAirspySettings::setBiasT(qint32 bias_t) {
this->bias_t = bias_t;
this->m_bias_t_isSet = true;
}
qint32
SWGAirspySettings::getDcBlock() {
return dc_block;
}
void
SWGAirspySettings::setDcBlock(qint32 dc_block) {
this->dc_block = dc_block;
this->m_dc_block_isSet = true;
}
qint32
SWGAirspySettings::getIqCorrection() {
return iq_correction;
}
void
SWGAirspySettings::setIqCorrection(qint32 iq_correction) {
this->iq_correction = iq_correction;
this->m_iq_correction_isSet = true;
}
qint32
SWGAirspySettings::getTransverterMode() {
return transverter_mode;
}
void
SWGAirspySettings::setTransverterMode(qint32 transverter_mode) {
this->transverter_mode = transverter_mode;
this->m_transverter_mode_isSet = true;
}
qint64
SWGAirspySettings::getTransverterDeltaFrequency() {
return transverter_delta_frequency;
}
void
SWGAirspySettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) {
this->transverter_delta_frequency = transverter_delta_frequency;
this->m_transverter_delta_frequency_isSet = true;
}
QString*
SWGAirspySettings::getFileRecordName() {
return file_record_name;
}
void
SWGAirspySettings::setFileRecordName(QString* file_record_name) {
this->file_record_name = file_record_name;
this->m_file_record_name_isSet = true;
}
bool
SWGAirspySettings::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_lna_gain_isSet){ isObjectUpdated = true; break;}
if(m_mixer_gain_isSet){ isObjectUpdated = true; break;}
if(m_vga_gain_isSet){ isObjectUpdated = true; break;}
if(m_lna_agc_isSet){ isObjectUpdated = true; break;}
if(m_mixer_agc_isSet){ isObjectUpdated = true; break;}
if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
if(m_bias_t_isSet){ isObjectUpdated = true; break;}
if(m_dc_block_isSet){ isObjectUpdated = true; break;}
if(m_iq_correction_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;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,149 @@
/**
* 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.
*/
/*
* SWGAirspySettings.h
*
* Airspy
*/
#ifndef SWGAirspySettings_H_
#define SWGAirspySettings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGAirspySettings: public SWGObject {
public:
SWGAirspySettings();
SWGAirspySettings(QString* json);
virtual ~SWGAirspySettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAirspySettings* 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 getLnaGain();
void setLnaGain(qint32 lna_gain);
qint32 getMixerGain();
void setMixerGain(qint32 mixer_gain);
qint32 getVgaGain();
void setVgaGain(qint32 vga_gain);
qint32 getLnaAgc();
void setLnaAgc(qint32 lna_agc);
qint32 getMixerAgc();
void setMixerAgc(qint32 mixer_agc);
qint32 getLog2Decim();
void setLog2Decim(qint32 log2_decim);
qint32 getFcPos();
void setFcPos(qint32 fc_pos);
qint32 getBiasT();
void setBiasT(qint32 bias_t);
qint32 getDcBlock();
void setDcBlock(qint32 dc_block);
qint32 getIqCorrection();
void setIqCorrection(qint32 iq_correction);
qint32 getTransverterMode();
void setTransverterMode(qint32 transverter_mode);
qint64 getTransverterDeltaFrequency();
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency);
QString* getFileRecordName();
void setFileRecordName(QString* file_record_name);
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 lna_gain;
bool m_lna_gain_isSet;
qint32 mixer_gain;
bool m_mixer_gain_isSet;
qint32 vga_gain;
bool m_vga_gain_isSet;
qint32 lna_agc;
bool m_lna_agc_isSet;
qint32 mixer_agc;
bool m_mixer_agc_isSet;
qint32 log2_decim;
bool m_log2_decim_isSet;
qint32 fc_pos;
bool m_fc_pos_isSet;
qint32 bias_t;
bool m_bias_t_isSet;
qint32 dc_block;
bool m_dc_block_isSet;
qint32 iq_correction;
bool m_iq_correction_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;
};
}
#endif /* SWGAirspySettings_H_ */

View File

@ -32,6 +32,8 @@ SWGDeviceSettings::SWGDeviceSettings() {
m_device_hw_type_isSet = false;
tx = 0;
m_tx_isSet = false;
airspy_settings = nullptr;
m_airspy_settings_isSet = false;
airspy_hf_settings = nullptr;
m_airspy_hf_settings_isSet = false;
blade_rf_input_settings = nullptr;
@ -62,6 +64,8 @@ SWGDeviceSettings::init() {
m_device_hw_type_isSet = false;
tx = 0;
m_tx_isSet = false;
airspy_settings = new SWGAirspySettings();
m_airspy_settings_isSet = false;
airspy_hf_settings = new SWGAirspyHFSettings();
m_airspy_hf_settings_isSet = false;
blade_rf_input_settings = new SWGBladeRFInputSettings();
@ -88,6 +92,9 @@ SWGDeviceSettings::cleanup() {
delete device_hw_type;
}
if(airspy_settings != nullptr) {
delete airspy_settings;
}
if(airspy_hf_settings != nullptr) {
delete airspy_hf_settings;
}
@ -132,6 +139,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&airspy_settings, pJson["airspySettings"], "SWGAirspySettings", "SWGAirspySettings");
::SWGSDRangel::setValue(&airspy_hf_settings, pJson["airspyHFSettings"], "SWGAirspyHFSettings", "SWGAirspyHFSettings");
::SWGSDRangel::setValue(&blade_rf_input_settings, pJson["bladeRFInputSettings"], "SWGBladeRFInputSettings", "SWGBladeRFInputSettings");
@ -172,6 +181,9 @@ SWGDeviceSettings::asJsonObject() {
if(m_tx_isSet){
obj->insert("tx", QJsonValue(tx));
}
if((airspy_settings != nullptr) && (airspy_settings->isSet())){
toJsonValue(QString("airspySettings"), airspy_settings, obj, QString("SWGAirspySettings"));
}
if((airspy_hf_settings != nullptr) && (airspy_hf_settings->isSet())){
toJsonValue(QString("airspyHFSettings"), airspy_hf_settings, obj, QString("SWGAirspyHFSettings"));
}
@ -223,6 +235,16 @@ SWGDeviceSettings::setTx(qint32 tx) {
this->m_tx_isSet = true;
}
SWGAirspySettings*
SWGDeviceSettings::getAirspySettings() {
return airspy_settings;
}
void
SWGDeviceSettings::setAirspySettings(SWGAirspySettings* airspy_settings) {
this->airspy_settings = airspy_settings;
this->m_airspy_settings_isSet = true;
}
SWGAirspyHFSettings*
SWGDeviceSettings::getAirspyHfSettings() {
return airspy_hf_settings;
@ -320,6 +342,7 @@ SWGDeviceSettings::isSet(){
do{
if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(airspy_settings != nullptr && airspy_settings->isSet()){ isObjectUpdated = true; break;}
if(airspy_hf_settings != nullptr && airspy_hf_settings->isSet()){ isObjectUpdated = true; break;}
if(blade_rf_input_settings != nullptr && blade_rf_input_settings->isSet()){ isObjectUpdated = true; break;}
if(blade_rf_output_settings != nullptr && blade_rf_output_settings->isSet()){ isObjectUpdated = true; break;}

View File

@ -23,6 +23,7 @@
#include "SWGAirspyHFSettings.h"
#include "SWGAirspySettings.h"
#include "SWGBladeRFInputSettings.h"
#include "SWGBladeRFOutputSettings.h"
#include "SWGFileSourceSettings.h"
@ -57,6 +58,9 @@ public:
qint32 getTx();
void setTx(qint32 tx);
SWGAirspySettings* getAirspySettings();
void setAirspySettings(SWGAirspySettings* airspy_settings);
SWGAirspyHFSettings* getAirspyHfSettings();
void setAirspyHfSettings(SWGAirspyHFSettings* airspy_hf_settings);
@ -94,6 +98,9 @@ private:
qint32 tx;
bool m_tx_isSet;
SWGAirspySettings* airspy_settings;
bool m_airspy_settings_isSet;
SWGAirspyHFSettings* airspy_hf_settings;
bool m_airspy_hf_settings_isSet;

View File

@ -21,6 +21,7 @@
#include "SWGATVModReport.h"
#include "SWGATVModSettings.h"
#include "SWGAirspyHFSettings.h"
#include "SWGAirspySettings.h"
#include "SWGAudioDevices.h"
#include "SWGAudioInputDevice.h"
#include "SWGAudioOutputDevice.h"
@ -105,6 +106,9 @@ namespace SWGSDRangel {
if(QString("SWGAirspyHFSettings").compare(type) == 0) {
return new SWGAirspyHFSettings();
}
if(QString("SWGAirspySettings").compare(type) == 0) {
return new SWGAirspySettings();
}
if(QString("SWGAudioDevices").compare(type) == 0) {
return new SWGAudioDevices();
}