1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-18 07:35:47 -05:00

Web API: AirspyHF: implemented settings entry points

This commit is contained in:
f4exb 2018-03-22 05:10:13 +01:00
parent 7ad8e50651
commit db2e7fe71b
16 changed files with 552 additions and 10 deletions

View File

@ -485,6 +485,70 @@ airspyhf_device_t *AirspyHFInput::open_airspyhf_from_serial(const QString& seria
} }
} }
int AirspyHFInput::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage __attribute__((unused)))
{
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
response.getAirspyHfSettings()->init();
webapiFormatDeviceSettings(response, m_settings);
return 200;
}
int AirspyHFInput::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage __attribute__((unused)))
{
AirspyHFSettings settings = m_settings;
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getAirspyHfSettings()->getCenterFrequency();
}
if (deviceSettingsKeys.contains("devSampleRateIndex")) {
settings.m_devSampleRateIndex = response.getAirspyHfSettings()->getDevSampleRateIndex();
}
if (deviceSettingsKeys.contains("LOppmTenths")) {
settings.m_LOppmTenths = response.getAirspyHfSettings()->getLOppmTenths();
}
if (deviceSettingsKeys.contains("log2Decim")) {
settings.m_log2Decim = response.getAirspyHfSettings()->getLog2Decim();
}
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
settings.m_transverterDeltaFrequency = response.getAirspyHfSettings()->getTransverterDeltaFrequency();
}
if (deviceSettingsKeys.contains("transverterMode")) {
settings.m_transverterMode = response.getAirspyHfSettings()->getTransverterMode() != 0;
}
if (deviceSettingsKeys.contains("bandIndex")) {
settings.m_bandIndex = response.getAirspyHfSettings()->getBandIndex() != 0;
}
MsgConfigureAirspyHF *msg = MsgConfigureAirspyHF::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureAirspyHF *msgToGUI = MsgConfigureAirspyHF::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatDeviceSettings(response, settings);
return 200;
}
void AirspyHFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings)
{
response.getAirspyHfSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getAirspyHfSettings()->setDevSampleRateIndex(settings.m_devSampleRateIndex);
response.getAirspyHfSettings()->setLOppmTenths(settings.m_LOppmTenths);
response.getAirspyHfSettings()->setLog2Decim(settings.m_log2Decim);
response.getAirspyHfSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getAirspyHfSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
response.getAirspyHfSettings()->setBandIndex(settings.m_bandIndex ? 1 : 0);
}
int AirspyHFInput::webapiRunGet( int AirspyHFInput::webapiRunGet(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
QString& errorMessage __attribute__((unused))) QString& errorMessage __attribute__((unused)))

View File

@ -112,6 +112,16 @@ public:
virtual bool handleMessage(const Message& message); 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( virtual int webapiRunGet(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
QString& errorMessage); QString& errorMessage);
@ -132,6 +142,7 @@ private:
bool applySettings(const AirspyHFSettings& settings, bool force); bool applySettings(const AirspyHFSettings& settings, bool force);
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr); airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings); void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings);
DeviceSourceAPI *m_deviceAPI; DeviceSourceAPI *m_deviceAPI;
QMutex m_mutex; QMutex m_mutex;

View File

@ -3,6 +3,7 @@
<file>webapi/doc/html2/index.html</file> <file>webapi/doc/html2/index.html</file>
<file>webapi/doc/swagger/swagger.yaml</file> <file>webapi/doc/swagger/swagger.yaml</file>
<file>webapi/doc/swagger/include/CWKeyer.yaml</file> <file>webapi/doc/swagger/include/CWKeyer.yaml</file>
<file>webapi/doc/swagger/include/AirspyHF.yaml</file>
<file>webapi/doc/swagger/include/FileSource.yaml</file> <file>webapi/doc/swagger/include/FileSource.yaml</file>
<file>webapi/doc/swagger/include/HackRF.yaml</file> <file>webapi/doc/swagger/include/HackRF.yaml</file>
<file>webapi/doc/swagger/include/LimeSdr.yaml</file> <file>webapi/doc/swagger/include/LimeSdr.yaml</file>

View File

