kopia lustrzana https://github.com/f4exb/sdrangel
BladerRF2 input support. Populate gain modes
rodzic
fcaf22418d
commit
5ad52a4a1b
|
@ -462,6 +462,36 @@ void DeviceBladeRF2::getGlobalGainRangeTx(int& min, int& max, int& step)
|
|||
}
|
||||
}
|
||||
|
||||
int DeviceBladeRF2::getGainModesRx(const bladerf_gain_modes **modes)
|
||||
{
|
||||
if (m_dev)
|
||||
{
|
||||
int n = bladerf_get_gain_modes(m_dev, BLADERF_CHANNEL_RX(0), 0);
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
qCritical("DeviceBladeRF2::getGainModesRx: Failed to get the number of Rx gain modes: %s", bladerf_strerror(n));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int status = bladerf_get_gain_modes(m_dev, BLADERF_CHANNEL_RX(0), modes);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
qCritical("DeviceBladeRF2::getGainModesRx: Failed to get Rx gain modes: %s", bladerf_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return n;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceBladeRF2::setBiasTeeRx(bool enable)
|
||||
{
|
||||
if (m_dev)
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
void getBandwidthRangeTx(int& min, int& max, int& step);
|
||||
void getGlobalGainRangeRx(int& min, int& max, int& step);
|
||||
void getGlobalGainRangeTx(int& min, int& max, int& step);
|
||||
int getGainModesRx(const bladerf_gain_modes**);
|
||||
void setBiasTeeRx(bool enable);
|
||||
void setBiasTeeTx(bool enable);
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include "libbladeRF.h"
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGBladeRF2InputSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
@ -507,6 +509,19 @@ void BladeRF2Input::getGlobalGainRange(int& min, int& max, int& step)
|
|||
}
|
||||
}
|
||||
|
||||
const bladerf_gain_modes *BladeRF2Input::getGainModes(int& nbGains)
|
||||
{
|
||||
const bladerf_gain_modes *modes = 0;
|
||||
|
||||
if (m_deviceShared.m_dev) {
|
||||
nbGains = m_deviceShared.m_dev->getGainModesRx(&modes);
|
||||
} else {
|
||||
nbGains = 0;
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
bool BladeRF2Input::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureBladeRF2::match(message))
|
||||
|
@ -978,7 +993,7 @@ void BladeRF2Input::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
|
|||
|
||||
device->getFrequencyRangeRx(f_min, f_max, step);
|
||||
|
||||
response.getBladeRf2InputReport()->setFrequencyRange(new SWGSDRangel::SWGRange);
|
||||
response.getBladeRf2InputReport()->setFrequencyRange(new SWGSDRangel::SWGFrequencyRange);
|
||||
response.getBladeRf2InputReport()->getFrequencyRange()->setMin(f_min);
|
||||
response.getBladeRf2InputReport()->getFrequencyRange()->setMax(f_max);
|
||||
response.getBladeRf2InputReport()->getFrequencyRange()->setStep(step);
|
||||
|
@ -996,6 +1011,21 @@ void BladeRF2Input::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
|
|||
response.getBladeRf2InputReport()->getSampleRateRange()->setMin(min);
|
||||
response.getBladeRf2InputReport()->getSampleRateRange()->setMax(max);
|
||||
response.getBladeRf2InputReport()->getSampleRateRange()->setStep(step);
|
||||
|
||||
response.getBladeRf2InputReport()->setGainModes(new QList<SWGSDRangel::SWGNamedEnum*>);
|
||||
|
||||
int nbModes;
|
||||
const bladerf_gain_modes *modes = getGainModes(nbModes);
|
||||
|
||||
if (modes)
|
||||
{
|
||||
for (int i = 0; i < nbModes; modes++)
|
||||
{
|
||||
response.getBladeRf2InputReport()->getGainModes()->append(new SWGSDRangel::SWGNamedEnum);
|
||||
response.getBladeRf2InputReport()->getGainModes()->back()->setName(new QString(modes[i].name));
|
||||
response.getBladeRf2InputReport()->getGainModes()->back()->setValue(modes[i].mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
class DeviceSourceAPI;
|
||||
class BladeRF2InputThread;
|
||||
class FileRecord;
|
||||
struct bladerf_gain_modes;
|
||||
|
||||
class BladeRF2Input : public DeviceSampleSource
|
||||
{
|
||||
|
@ -116,6 +117,7 @@ public:
|
|||
void getSampleRateRange(int& min, int& max, int& step);
|
||||
void getBandwidthRange(int& min, int& max, int& step);
|
||||
void getGlobalGainRange(int& min, int& max, int& step);
|
||||
const bladerf_gain_modes *getGainModes(int& nbGains);
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
|
@ -151,6 +153,8 @@ private:
|
|||
DeviceBladeRF2Shared m_deviceShared;
|
||||
BladeRF2InputThread *m_thread;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
bladerf_gain_modes **m_gainModes;
|
||||
int m_nbGainModes;
|
||||
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
|
|
|
@ -58,6 +58,15 @@ BladeRF2InputGui::BladeRF2InputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||
ui->bandwidth->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
|
||||
ui->bandwidth->setValueRange(6, min/1000, max/1000);
|
||||
|
||||
m_gainModes = m_sampleSource->getGainModes(m_nbGainModes);
|
||||
|
||||
if (m_gainModes)
|
||||
{
|
||||
for (int i = 0; i < m_nbGainModes; i++) {
|
||||
ui->gainMode->addItem(tr("%1").arg(m_gainModes[i].name));
|
||||
}
|
||||
}
|
||||
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
m_statusTimer.start(500);
|
||||
|
|
|
@ -65,6 +65,8 @@ private:
|
|||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||
int m_lastEngineState;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
const struct bladerf_gain_modes *m_gainModes;
|
||||
int m_nbGainModes;
|
||||
|
||||
void displaySettings();
|
||||
void sendSettings();
|
||||
|
|
|
@ -1305,7 +1305,7 @@ margin-bottom: 20px;
|
|||
defs.BladeRF2InputReport = {
|
||||
"properties" : {
|
||||
"frequencyRange" : {
|
||||
"$ref" : "#/definitions/Range"
|
||||
"$ref" : "#/definitions/FrequencyRange"
|
||||
},
|
||||
"sampleRateRange" : {
|
||||
"$ref" : "#/definitions/Range"
|
||||
|
@ -1315,6 +1315,12 @@ margin-bottom: 20px;
|
|||
},
|
||||
"globalGainRange" : {
|
||||
"$ref" : "#/definitions/Range"
|
||||
},
|
||||
"gainModes" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"$ref" : "#/definitions/NamedEnum"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "BladeRF2"
|
||||
|
@ -2250,6 +2256,22 @@ margin-bottom: 20px;
|
|||
}
|
||||
},
|
||||
"description" : "A band of frequencies given its boudaries in Hertz (Hz)"
|
||||
};
|
||||
defs.FrequencyRange = {
|
||||
"properties" : {
|
||||
"min" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"max" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"step" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "An frequency range with 64 bit support for min and max"
|
||||
};
|
||||
defs.Gain = {
|
||||
"properties" : {
|
||||
|
@ -2811,6 +2833,17 @@ margin-bottom: 20px;
|
|||
}
|
||||
},
|
||||
"description" : "NFMMod"
|
||||
};
|
||||
defs.NamedEnum = {
|
||||
"properties" : {
|
||||
"name" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"value" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "Enumeration with name for values"
|
||||
};
|
||||
defs.PerseusReport = {
|
||||
"properties" : {
|
||||
|
@ -23142,7 +23175,7 @@ except ApiException as e:
|
|||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-09-22T10:27:51.856+02:00
|
||||
Generated 2018-09-25T16:51:16.493+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -23,17 +23,20 @@ BladeRF2InputSettings:
|
|||
iqCorrection:
|
||||
type: integer
|
||||
fileRecordName:
|
||||
type: string
|
||||
|
||||
type: string
|
||||
|
||||
BladeRF2InputReport:
|
||||
description: BladeRF2
|
||||
properties:
|
||||
frequencyRange:
|
||||
$ref: "/doc/swagger/include/Structs.yaml#/Range"
|
||||
$ref: "/doc/swagger/include/Structs.yaml#/FrequencyRange"
|
||||
sampleRateRange:
|
||||
$ref: "/doc/swagger/include/Structs.yaml#/Range"
|
||||
bandwidthRange:
|
||||
$ref: "/doc/swagger/include/Structs.yaml#/Range"
|
||||
globalGainRange:
|
||||
$ref: "/doc/swagger/include/Structs.yaml#/Range"
|
||||
|
||||
gainModes:
|
||||
type: array
|
||||
items:
|
||||
$ref: "/doc/swagger/include/Structs.yaml#/NamedEnum"
|
||||
|
|
|
@ -3,19 +3,19 @@ SampleRate:
|
|||
properties:
|
||||
rate:
|
||||
type: integer
|
||||
|
||||
|
||||
Bandwidth:
|
||||
description: A bandwidth expressed in Hertz (Hz)
|
||||
properties:
|
||||
bandwidth:
|
||||
type: integer
|
||||
|
||||
|
||||
Frequency:
|
||||
description: A frequency expressed in Hertz (Hz)
|
||||
properties:
|
||||
frequency:
|
||||
type: integer
|
||||
|
||||
|
||||
FrequencyBand:
|
||||
description: A band of frequencies given its boudaries in Hertz (Hz)
|
||||
properties:
|
||||
|
@ -38,6 +38,26 @@ Range:
|
|||
min:
|
||||
type: integer
|
||||
max:
|
||||
type: integer
|
||||
type: integer
|
||||
step:
|
||||
type: integer
|
||||
type: integer
|
||||
|
||||
FrequencyRange:
|
||||
description: An frequency range with 64 bit support for min and max
|
||||
properties:
|
||||
min:
|
||||
type: integer
|
||||
format: int64
|
||||
max:
|
||||
type: integer
|
||||
format: int64
|
||||
step:
|
||||
type: integer
|
||||
|
||||
NamedEnum:
|
||||
description: Enumeration with name for values
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
value:
|
||||
type: integer
|
||||
|
|
|
@ -23,17 +23,20 @@ BladeRF2InputSettings:
|
|||
iqCorrection:
|
||||
type: integer
|
||||
fileRecordName:
|
||||
type: string
|
||||
|
||||
type: string
|
||||
|
||||
BladeRF2InputReport:
|
||||
description: BladeRF2
|
||||
properties:
|
||||
frequencyRange:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/Range"
|
||||
$ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/FrequencyRange"
|
||||
sampleRateRange:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/Range"
|
||||
bandwidthRange:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/Range"
|
||||
globalGainRange:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/Range"
|
||||
|
||||
gainModes:
|
||||
type: array
|
||||
items:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/NamedEnum"
|
||||
|
|
|
@ -3,19 +3,19 @@ SampleRate:
|
|||
properties:
|
||||
rate:
|
||||
type: integer
|
||||
|
||||
|
||||
Bandwidth:
|
||||
description: A bandwidth expressed in Hertz (Hz)
|
||||
properties:
|
||||
bandwidth:
|
||||
type: integer
|
||||
|
||||
|
||||
Frequency:
|
||||
description: A frequency expressed in Hertz (Hz)
|
||||
properties:
|
||||
frequency:
|
||||
type: integer
|
||||
|
||||
|
||||
FrequencyBand:
|
||||
description: A band of frequencies given its boudaries in Hertz (Hz)
|
||||
properties:
|
||||
|
@ -38,6 +38,26 @@ Range:
|
|||
min:
|
||||
type: integer
|
||||
max:
|
||||
type: integer
|
||||
type: integer
|
||||
step:
|
||||
type: integer
|
||||
type: integer
|
||||
|
||||
FrequencyRange:
|
||||
description: An frequency range with 64 bit support for min and max
|
||||
properties:
|
||||
min:
|
||||
type: integer
|
||||
format: int64
|
||||
max:
|
||||
type: integer
|
||||
format: int64
|
||||
step:
|
||||
type: integer
|
||||
|
||||
NamedEnum:
|
||||
description: Enumeration with name for values
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
value:
|
||||
type: integer
|
||||
|
|
|
@ -1305,7 +1305,7 @@ margin-bottom: 20px;
|
|||
defs.BladeRF2InputReport = {
|
||||
"properties" : {
|
||||
"frequencyRange" : {
|
||||
"$ref" : "#/definitions/Range"
|
||||
"$ref" : "#/definitions/FrequencyRange"
|
||||
},
|
||||
"sampleRateRange" : {
|
||||
"$ref" : "#/definitions/Range"
|
||||
|
@ -1315,6 +1315,12 @@ margin-bottom: 20px;
|
|||
},
|
||||
"globalGainRange" : {
|
||||
"$ref" : "#/definitions/Range"
|
||||
},
|
||||
"gainModes" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"$ref" : "#/definitions/NamedEnum"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "BladeRF2"
|
||||
|
@ -2250,6 +2256,22 @@ margin-bottom: 20px;
|
|||
}
|
||||
},
|
||||
"description" : "A band of frequencies given its boudaries in Hertz (Hz)"
|
||||
};
|
||||
defs.FrequencyRange = {
|
||||
"properties" : {
|
||||
"min" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"max" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"step" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "An frequency range with 64 bit support for min and max"
|
||||
};
|
||||
defs.Gain = {
|
||||
"properties" : {
|
||||
|
@ -2811,6 +2833,17 @@ margin-bottom: 20px;
|
|||
}
|
||||
},
|
||||
"description" : "NFMMod"
|
||||
};
|
||||
defs.NamedEnum = {
|
||||
"properties" : {
|
||||
"name" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"value" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "Enumeration with name for values"
|
||||
};
|
||||
defs.PerseusReport = {
|
||||
"properties" : {
|
||||
|
@ -23142,7 +23175,7 @@ except ApiException as e:
|
|||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-09-22T10:27:51.856+02:00
|
||||
Generated 2018-09-25T16:51:16.493+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -36,6 +36,8 @@ SWGBladeRF2InputReport::SWGBladeRF2InputReport() {
|
|||
m_bandwidth_range_isSet = false;
|
||||
global_gain_range = nullptr;
|
||||
m_global_gain_range_isSet = false;
|
||||
gain_modes = nullptr;
|
||||
m_gain_modes_isSet = false;
|
||||
}
|
||||
|
||||
SWGBladeRF2InputReport::~SWGBladeRF2InputReport() {
|
||||
|
@ -44,7 +46,7 @@ SWGBladeRF2InputReport::~SWGBladeRF2InputReport() {
|
|||
|
||||
void
|
||||
SWGBladeRF2InputReport::init() {
|
||||
frequency_range = new SWGRange();
|
||||
frequency_range = new SWGFrequencyRange();
|
||||
m_frequency_range_isSet = false;
|
||||
sample_rate_range = new SWGRange();
|
||||
m_sample_rate_range_isSet = false;
|
||||
|
@ -52,6 +54,8 @@ SWGBladeRF2InputReport::init() {
|
|||
m_bandwidth_range_isSet = false;
|
||||
global_gain_range = new SWGRange();
|
||||
m_global_gain_range_isSet = false;
|
||||
gain_modes = new QList<SWGNamedEnum*>();
|
||||
m_gain_modes_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,6 +72,13 @@ SWGBladeRF2InputReport::cleanup() {
|
|||
if(global_gain_range != nullptr) {
|
||||
delete global_gain_range;
|
||||
}
|
||||
if(gain_modes != nullptr) {
|
||||
auto arr = gain_modes;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete gain_modes;
|
||||
}
|
||||
}
|
||||
|
||||
SWGBladeRF2InputReport*
|
||||
|
@ -81,7 +92,7 @@ SWGBladeRF2InputReport::fromJson(QString &json) {
|
|||
|
||||
void
|
||||
SWGBladeRF2InputReport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&frequency_range, pJson["frequencyRange"], "SWGRange", "SWGRange");
|
||||
::SWGSDRangel::setValue(&frequency_range, pJson["frequencyRange"], "SWGFrequencyRange", "SWGFrequencyRange");
|
||||
|
||||
::SWGSDRangel::setValue(&sample_rate_range, pJson["sampleRateRange"], "SWGRange", "SWGRange");
|
||||
|
||||
|
@ -89,6 +100,8 @@ SWGBladeRF2InputReport::fromJsonObject(QJsonObject &pJson) {
|
|||
|
||||
::SWGSDRangel::setValue(&global_gain_range, pJson["globalGainRange"], "SWGRange", "SWGRange");
|
||||
|
||||
|
||||
::SWGSDRangel::setValue(&gain_modes, pJson["gainModes"], "QList", "SWGNamedEnum");
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -106,7 +119,7 @@ QJsonObject*
|
|||
SWGBladeRF2InputReport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if((frequency_range != nullptr) && (frequency_range->isSet())){
|
||||
toJsonValue(QString("frequencyRange"), frequency_range, obj, QString("SWGRange"));
|
||||
toJsonValue(QString("frequencyRange"), frequency_range, obj, QString("SWGFrequencyRange"));
|
||||
}
|
||||
if((sample_rate_range != nullptr) && (sample_rate_range->isSet())){
|
||||
toJsonValue(QString("sampleRateRange"), sample_rate_range, obj, QString("SWGRange"));
|
||||
|
@ -117,16 +130,19 @@ SWGBladeRF2InputReport::asJsonObject() {
|
|||
if((global_gain_range != nullptr) && (global_gain_range->isSet())){
|
||||
toJsonValue(QString("globalGainRange"), global_gain_range, obj, QString("SWGRange"));
|
||||
}
|
||||
if(gain_modes->size() > 0){
|
||||
toJsonArray((QList<void*>*)gain_modes, obj, "gainModes", "SWGNamedEnum");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
SWGRange*
|
||||
SWGFrequencyRange*
|
||||
SWGBladeRF2InputReport::getFrequencyRange() {
|
||||
return frequency_range;
|
||||
}
|
||||
void
|
||||
SWGBladeRF2InputReport::setFrequencyRange(SWGRange* frequency_range) {
|
||||
SWGBladeRF2InputReport::setFrequencyRange(SWGFrequencyRange* frequency_range) {
|
||||
this->frequency_range = frequency_range;
|
||||
this->m_frequency_range_isSet = true;
|
||||
}
|
||||
|
@ -161,6 +177,16 @@ SWGBladeRF2InputReport::setGlobalGainRange(SWGRange* global_gain_range) {
|
|||
this->m_global_gain_range_isSet = true;
|
||||
}
|
||||
|
||||
QList<SWGNamedEnum*>*
|
||||
SWGBladeRF2InputReport::getGainModes() {
|
||||
return gain_modes;
|
||||
}
|
||||
void
|
||||
SWGBladeRF2InputReport::setGainModes(QList<SWGNamedEnum*>* gain_modes) {
|
||||
this->gain_modes = gain_modes;
|
||||
this->m_gain_modes_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGBladeRF2InputReport::isSet(){
|
||||
|
@ -170,6 +196,7 @@ SWGBladeRF2InputReport::isSet(){
|
|||
if(sample_rate_range != nullptr && sample_rate_range->isSet()){ isObjectUpdated = true; break;}
|
||||
if(bandwidth_range != nullptr && bandwidth_range->isSet()){ isObjectUpdated = true; break;}
|
||||
if(global_gain_range != nullptr && global_gain_range->isSet()){ isObjectUpdated = true; break;}
|
||||
if(gain_modes->size() > 0){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGFrequencyRange.h"
|
||||
#include "SWGNamedEnum.h"
|
||||
#include "SWGRange.h"
|
||||
#include <QList>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
@ -42,8 +45,8 @@ public:
|
|||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGBladeRF2InputReport* fromJson(QString &jsonString) override;
|
||||
|
||||
SWGRange* getFrequencyRange();
|
||||
void setFrequencyRange(SWGRange* frequency_range);
|
||||
SWGFrequencyRange* getFrequencyRange();
|
||||
void setFrequencyRange(SWGFrequencyRange* frequency_range);
|
||||
|
||||
SWGRange* getSampleRateRange();
|
||||
void setSampleRateRange(SWGRange* sample_rate_range);
|
||||
|
@ -54,11 +57,14 @@ public:
|
|||
SWGRange* getGlobalGainRange();
|
||||
void setGlobalGainRange(SWGRange* global_gain_range);
|
||||
|
||||
QList<SWGNamedEnum*>* getGainModes();
|
||||
void setGainModes(QList<SWGNamedEnum*>* gain_modes);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
SWGRange* frequency_range;
|
||||
SWGFrequencyRange* frequency_range;
|
||||
bool m_frequency_range_isSet;
|
||||
|
||||
SWGRange* sample_rate_range;
|
||||
|
@ -70,6 +76,9 @@ private:
|
|||
SWGRange* global_gain_range;
|
||||
bool m_global_gain_range_isSet;
|
||||
|
||||
QList<SWGNamedEnum*>* gain_modes;
|
||||
bool m_gain_modes_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
* 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. * 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 and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
|
||||
*
|
||||
* OpenAPI spec version: 4.2.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 "SWGFrequencyRange.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGFrequencyRange::SWGFrequencyRange(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGFrequencyRange::SWGFrequencyRange() {
|
||||
min = 0L;
|
||||
m_min_isSet = false;
|
||||
max = 0L;
|
||||
m_max_isSet = false;
|
||||
step = 0;
|
||||
m_step_isSet = false;
|
||||
}
|
||||
|
||||
SWGFrequencyRange::~SWGFrequencyRange() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGFrequencyRange::init() {
|
||||
min = 0L;
|
||||
m_min_isSet = false;
|
||||
max = 0L;
|
||||
m_max_isSet = false;
|
||||
step = 0;
|
||||
m_step_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGFrequencyRange::cleanup() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGFrequencyRange*
|
||||
SWGFrequencyRange::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGFrequencyRange::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&min, pJson["min"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&max, pJson["max"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&step, pJson["step"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGFrequencyRange::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGFrequencyRange::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_min_isSet){
|
||||
obj->insert("min", QJsonValue(min));
|
||||
}
|
||||
if(m_max_isSet){
|
||||
obj->insert("max", QJsonValue(max));
|
||||
}
|
||||
if(m_step_isSet){
|
||||
obj->insert("step", QJsonValue(step));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGFrequencyRange::getMin() {
|
||||
return min;
|
||||
}
|
||||
void
|
||||
SWGFrequencyRange::setMin(qint64 min) {
|
||||
this->min = min;
|
||||
this->m_min_isSet = true;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGFrequencyRange::getMax() {
|
||||
return max;
|
||||
}
|
||||
void
|
||||
SWGFrequencyRange::setMax(qint64 max) {
|
||||
this->max = max;
|
||||
this->m_max_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGFrequencyRange::getStep() {
|
||||
return step;
|
||||
}
|
||||
void
|
||||
SWGFrequencyRange::setStep(qint32 step) {
|
||||
this->step = step;
|
||||
this->m_step_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGFrequencyRange::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_min_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_max_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_step_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* 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. * 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 and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
|
||||
*
|
||||
* OpenAPI spec version: 4.2.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGFrequencyRange.h
|
||||
*
|
||||
* An frequency range with 64 bit support for min and max
|
||||
*/
|
||||
|
||||
#ifndef SWGFrequencyRange_H_
|
||||
#define SWGFrequencyRange_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGFrequencyRange: public SWGObject {
|
||||
public:
|
||||
SWGFrequencyRange();
|
||||
SWGFrequencyRange(QString* json);
|
||||
virtual ~SWGFrequencyRange();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGFrequencyRange* fromJson(QString &jsonString) override;
|
||||
|
||||
qint64 getMin();
|
||||
void setMin(qint64 min);
|
||||
|
||||
qint64 getMax();
|
||||
void setMax(qint64 max);
|
||||
|
||||
qint32 getStep();
|
||||
void setStep(qint32 step);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
qint64 min;
|
||||
bool m_min_isSet;
|
||||
|
||||
qint64 max;
|
||||
bool m_max_isSet;
|
||||
|
||||
qint32 step;
|
||||
bool m_step_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGFrequencyRange_H_ */
|
|
@ -60,6 +60,7 @@
|
|||
#include "SWGFileSourceSettings.h"
|
||||
#include "SWGFrequency.h"
|
||||
#include "SWGFrequencyBand.h"
|
||||
#include "SWGFrequencyRange.h"
|
||||
#include "SWGGain.h"
|
||||
#include "SWGHackRFInputSettings.h"
|
||||
#include "SWGHackRFOutputSettings.h"
|
||||
|
@ -76,6 +77,7 @@
|
|||
#include "SWGNFMDemodSettings.h"
|
||||
#include "SWGNFMModReport.h"
|
||||
#include "SWGNFMModSettings.h"
|
||||
#include "SWGNamedEnum.h"
|
||||
#include "SWGPerseusReport.h"
|
||||
#include "SWGPerseusSettings.h"
|
||||
#include "SWGPlutoSdrInputReport.h"
|
||||
|
@ -258,6 +260,9 @@ namespace SWGSDRangel {
|
|||
if(QString("SWGFrequencyBand").compare(type) == 0) {
|
||||
return new SWGFrequencyBand();
|
||||
}
|
||||
if(QString("SWGFrequencyRange").compare(type) == 0) {
|
||||
return new SWGFrequencyRange();
|
||||
}
|
||||
if(QString("SWGGain").compare(type) == 0) {
|
||||
return new SWGGain();
|
||||
}
|
||||
|
@ -306,6 +311,9 @@ namespace SWGSDRangel {
|
|||
if(QString("SWGNFMModSettings").compare(type) == 0) {
|
||||
return new SWGNFMModSettings();
|
||||
}
|
||||
if(QString("SWGNamedEnum").compare(type) == 0) {
|
||||
return new SWGNamedEnum();
|
||||
}
|
||||
if(QString("SWGPerseusReport").compare(type) == 0) {
|
||||
return new SWGPerseusReport();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/**
|
||||
* 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. * 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 and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
|
||||
*
|
||||
* OpenAPI spec version: 4.2.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 "SWGNamedEnum.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGNamedEnum::SWGNamedEnum(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGNamedEnum::SWGNamedEnum() {
|
||||
name = nullptr;
|
||||
m_name_isSet = false;
|
||||
value = 0;
|
||||
m_value_isSet = false;
|
||||
}
|
||||
|
||||
SWGNamedEnum::~SWGNamedEnum() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGNamedEnum::init() {
|
||||
name = new QString("");
|
||||
m_name_isSet = false;
|
||||
value = 0;
|
||||
m_value_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGNamedEnum::cleanup() {
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWGNamedEnum*
|
||||
SWGNamedEnum::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGNamedEnum::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&value, pJson["value"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGNamedEnum::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGNamedEnum::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(name != nullptr && *name != QString("")){
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
}
|
||||
if(m_value_isSet){
|
||||
obj->insert("value", QJsonValue(value));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGNamedEnum::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
SWGNamedEnum::setName(QString* name) {
|
||||
this->name = name;
|
||||
this->m_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGNamedEnum::getValue() {
|
||||
return value;
|
||||
}
|
||||
void
|
||||
SWGNamedEnum::setValue(qint32 value) {
|
||||
this->value = value;
|
||||
this->m_value_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGNamedEnum::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_value_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* 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. * 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 and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
|
||||
*
|
||||
* OpenAPI spec version: 4.2.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGNamedEnum.h
|
||||
*
|
||||
* Enumeration with name for values
|
||||
*/
|
||||
|
||||
#ifndef SWGNamedEnum_H_
|
||||
#define SWGNamedEnum_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGNamedEnum: public SWGObject {
|
||||
public:
|
||||
SWGNamedEnum();
|
||||
SWGNamedEnum(QString* json);
|
||||
virtual ~SWGNamedEnum();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGNamedEnum* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
qint32 getValue();
|
||||
void setValue(qint32 value);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* name;
|
||||
bool m_name_isSet;
|
||||
|
||||
qint32 value;
|
||||
bool m_value_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGNamedEnum_H_ */
|
Ładowanie…
Reference in New Issue