mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-21 19:09:22 -04:00
Web API: AirspyHF device report
This commit is contained in:
parent
7767d538f6
commit
30cca07554
plugins/samplesource
sdrbase/resources/webapi/doc
swagger/sdrangel
api/swagger
code
@ -742,7 +742,6 @@ void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
|
||||
|
||||
void AirspyInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
||||
{
|
||||
response.setAirspyReport(new SWGSDRangel::SWGAirspyReport());
|
||||
response.getAirspyReport()->setSampleRates(new QList<SWGSDRangel::SWGAirspyReport_sampleRates*>);
|
||||
|
||||
for (std::vector<uint32_t>::const_iterator it = getSampleRates().begin(); it != getSampleRates().end(); ++it)
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGAirspyHFReport.h"
|
||||
|
||||
#include <device/devicesourceapi.h>
|
||||
#include <dsp/filerecord.h>
|
||||
@ -561,6 +563,27 @@ void AirspyHFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
|
||||
}
|
||||
}
|
||||
|
||||
void AirspyHFInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
||||
{
|
||||
response.getAirspyHfReport()->setSampleRates(new QList<SWGSDRangel::SWGAirspyReport_sampleRates*>);
|
||||
|
||||
for (std::vector<uint32_t>::const_iterator it = getSampleRates().begin(); it != getSampleRates().end(); ++it)
|
||||
{
|
||||
response.getAirspyHfReport()->getSampleRates()->append(new SWGSDRangel::SWGAirspyReport_sampleRates);
|
||||
response.getAirspyHfReport()->getSampleRates()->back()->setSampleRate(*it);
|
||||
}
|
||||
}
|
||||
|
||||
int AirspyHFInput::webapiReportGet(
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setAirspyHfReport(new SWGSDRangel::SWGAirspyHFReport());
|
||||
response.getAirspyHfReport()->init();
|
||||
webapiFormatDeviceReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int AirspyHFInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
|
@ -122,6 +122,10 @@ public:
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
@ -143,6 +147,7 @@ private:
|
||||
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
||||
void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
|
@ -911,6 +911,17 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "ATVMod"
|
||||
};
|
||||
defs.AirspyHFReport = {
|
||||
"properties" : {
|
||||
"sampleRates" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"$ref" : "#/definitions/AirspyReport_sampleRates"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "AirspyHF"
|
||||
};
|
||||
defs.AirspyHFSettings = {
|
||||
"properties" : {
|
||||
@ -1697,6 +1708,9 @@ margin-bottom: 20px;
|
||||
},
|
||||
"airspyReport" : {
|
||||
"$ref" : "#/definitions/AirspyReport"
|
||||
},
|
||||
"airspyHFReport" : {
|
||||
"$ref" : "#/definitions/AirspyHFReport"
|
||||
}
|
||||
},
|
||||
"description" : "Base device report. The specific device report present depeds on deviceHwType"
|
||||
@ -21681,7 +21695,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-05-26T00:44:20.967+02:00
|
||||
Generated 2018-05-26T02:22:55.108+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,4 +19,16 @@ AirspyHFSettings:
|
||||
type: integer
|
||||
fileRecordName:
|
||||
type: string
|
||||
|
||||
|
||||
AirspyHFReport:
|
||||
description: AirspyHF
|
||||
properties:
|
||||
sampleRates:
|
||||
type: array
|
||||
items:
|
||||
properties:
|
||||
sampleRate:
|
||||
description: sample rate in S/s
|
||||
type: integer
|
||||
|
||||
|
@ -1781,6 +1781,8 @@ definitions:
|
||||
type: integer
|
||||
airspyReport:
|
||||
$ref: "/doc/swagger/include/Airspy.yaml#/AirspyReport"
|
||||
airspyHFReport:
|
||||
$ref: "/doc/swagger/include/AirspyHF.yaml#/AirspyHFReport"
|
||||
|
||||
ChannelSettings:
|
||||
description: Base channel settings. The specific channel settings present depends on channelType.
|
||||
|
@ -19,4 +19,16 @@ AirspyHFSettings:
|
||||
type: integer
|
||||
fileRecordName:
|
||||
type: string
|
||||
|
||||
|
||||
AirspyHFReport:
|
||||
description: AirspyHF
|
||||
properties:
|
||||
sampleRates:
|
||||
type: array
|
||||
items:
|
||||
properties:
|
||||
sampleRate:
|
||||
description: sample rate in S/s
|
||||
type: integer
|
||||
|
||||
|
@ -1781,6 +1781,8 @@ definitions:
|
||||
type: integer
|
||||
airspyReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Airspy.yaml#/AirspyReport"
|
||||
airspyHFReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/AirspyHF.yaml#/AirspyHFReport"
|
||||
|
||||
ChannelSettings:
|
||||
description: Base channel settings. The specific channel settings present depends on channelType.
|
||||
|
@ -911,6 +911,17 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "ATVMod"
|
||||
};
|
||||
defs.AirspyHFReport = {
|
||||
"properties" : {
|
||||
"sampleRates" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"$ref" : "#/definitions/AirspyReport_sampleRates"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "AirspyHF"
|
||||
};
|
||||
defs.AirspyHFSettings = {
|
||||
"properties" : {
|
||||
@ -1697,6 +1708,9 @@ margin-bottom: 20px;
|
||||
},
|
||||
"airspyReport" : {
|
||||
"$ref" : "#/definitions/AirspyReport"
|
||||
},
|
||||
"airspyHFReport" : {
|
||||
"$ref" : "#/definitions/AirspyHFReport"
|
||||
}
|
||||
},
|
||||
"description" : "Base device report. The specific device report present depeds on deviceHwType"
|
||||
@ -21681,7 +21695,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-05-26T00:44:20.967+02:00
|
||||
Generated 2018-05-26T02:22:55.108+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
112
swagger/sdrangel/code/qt5/client/SWGAirspyHFReport.cpp
Normal file
112
swagger/sdrangel/code/qt5/client/SWGAirspyHFReport.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* SDRangel
|
||||
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
|
||||
*
|
||||
* OpenAPI spec version: 4.0.0
|
||||
* Contact: f4exb06@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
#include "SWGAirspyHFReport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGAirspyHFReport::SWGAirspyHFReport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGAirspyHFReport::SWGAirspyHFReport() {
|
||||
sample_rates = nullptr;
|
||||
m_sample_rates_isSet = false;
|
||||
}
|
||||
|
||||
SWGAirspyHFReport::~SWGAirspyHFReport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGAirspyHFReport::init() {
|
||||
sample_rates = new QList<SWGAirspyReport_sampleRates*>();
|
||||
m_sample_rates_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGAirspyHFReport::cleanup() {
|
||||
if(sample_rates != nullptr) {
|
||||
auto arr = sample_rates;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete sample_rates;
|
||||
}
|
||||
}
|
||||
|
||||
SWGAirspyHFReport*
|
||||
SWGAirspyHFReport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGAirspyHFReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&sample_rates, pJson["sampleRates"], "QList", "SWGAirspyReport_sampleRates");
|
||||
}
|
||||
|
||||
QString
|
||||
SWGAirspyHFReport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGAirspyHFReport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(sample_rates->size() > 0){
|
||||
toJsonArray((QList<void*>*)sample_rates, obj, "sampleRates", "SWGAirspyReport_sampleRates");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QList<SWGAirspyReport_sampleRates*>*
|
||||
SWGAirspyHFReport::getSampleRates() {
|
||||
return sample_rates;
|
||||
}
|
||||
void
|
||||
SWGAirspyHFReport::setSampleRates(QList<SWGAirspyReport_sampleRates*>* sample_rates) {
|
||||
this->sample_rates = sample_rates;
|
||||
this->m_sample_rates_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGAirspyHFReport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(sample_rates->size() > 0){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
60
swagger/sdrangel/code/qt5/client/SWGAirspyHFReport.h
Normal file
60
swagger/sdrangel/code/qt5/client/SWGAirspyHFReport.h
Normal file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* SDRangel
|
||||
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
|
||||
*
|
||||
* OpenAPI spec version: 4.0.0
|
||||
* Contact: f4exb06@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGAirspyHFReport.h
|
||||
*
|
||||
* AirspyHF
|
||||
*/
|
||||
|
||||
#ifndef SWGAirspyHFReport_H_
|
||||
#define SWGAirspyHFReport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGAirspyReport_sampleRates.h"
|
||||
#include <QList>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGAirspyHFReport: public SWGObject {
|
||||
public:
|
||||
SWGAirspyHFReport();
|
||||
SWGAirspyHFReport(QString* json);
|
||||
virtual ~SWGAirspyHFReport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGAirspyHFReport* fromJson(QString &jsonString) override;
|
||||
|
||||
QList<SWGAirspyReport_sampleRates*>* getSampleRates();
|
||||
void setSampleRates(QList<SWGAirspyReport_sampleRates*>* sample_rates);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QList<SWGAirspyReport_sampleRates*>* sample_rates;
|
||||
bool m_sample_rates_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGAirspyHFReport_H_ */
|
@ -34,6 +34,8 @@ SWGDeviceReport::SWGDeviceReport() {
|
||||
m_tx_isSet = false;
|
||||
airspy_report = nullptr;
|
||||
m_airspy_report_isSet = false;
|
||||
airspy_hf_report = nullptr;
|
||||
m_airspy_hf_report_isSet = false;
|
||||
}
|
||||
|
||||
SWGDeviceReport::~SWGDeviceReport() {
|
||||
@ -48,6 +50,8 @@ SWGDeviceReport::init() {
|
||||
m_tx_isSet = false;
|
||||
airspy_report = new SWGAirspyReport();
|
||||
m_airspy_report_isSet = false;
|
||||
airspy_hf_report = new SWGAirspyHFReport();
|
||||
m_airspy_hf_report_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -59,6 +63,9 @@ SWGDeviceReport::cleanup() {
|
||||
if(airspy_report != nullptr) {
|
||||
delete airspy_report;
|
||||
}
|
||||
if(airspy_hf_report != nullptr) {
|
||||
delete airspy_hf_report;
|
||||
}
|
||||
}
|
||||
|
||||
SWGDeviceReport*
|
||||
@ -78,6 +85,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&airspy_report, pJson["airspyReport"], "SWGAirspyReport", "SWGAirspyReport");
|
||||
|
||||
::SWGSDRangel::setValue(&airspy_hf_report, pJson["airspyHFReport"], "SWGAirspyHFReport", "SWGAirspyHFReport");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -103,6 +112,9 @@ SWGDeviceReport::asJsonObject() {
|
||||
if((airspy_report != nullptr) && (airspy_report->isSet())){
|
||||
toJsonValue(QString("airspyReport"), airspy_report, obj, QString("SWGAirspyReport"));
|
||||
}
|
||||
if((airspy_hf_report != nullptr) && (airspy_hf_report->isSet())){
|
||||
toJsonValue(QString("airspyHFReport"), airspy_hf_report, obj, QString("SWGAirspyHFReport"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -137,6 +149,16 @@ SWGDeviceReport::setAirspyReport(SWGAirspyReport* airspy_report) {
|
||||
this->m_airspy_report_isSet = true;
|
||||
}
|
||||
|
||||
SWGAirspyHFReport*
|
||||
SWGDeviceReport::getAirspyHfReport() {
|
||||
return airspy_hf_report;
|
||||
}
|
||||
void
|
||||
SWGDeviceReport::setAirspyHfReport(SWGAirspyHFReport* airspy_hf_report) {
|
||||
this->airspy_hf_report = airspy_hf_report;
|
||||
this->m_airspy_hf_report_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGDeviceReport::isSet(){
|
||||
@ -145,6 +167,7 @@ SWGDeviceReport::isSet(){
|
||||
if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_tx_isSet){ isObjectUpdated = true; break;}
|
||||
if(airspy_report != nullptr && airspy_report->isSet()){ isObjectUpdated = true; break;}
|
||||
if(airspy_hf_report != nullptr && airspy_hf_report->isSet()){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGAirspyHFReport.h"
|
||||
#include "SWGAirspyReport.h"
|
||||
#include <QString>
|
||||
|
||||
@ -52,6 +53,9 @@ public:
|
||||
SWGAirspyReport* getAirspyReport();
|
||||
void setAirspyReport(SWGAirspyReport* airspy_report);
|
||||
|
||||
SWGAirspyHFReport* getAirspyHfReport();
|
||||
void setAirspyHfReport(SWGAirspyHFReport* airspy_hf_report);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -65,6 +69,9 @@ private:
|
||||
SWGAirspyReport* airspy_report;
|
||||
bool m_airspy_report_isSet;
|
||||
|
||||
SWGAirspyHFReport* airspy_hf_report;
|
||||
bool m_airspy_hf_report_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "SWGAMModSettings.h"
|
||||
#include "SWGATVModReport.h"
|
||||
#include "SWGATVModSettings.h"
|
||||
#include "SWGAirspyHFReport.h"
|
||||
#include "SWGAirspyHFSettings.h"
|
||||
#include "SWGAirspyReport.h"
|
||||
#include "SWGAirspyReport_sampleRates.h"
|
||||
@ -106,6 +107,9 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGATVModSettings").compare(type) == 0) {
|
||||
return new SWGATVModSettings();
|
||||
}
|
||||
if(QString("SWGAirspyHFReport").compare(type) == 0) {
|
||||
return new SWGAirspyHFReport();
|
||||
}
|
||||
if(QString("SWGAirspyHFSettings").compare(type) == 0) {
|
||||
return new SWGAirspyHFSettings();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user