@ -720,12 +720,12 @@ margin-bottom: 20px;
"rfBandwidth" : { "rfBandwidth" : {
"type" : "number", "type" : "number",
"format" : "float", "format" : "float",
"description" : "channel RF bandwidth in Hz (rounds to lower kHz)" "description" : "channel RF bandwidth in Hz (floors to next 100 Hz)"
}, },
"squelch" : { "squelch" : {
"type" : "number", "type" : "number",
"format" : "float", "format" : "float",
"description" : "power squelch threshold in centi-bels" "description" : "power squelch threshold in decibels"
}, },
"volume" : { "volume" : {
"type" : "number", "type" : "number",
@ -761,6 +761,34 @@ margin-bottom: 20px;
} }
}, },
"description" : "AMDemod" "description" : "AMDemod"
};
defs.AirspyHFSettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"LOppmTenths" : {
"type" : "integer"
},
"devSampleRateIndex" : {
"type" : "integer"
},
"log2Decim" : {
"type" : "integer"
},
"transverterMode" : {
"type" : "integer"
},
"transverterDeltaFrequency" : {
"type" : "integer",
"format" : "int64"
},
"bandIndex" : {
"type" : "integer"
}
},
"description" : "AirspyHF"
}; };
defs.AudioDevice = { defs.AudioDevice = {
"properties" : { "properties" : {
@ -1093,6 +1121,9 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "Not zero if it is a tx device else it is a rx device" "description" : "Not zero if it is a tx device else it is a rx device"
}, },
"airspyHFSettings" : {
"$ref" : "#/definitions/AirspyHFSettings"
},
"fileSourceSettings" : { "fileSourceSettings" : {
"$ref" : "#/definitions/FileSourceSettings" "$ref" : "#/definitions/FileSourceSettings"
}, },
@ -18032,7 +18063,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-03-21T22:39:00.405+01:00 Generated 2018-03-22T05:08:39.552+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -6,11 +6,11 @@ AMDemodSettings:
type: integer type: integer
format: int64 format: int64
rfBandwidth: rfBandwidth:
description: channel RF bandwidth in Hz (rounds to lower kHz) description: channel RF bandwidth in Hz (floors to next 100 Hz)
type: number type: number
format: float format: float
squelch: squelch:
description: power squelch threshold in centi-bels description: power squelch threshold in decibels
type: number type: number
format: float format: float
volume: volume:

View File

@ -0,0 +1,20 @@
AirspyHFSettings:
description: AirspyHF
properties:
centerFrequency:
type: integer
format: int64
LOppmTenths:
type: integer
devSampleRateIndex:
type: integer
log2Decim:
type: integer
transverterMode:
type: integer
transverterDeltaFrequency:
type: integer
format: int64
bandIndex:
type: integer

View File

@ -1568,6 +1568,8 @@ definitions:
tx: tx:
description: Not zero if it is a tx device else it is a rx device description: Not zero if it is a tx device else it is a rx device
type: integer type: integer
airspyHFSettings:
$ref: "/doc/swagger/include/AirspyHF.yaml#/AirspyHFSettings"
fileSourceSettings: fileSourceSettings:
$ref: "/doc/swagger/include/FileSource.yaml#/FileSourceSettings" $ref: "/doc/swagger/include/FileSource.yaml#/FileSourceSettings"
hackRFInputSettings: hackRFInputSettings:

View File

@ -6,11 +6,11 @@ AMDemodSettings:
type: integer type: integer
format: int64 format: int64
rfBandwidth: rfBandwidth:
description: channel RF bandwidth in Hz (rounds to lower kHz) description: channel RF bandwidth in Hz (floors to next 100 Hz)
type: number type: number
format: float format: float
squelch: squelch:
description: power squelch threshold in centi-bels description: power squelch threshold in decibels
type: number type: number
format: float format: float
volume: volume:

View File

@ -0,0 +1,20 @@
AirspyHFSettings:
description: AirspyHF
properties:
centerFrequency:
type: integer
format: int64
LOppmTenths:
type: integer
devSampleRateIndex:
type: integer
log2Decim:
type: integer
transverterMode:
type: integer
transverterDeltaFrequency:
type: integer
format: int64
bandIndex:
type: integer

View File

@ -1568,6 +1568,8 @@ definitions:
tx: tx:
description: Not zero if it is a tx device else it is a rx device description: Not zero if it is a tx device else it is a rx device
type: integer type: integer
airspyHFSettings:
$ref: "http://localhost:8081/api/swagger/include/AirspyHF.yaml#/AirspyHFSettings"
fileSourceSettings: fileSourceSettings:
$ref: "http://localhost:8081/api/swagger/include/FileSource.yaml#/FileSourceSettings" $ref: "http://localhost:8081/api/swagger/include/FileSource.yaml#/FileSourceSettings"
hackRFInputSettings: hackRFInputSettings:

View File

@ -720,12 +720,12 @@ margin-bottom: 20px;
"rfBandwidth" : { "rfBandwidth" : {
"type" : "number", "type" : "number",
"format" : "float", "format" : "float",
"description" : "channel RF bandwidth in Hz (rounds to lower kHz)" "description" : "channel RF bandwidth in Hz (floors to next 100 Hz)"
}, },
"squelch" : { "squelch" : {
"type" : "number", "type" : "number",
"format" : "float", "format" : "float",
"description" : "power squelch threshold in centi-bels" "description" : "power squelch threshold in decibels"
}, },
"volume" : { "volume" : {
"type" : "number", "type" : "number",
@ -761,6 +761,34 @@ margin-bottom: 20px;
} }
}, },
"description" : "AMDemod" "description" : "AMDemod"
};
defs.AirspyHFSettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"LOppmTenths" : {
"type" : "integer"
},
"devSampleRateIndex" : {
"type" : "integer"
},
"log2Decim" : {
"type" : "integer"
},
"transverterMode" : {
"type" : "integer"
},
"transverterDeltaFrequency" : {
"type" : "integer",
"format" : "int64"
},
"bandIndex" : {
"type" : "integer"
}
},
"description" : "AirspyHF"
}; };
defs.AudioDevice = { defs.AudioDevice = {
"properties" : { "properties" : {
@ -1093,6 +1121,9 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "Not zero if it is a tx device else it is a rx device" "description" : "Not zero if it is a tx device else it is a rx device"
}, },
"airspyHFSettings" : {
"$ref" : "#/definitions/AirspyHFSettings"
},
"fileSourceSettings" : { "fileSourceSettings" : {
"$ref" : "#/definitions/FileSourceSettings" "$ref" : "#/definitions/FileSourceSettings"
}, },
@ -18032,7 +18063,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-03-21T22:39:00.405+01:00 Generated 2018-03-22T05:08:39.552+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,232 @@
/**
* 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 "SWGAirspyHFSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGAirspyHFSettings::SWGAirspyHFSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGAirspyHFSettings::SWGAirspyHFSettings() {
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;
transverter_mode = 0;
m_transverter_mode_isSet = false;
transverter_delta_frequency = 0L;
m_transverter_delta_frequency_isSet = false;
band_index = 0;
m_band_index_isSet = false;
}
SWGAirspyHFSettings::~SWGAirspyHFSettings() {
this->cleanup();
}
void
SWGAirspyHFSettings::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;
transverter_mode = 0;
m_transverter_mode_isSet = false;
transverter_delta_frequency = 0L;
m_transverter_delta_frequency_isSet = false;
band_index = 0;
m_band_index_isSet = false;
}
void
SWGAirspyHFSettings::cleanup() {
}
SWGAirspyHFSettings*
SWGAirspyHFSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGAirspyHFSettings::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(&log2_decim, pJson["log2Decim"], "qint32", "");
::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
::SWGSDRangel::setValue(&band_index, pJson["bandIndex"], "qint32", "");
}
QString
SWGAirspyHFSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGAirspyHFSettings::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_transverter_mode_isSet){
obj->insert("transverterMode", QJsonValue(transverter_mode));
}
if(m_transverter_delta_frequency_isSet){
obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
}
if(m_band_index_isSet){
obj->insert("bandIndex", QJsonValue(band_index));
}
return obj;
}
qint64
SWGAirspyHFSettings::getCenterFrequency() {
return center_frequency;
}
void
SWGAirspyHFSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
qint32
SWGAirspyHFSettings::getLOppmTenths() {
return l_oppm_tenths;
}
void
SWGAirspyHFSettings::setLOppmTenths(qint32 l_oppm_tenths) {
this->l_oppm_tenths = l_oppm_tenths;
this->m_l_oppm_tenths_isSet = true;
}
qint32
SWGAirspyHFSettings::getDevSampleRateIndex() {
return dev_sample_rate_index;
}
void
SWGAirspyHFSettings::setDevSampleRateIndex(qint32 dev_sample_rate_index) {
this->dev_sample_rate_index = dev_sample_rate_index;
this->m_dev_sample_rate_index_isSet = true;
}
qint32
SWGAirspyHFSettings::getLog2Decim() {
return log2_decim;
}
void
SWGAirspyHFSettings::setLog2Decim(qint32 log2_decim) {
this->log2_decim = log2_decim;
this->m_log2_decim_isSet = true;
}
qint32
SWGAirspyHFSettings::getTransverterMode() {
return transverter_mode;
}
void
SWGAirspyHFSettings::setTransverterMode(qint32 transverter_mode) {
this->transverter_mode = transverter_mode;
this->m_transverter_mode_isSet = true;
}
qint64
SWGAirspyHFSettings::getTransverterDeltaFrequency() {
return transverter_delta_frequency;
}
void
SWGAirspyHFSettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) {
this->transverter_delta_frequency = transverter_delta_frequency;
this->m_transverter_delta_frequency_isSet = true;
}
qint32
SWGAirspyHFSettings::getBandIndex() {
return band_index;
}
void
SWGAirspyHFSettings::setBandIndex(qint32 band_index) {
this->band_index = band_index;
this->m_band_index_isSet = true;
}
bool
SWGAirspyHFSettings::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_transverter_mode_isSet){ isObjectUpdated = true; break;}
if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
if(m_band_index_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,94 @@
/**
* 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.
*/
/*
* SWGAirspyHFSettings.h
*
* AirspyHF
*/
#ifndef SWGAirspyHFSettings_H_
#define SWGAirspyHFSettings_H_
#include <QJsonObject>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGAirspyHFSettings: public SWGObject {
public:
SWGAirspyHFSettings();
SWGAirspyHFSettings(QString* json);
virtual ~SWGAirspyHFSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAirspyHFSettings* 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 getTransverterMode();
void setTransverterMode(qint32 transverter_mode);
qint64 getTransverterDeltaFrequency();
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency);
qint32 getBandIndex();
void setBandIndex(qint32 band_index);
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 transverter_mode;
bool m_transverter_mode_isSet;
qint64 transverter_delta_frequency;
bool m_transverter_delta_frequency_isSet;
qint32 band_index;
bool m_band_index_isSet;
};
}
#endif /* SWGAirspyHFSettings_H_ */

View File

@ -32,6 +32,8 @@ SWGDeviceSettings::SWGDeviceSettings() {
m_device_hw_type_isSet = false; m_device_hw_type_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false; m_tx_isSet = false;
airspy_hf_settings = nullptr;
m_airspy_hf_settings_isSet = false;
file_source_settings = nullptr; file_source_settings = nullptr;
m_file_source_settings_isSet = false; m_file_source_settings_isSet = false;
hack_rf_input_settings = nullptr; hack_rf_input_settings = nullptr;
@ -56,6 +58,8 @@ SWGDeviceSettings::init() {
m_device_hw_type_isSet = false; m_device_hw_type_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false; m_tx_isSet = false;
airspy_hf_settings = new SWGAirspyHFSettings();
m_airspy_hf_settings_isSet = false;
file_source_settings = new SWGFileSourceSettings(); file_source_settings = new SWGFileSourceSettings();
m_file_source_settings_isSet = false; m_file_source_settings_isSet = false;
hack_rf_input_settings = new SWGHackRFInputSettings(); hack_rf_input_settings = new SWGHackRFInputSettings();
@ -76,6 +80,9 @@ SWGDeviceSettings::cleanup() {
delete device_hw_type; delete device_hw_type;
} }
if(airspy_hf_settings != nullptr) {
delete airspy_hf_settings;
}
if(file_source_settings != nullptr) { if(file_source_settings != nullptr) {
delete file_source_settings; delete file_source_settings;
} }
@ -111,6 +118,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&airspy_hf_settings, pJson["airspyHFSettings"], "SWGAirspyHFSettings", "SWGAirspyHFSettings");
::SWGSDRangel::setValue(&file_source_settings, pJson["fileSourceSettings"], "SWGFileSourceSettings", "SWGFileSourceSettings"); ::SWGSDRangel::setValue(&file_source_settings, pJson["fileSourceSettings"], "SWGFileSourceSettings", "SWGFileSourceSettings");
::SWGSDRangel::setValue(&hack_rf_input_settings, pJson["hackRFInputSettings"], "SWGHackRFInputSettings", "SWGHackRFInputSettings"); ::SWGSDRangel::setValue(&hack_rf_input_settings, pJson["hackRFInputSettings"], "SWGHackRFInputSettings", "SWGHackRFInputSettings");
@ -145,6 +154,9 @@ SWGDeviceSettings::asJsonObject() {
if(m_tx_isSet){ if(m_tx_isSet){
obj->insert("tx", QJsonValue(tx)); obj->insert("tx", QJsonValue(tx));
} }
if((airspy_hf_settings != nullptr) && (airspy_hf_settings->isSet())){
toJsonValue(QString("airspyHFSettings"), airspy_hf_settings, obj, QString("SWGAirspyHFSettings"));
}
if((file_source_settings != nullptr) && (file_source_settings->isSet())){ if((file_source_settings != nullptr) && (file_source_settings->isSet())){
toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings")); toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings"));
} }
@ -187,6 +199,16 @@ SWGDeviceSettings::setTx(qint32 tx) {
this->m_tx_isSet = true; this->m_tx_isSet = true;
} }
SWGAirspyHFSettings*
SWGDeviceSettings::getAirspyHfSettings() {
return airspy_hf_settings;
}
void
SWGDeviceSettings::setAirspyHfSettings(SWGAirspyHFSettings* airspy_hf_settings) {
this->airspy_hf_settings = airspy_hf_settings;
this->m_airspy_hf_settings_isSet = true;
}
SWGFileSourceSettings* SWGFileSourceSettings*
SWGDeviceSettings::getFileSourceSettings() { SWGDeviceSettings::getFileSourceSettings() {
return file_source_settings; return file_source_settings;
@ -254,6 +276,7 @@ SWGDeviceSettings::isSet(){
do{ do{
if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;} if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;} if(m_tx_isSet){ isObjectUpdated = true; break;}
if(airspy_hf_settings != nullptr && airspy_hf_settings->isSet()){ isObjectUpdated = true; break;}
if(file_source_settings != nullptr && file_source_settings->isSet()){ isObjectUpdated = true; break;} if(file_source_settings != nullptr && file_source_settings->isSet()){ isObjectUpdated = true; break;}
if(hack_rf_input_settings != nullptr && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break;} if(hack_rf_input_settings != nullptr && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break;}
if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;} if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;}

View File

@ -22,6 +22,7 @@
#include <QJsonObject> #include <QJsonObject>
#include "SWGAirspyHFSettings.h"
#include "SWGFileSourceSettings.h" #include "SWGFileSourceSettings.h"
#include "SWGHackRFInputSettings.h" #include "SWGHackRFInputSettings.h"
#include "SWGHackRFOutputSettings.h" #include "SWGHackRFOutputSettings.h"
@ -54,6 +55,9 @@ public:
qint32 getTx(); qint32 getTx();
void setTx(qint32 tx); void setTx(qint32 tx);
SWGAirspyHFSettings* getAirspyHfSettings();
void setAirspyHfSettings(SWGAirspyHFSettings* airspy_hf_settings);
SWGFileSourceSettings* getFileSourceSettings(); SWGFileSourceSettings* getFileSourceSettings();
void setFileSourceSettings(SWGFileSourceSettings* file_source_settings); void setFileSourceSettings(SWGFileSourceSettings* file_source_settings);
@ -82,6 +86,9 @@ private:
qint32 tx; qint32 tx;
bool m_tx_isSet; bool m_tx_isSet;
SWGAirspyHFSettings* airspy_hf_settings;
bool m_airspy_hf_settings_isSet;
SWGFileSourceSettings* file_source_settings; SWGFileSourceSettings* file_source_settings;
bool m_file_source_settings_isSet; bool m_file_source_settings_isSet;

View File

@ -16,6 +16,7 @@
#include "SWGAMDemodReport.h" #include "SWGAMDemodReport.h"
#include "SWGAMDemodSettings.h" #include "SWGAMDemodSettings.h"
#include "SWGAirspyHFSettings.h"
#include "SWGAudioDevice.h" #include "SWGAudioDevice.h"
#include "SWGAudioDevices.h" #include "SWGAudioDevices.h"
#include "SWGAudioDevicesSelect.h" #include "SWGAudioDevicesSelect.h"
@ -67,6 +68,9 @@ namespace SWGSDRangel {
if(QString("SWGAMDemodSettings").compare(type) == 0) { if(QString("SWGAMDemodSettings").compare(type) == 0) {
return new SWGAMDemodSettings(); return new SWGAMDemodSettings();
} }
if(QString("SWGAirspyHFSettings").compare(type) == 0) {
return new SWGAirspyHFSettings();
}
if(QString("SWGAudioDevice").compare(type) == 0) { if(QString("SWGAudioDevice").compare(type) == 0) {
return new SWGAudioDevice(); return new SWGAudioDevice();
} }