mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
AMBE feature: report frames decoding successes and failures
This commit is contained in:
parent
100ca3510c
commit
c4cb135177
@ -347,20 +347,16 @@ void AMBE::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response)
|
|||||||
|
|
||||||
// devices
|
// devices
|
||||||
|
|
||||||
SWGSDRangel::SWGAMBEDevices *swgAMBEDevices = response.getAmbeReport()->getDevices();
|
response.getAmbeReport()->setDevices(new QList<SWGSDRangel::SWGAMBEDeviceReport*>);
|
||||||
swgAMBEDevices->init();
|
QList<AMBEEngine::DeviceRef> deviceRefs;
|
||||||
|
getAMBEEngine()->getDeviceRefs(deviceRefs);
|
||||||
|
|
||||||
qDeviceNames.clear();
|
for (auto& deviceRef : deviceRefs)
|
||||||
getAMBEEngine()->getDeviceRefs(qDeviceNames);
|
|
||||||
swgAMBEDevices->setNbDevices((int) qDeviceNames.size());
|
|
||||||
QList<SWGSDRangel::SWGAMBEDevice*> *ambeDeviceNamesList = swgAMBEDevices->getAmbeDevices();
|
|
||||||
|
|
||||||
for (const auto& deviceName : qDeviceNames)
|
|
||||||
{
|
{
|
||||||
ambeDeviceNamesList->append(new SWGSDRangel::SWGAMBEDevice);
|
response.getAmbeReport()->getDevices()->append(new SWGSDRangel::SWGAMBEDeviceReport);
|
||||||
ambeDeviceNamesList->back()->init();
|
response.getAmbeReport()->getDevices()->back()->setDevicePath(new QString(deviceRef.m_devicePath));
|
||||||
*ambeDeviceNamesList->back()->getDeviceRef() = deviceName;
|
response.getAmbeReport()->getDevices()->back()->setSuccessCount(deviceRef.m_successCount);
|
||||||
ambeDeviceNamesList->back()->setDelete(0);
|
response.getAmbeReport()->getDevices()->back()->setFailureCount(deviceRef.m_failureCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QList<QString>& getAvailableDevices() { return m_availableDevices; }
|
QList<QString>& getAvailableDevices() { return m_availableDevices; }
|
||||||
QList<QString>& getUsedDevices() { return m_usedDevices; }
|
QList<AMBEEngine::DeviceRef>& getUsedDevices() { return m_usedDevices; }
|
||||||
|
|
||||||
static MsgReportDevices* create() {
|
static MsgReportDevices* create() {
|
||||||
return new MsgReportDevices();
|
return new MsgReportDevices();
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QString> m_availableDevices;
|
QList<QString> m_availableDevices;
|
||||||
QList<QString> m_usedDevices;
|
QList<AMBEEngine::DeviceRef> m_usedDevices;
|
||||||
|
|
||||||
MsgReportDevices() :
|
MsgReportDevices() :
|
||||||
Message()
|
Message()
|
||||||
|
@ -43,6 +43,16 @@
|
|||||||
#include "ambeworker.h"
|
#include "ambeworker.h"
|
||||||
#include "ambeengine.h"
|
#include "ambeengine.h"
|
||||||
|
|
||||||
|
uint32_t AMBEEngine::AMBEController::getSuccessCount() const
|
||||||
|
{
|
||||||
|
return worker ? worker->getSuccessCount() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AMBEEngine::AMBEController::getFailureCount() const
|
||||||
|
{
|
||||||
|
return worker ? worker->getFailureCount() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
AMBEEngine::AMBEEngine()
|
AMBEEngine::AMBEEngine()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -291,13 +301,13 @@ void AMBEEngine::releaseAll()
|
|||||||
m_controllers.clear();
|
m_controllers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMBEEngine::getDeviceRefs(QList<QString>& deviceNames)
|
void AMBEEngine::getDeviceRefs(QList<DeviceRef>& deviceRefs)
|
||||||
{
|
{
|
||||||
std::vector<AMBEController>::const_iterator it = m_controllers.begin();
|
std::vector<AMBEController>::const_iterator it = m_controllers.begin();
|
||||||
|
|
||||||
while (it != m_controllers.end())
|
while (it != m_controllers.end())
|
||||||
{
|
{
|
||||||
deviceNames.push_back(QString(it->device.c_str()));
|
deviceRefs.push_back(DeviceRef{QString(it->device.c_str()), it->getSuccessCount(), it->getFailureCount()});
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,13 @@ class AMBEEngine : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
struct DeviceRef
|
||||||
|
{
|
||||||
|
QString m_devicePath; //!< device path or url
|
||||||
|
uint32_t m_successCount; //!< number of frames successfully decoded
|
||||||
|
uint32_t m_failureCount; //!< number of frames failing decoding
|
||||||
|
};
|
||||||
|
|
||||||
AMBEEngine();
|
AMBEEngine();
|
||||||
~AMBEEngine();
|
~AMBEEngine();
|
||||||
|
|
||||||
@ -43,7 +50,7 @@ public:
|
|||||||
void releaseAll();
|
void releaseAll();
|
||||||
|
|
||||||
int getNbDevices() const { return m_controllers.size(); } //!< number of devices used
|
int getNbDevices() const { return m_controllers.size(); } //!< number of devices used
|
||||||
void getDeviceRefs(QList<QString>& devicesRefs); //!< reference of the devices used (device path or url)
|
void getDeviceRefs(QList<DeviceRef>& devicesRefs); //!< reference of the devices used
|
||||||
bool registerController(const std::string& deviceRef); //!< create a new controller for the device in reference
|
bool registerController(const std::string& deviceRef); //!< create a new controller for the device in reference
|
||||||
void releaseController(const std::string& deviceRef); //!< release controller resources for the device in reference
|
void releaseController(const std::string& deviceRef); //!< release controller resources for the device in reference
|
||||||
|
|
||||||
@ -67,6 +74,9 @@ private:
|
|||||||
QThread *thread;
|
QThread *thread;
|
||||||
AMBEWorker *worker;
|
AMBEWorker *worker;
|
||||||
std::string device;
|
std::string device;
|
||||||
|
|
||||||
|
uint32_t getSuccessCount() const;
|
||||||
|
uint32_t getFailureCount() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -192,7 +192,12 @@ bool AMBEGUI::handleMessage(const Message& message)
|
|||||||
ui->ambeDeviceRefs->clear();
|
ui->ambeDeviceRefs->clear();
|
||||||
|
|
||||||
for (const auto& inUseDevice : cfg.getUsedDevices()) {
|
for (const auto& inUseDevice : cfg.getUsedDevices()) {
|
||||||
ui->ambeDeviceRefs->addItem(inUseDevice);
|
ui->ambeDeviceRefs->addItem(
|
||||||
|
tr("%1 - %2|%3")
|
||||||
|
.arg(inUseDevice.m_devicePath)
|
||||||
|
.arg(inUseDevice.m_successCount)
|
||||||
|
.arg(inUseDevice.m_failureCount)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -226,14 +231,19 @@ void AMBEGUI::populateSerialList()
|
|||||||
|
|
||||||
void AMBEGUI::refreshInUseList()
|
void AMBEGUI::refreshInUseList()
|
||||||
{
|
{
|
||||||
QList<QString> inUseDevices;
|
QList<AMBEEngine::DeviceRef> inUseDevices;
|
||||||
m_ambe->getAMBEEngine()->getDeviceRefs(inUseDevices);
|
m_ambe->getAMBEEngine()->getDeviceRefs(inUseDevices);
|
||||||
ui->ambeDeviceRefs->clear();
|
ui->ambeDeviceRefs->clear();
|
||||||
|
|
||||||
for (const auto& inUseDevice : inUseDevices)
|
for (const auto& inUseDevice : inUseDevices)
|
||||||
{
|
{
|
||||||
qDebug("AMBEGUI::refreshInUseList: %s", qPrintable(inUseDevice));
|
qDebug("AMBEGUI::refreshInUseList: %s", qPrintable(inUseDevice.m_devicePath));
|
||||||
ui->ambeDeviceRefs->addItem(inUseDevice);
|
ui->ambeDeviceRefs->addItem(
|
||||||
|
tr("%1 - %2|%3")
|
||||||
|
.arg(inUseDevice.m_devicePath)
|
||||||
|
.arg(inUseDevice.m_successCount)
|
||||||
|
.arg(inUseDevice.m_failureCount)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void AMBEGUI::on_importSerial_clicked()
|
void AMBEGUI::on_importSerial_clicked()
|
||||||
@ -253,7 +263,7 @@ void AMBEGUI::on_importSerial_clicked()
|
|||||||
{
|
{
|
||||||
if (m_ambe->getAMBEEngine()->registerController(serialName.toStdString()))
|
if (m_ambe->getAMBEEngine()->registerController(serialName.toStdString()))
|
||||||
{
|
{
|
||||||
ui->ambeDeviceRefs->addItem(serialName);
|
ui->ambeDeviceRefs->addItem(tr("%1 - 0|0").arg(serialName));
|
||||||
ui->statusText->setText(tr("%1 added").arg(serialName));
|
ui->statusText->setText(tr("%1 added").arg(serialName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -300,7 +310,7 @@ void AMBEGUI::on_removeAmbeDevice_clicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString deviceName = deviceItem->text();
|
QString deviceName = deviceItem->text().split(" ").at(0);
|
||||||
m_ambe->getAMBEEngine()->releaseController(deviceName.toStdString());
|
m_ambe->getAMBEEngine()->releaseController(deviceName.toStdString());
|
||||||
ui->statusText->setText(tr("%1 removed").arg(deviceName));
|
ui->statusText->setText(tr("%1 removed").arg(deviceName));
|
||||||
refreshInUseList();
|
refreshInUseList();
|
||||||
|
@ -33,7 +33,9 @@ AMBEWorker::AMBEWorker() :
|
|||||||
m_upsamplerLastValue(0.0f),
|
m_upsamplerLastValue(0.0f),
|
||||||
m_phase(0),
|
m_phase(0),
|
||||||
m_upsampling(1),
|
m_upsampling(1),
|
||||||
m_volume(1.0f)
|
m_volume(1.0f),
|
||||||
|
m_successCount(0),
|
||||||
|
m_failureCount(0)
|
||||||
{
|
{
|
||||||
m_audioBuffer.resize(48000);
|
m_audioBuffer.resize(48000);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
@ -119,10 +121,13 @@ void AMBEWorker::handleInputMessages()
|
|||||||
|
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_successCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("AMBEWorker::handleInputMessages: MsgMbeDecode: decode failed");
|
qDebug("AMBEWorker::handleInputMessages: MsgMbeDecode: decode failed");
|
||||||
|
m_failureCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +115,8 @@ public:
|
|||||||
void stop();
|
void stop();
|
||||||
bool isAvailable();
|
bool isAvailable();
|
||||||
bool hasFifo(AudioFifo *audioFifo);
|
bool hasFifo(AudioFifo *audioFifo);
|
||||||
|
uint32_t getSuccessCount() const { return m_successCount; }
|
||||||
|
uint32_t getFailureCount() const { return m_failureCount; }
|
||||||
|
|
||||||
void postTest()
|
void postTest()
|
||||||
{
|
{
|
||||||
@ -151,6 +153,8 @@ private:
|
|||||||
float m_volume;
|
float m_volume;
|
||||||
float m_upsamplingFactors[7];
|
float m_upsamplingFactors[7];
|
||||||
AudioCompressor m_compressor;
|
AudioCompressor m_compressor;
|
||||||
|
uint32_t m_successCount;
|
||||||
|
uint32_t m_failureCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SDRBASE_AMBE_AMBEWORKER_H_
|
#endif // SDRBASE_AMBE_AMBEWORKER_H_
|
||||||
|
@ -1274,6 +1274,23 @@ margin-bottom: 20px;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "AMBE devices active in the system"
|
"description" : "AMBE devices active in the system"
|
||||||
|
};
|
||||||
|
defs.AMBEDeviceReport = {
|
||||||
|
"properties" : {
|
||||||
|
"devicePath" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "AMBE device full path or AMBE server URL"
|
||||||
|
},
|
||||||
|
"successCount" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "number of frames decoded successfully"
|
||||||
|
},
|
||||||
|
"failureCount" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "number of frames that failed to decode"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Report of AMBE device in use"
|
||||||
};
|
};
|
||||||
defs.AMBEDevices = {
|
defs.AMBEDevices = {
|
||||||
"required" : [ "nbDevices" ],
|
"required" : [ "nbDevices" ],
|
||||||
@ -1299,8 +1316,11 @@ margin-bottom: 20px;
|
|||||||
"$ref" : "#/definitions/DVSerialDevices"
|
"$ref" : "#/definitions/DVSerialDevices"
|
||||||
},
|
},
|
||||||
"devices" : {
|
"devices" : {
|
||||||
|
"type" : "array",
|
||||||
"description" : "List of AMBE devices or servers in use",
|
"description" : "List of AMBE devices or servers in use",
|
||||||
"$ref" : "#/definitions/AMBEDevices"
|
"items" : {
|
||||||
|
"$ref" : "#/definitions/AMBEDeviceReport"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "AMBE"
|
"description" : "AMBE"
|
||||||
@ -56040,7 +56060,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2022-05-24T23:13:14.725+02:00
|
Generated 2022-05-25T12:47:57.273+02:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,9 @@ AMBEReport:
|
|||||||
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/DVSerialDevices"
|
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/DVSerialDevices"
|
||||||
devices:
|
devices:
|
||||||
description: List of AMBE devices or servers in use
|
description: List of AMBE devices or servers in use
|
||||||
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/AMBEDevices"
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/AMBEDeviceReport"
|
||||||
|
|
||||||
AMBEActions:
|
AMBEActions:
|
||||||
description: AMBE
|
description: AMBE
|
||||||
@ -86,3 +88,16 @@ definitions:
|
|||||||
delete:
|
delete:
|
||||||
description: "1 if device is to be removed from active list"
|
description: "1 if device is to be removed from active list"
|
||||||
type: integer
|
type: integer
|
||||||
|
|
||||||
|
AMBEDeviceReport:
|
||||||
|
description: "Report of AMBE device in use"
|
||||||
|
properties:
|
||||||
|
devicePath:
|
||||||
|
type: string
|
||||||
|
description: AMBE device full path or AMBE server URL
|
||||||
|
successCount:
|
||||||
|
type: integer
|
||||||
|
description: number of frames decoded successfully
|
||||||
|
failureCount:
|
||||||
|
type: integer
|
||||||
|
description: number of frames that failed to decode
|
||||||
|
@ -27,7 +27,9 @@ AMBEReport:
|
|||||||
$ref: "http://swgserver:8081/api/swagger/include/AMBE.yaml#/definitions/DVSerialDevices"
|
$ref: "http://swgserver:8081/api/swagger/include/AMBE.yaml#/definitions/DVSerialDevices"
|
||||||
devices:
|
devices:
|
||||||
description: List of AMBE devices or servers in use
|
description: List of AMBE devices or servers in use
|
||||||
$ref: "http://swgserver:8081/api/swagger/include/AMBE.yaml#/definitions/AMBEDevices"
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "http://swgserver:8081/api/swagger/include/AMBE.yaml#/definitions/AMBEDeviceReport"
|
||||||
|
|
||||||
AMBEActions:
|
AMBEActions:
|
||||||
description: AMBE
|
description: AMBE
|
||||||
@ -86,3 +88,16 @@ definitions:
|
|||||||
delete:
|
delete:
|
||||||
description: "1 if device is to be removed from active list"
|
description: "1 if device is to be removed from active list"
|
||||||
type: integer
|
type: integer
|
||||||
|
|
||||||
|
AMBEDeviceReport:
|
||||||
|
description: "Report of AMBE device in use"
|
||||||
|
properties:
|
||||||
|
devicePath:
|
||||||
|
type: string
|
||||||
|
description: AMBE device full path or AMBE server URL
|
||||||
|
successCount:
|
||||||
|
type: integer
|
||||||
|
description: number of frames decoded successfully
|
||||||
|
failureCount:
|
||||||
|
type: integer
|
||||||
|
description: number of frames that failed to decode
|
||||||
|
@ -1274,6 +1274,23 @@ margin-bottom: 20px;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "AMBE devices active in the system"
|
"description" : "AMBE devices active in the system"
|
||||||
|
};
|
||||||
|
defs.AMBEDeviceReport = {
|
||||||
|
"properties" : {
|
||||||
|
"devicePath" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "AMBE device full path or AMBE server URL"
|
||||||
|
},
|
||||||
|
"successCount" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "number of frames decoded successfully"
|
||||||
|
},
|
||||||
|
"failureCount" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "number of frames that failed to decode"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Report of AMBE device in use"
|
||||||
};
|
};
|
||||||
defs.AMBEDevices = {
|
defs.AMBEDevices = {
|
||||||
"required" : [ "nbDevices" ],
|
"required" : [ "nbDevices" ],
|
||||||
@ -1299,8 +1316,11 @@ margin-bottom: 20px;
|
|||||||
"$ref" : "#/definitions/DVSerialDevices"
|
"$ref" : "#/definitions/DVSerialDevices"
|
||||||
},
|
},
|
||||||
"devices" : {
|
"devices" : {
|
||||||
|
"type" : "array",
|
||||||
"description" : "List of AMBE devices or servers in use",
|
"description" : "List of AMBE devices or servers in use",
|
||||||
"$ref" : "#/definitions/AMBEDevices"
|
"items" : {
|
||||||
|
"$ref" : "#/definitions/AMBEDeviceReport"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "AMBE"
|
"description" : "AMBE"
|
||||||
@ -56040,7 +56060,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2022-05-24T23:13:14.725+02:00
|
Generated 2022-05-25T12:47:57.273+02:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
156
swagger/sdrangel/code/qt5/client/SWGAMBEDeviceReport.cpp
Normal file
156
swagger/sdrangel/code/qt5/client/SWGAMBEDeviceReport.cpp
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
/**
|
||||||
|
* 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: 7.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 "SWGAMBEDeviceReport.h"
|
||||||
|
|
||||||
|
#include "SWGHelpers.h"
|
||||||
|
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
namespace SWGSDRangel {
|
||||||
|
|
||||||
|
SWGAMBEDeviceReport::SWGAMBEDeviceReport(QString* json) {
|
||||||
|
init();
|
||||||
|
this->fromJson(*json);
|
||||||
|
}
|
||||||
|
|
||||||
|
SWGAMBEDeviceReport::SWGAMBEDeviceReport() {
|
||||||
|
device_path = nullptr;
|
||||||
|
m_device_path_isSet = false;
|
||||||
|
success_count = 0;
|
||||||
|
m_success_count_isSet = false;
|
||||||
|
failure_count = 0;
|
||||||
|
m_failure_count_isSet = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWGAMBEDeviceReport::~SWGAMBEDeviceReport() {
|
||||||
|
this->cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SWGAMBEDeviceReport::init() {
|
||||||
|
device_path = new QString("");
|
||||||
|
m_device_path_isSet = false;
|
||||||
|
success_count = 0;
|
||||||
|
m_success_count_isSet = false;
|
||||||
|
failure_count = 0;
|
||||||
|
m_failure_count_isSet = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SWGAMBEDeviceReport::cleanup() {
|
||||||
|
if(device_path != nullptr) {
|
||||||
|
delete device_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SWGAMBEDeviceReport*
|
||||||
|
SWGAMBEDeviceReport::fromJson(QString &json) {
|
||||||
|
QByteArray array (json.toStdString().c_str());
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
|
QJsonObject jsonObject = doc.object();
|
||||||
|
this->fromJsonObject(jsonObject);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SWGAMBEDeviceReport::fromJsonObject(QJsonObject &pJson) {
|
||||||
|
::SWGSDRangel::setValue(&device_path, pJson["devicePath"], "QString", "QString");
|
||||||
|
|
||||||
|
::SWGSDRangel::setValue(&success_count, pJson["successCount"], "qint32", "");
|
||||||
|
|
||||||
|
::SWGSDRangel::setValue(&failure_count, pJson["failureCount"], "qint32", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
SWGAMBEDeviceReport::asJson ()
|
||||||
|
{
|
||||||
|
QJsonObject* obj = this->asJsonObject();
|
||||||
|
|
||||||
|
QJsonDocument doc(*obj);
|
||||||
|
QByteArray bytes = doc.toJson();
|
||||||
|
delete obj;
|
||||||
|
return QString(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject*
|
||||||
|
SWGAMBEDeviceReport::asJsonObject() {
|
||||||
|
QJsonObject* obj = new QJsonObject();
|
||||||
|
if(device_path != nullptr && *device_path != QString("")){
|
||||||
|
toJsonValue(QString("devicePath"), device_path, obj, QString("QString"));
|
||||||
|
}
|
||||||
|
if(m_success_count_isSet){
|
||||||
|
obj->insert("successCount", QJsonValue(success_count));
|
||||||
|
}
|
||||||
|
if(m_failure_count_isSet){
|
||||||
|
obj->insert("failureCount", QJsonValue(failure_count));
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString*
|
||||||
|
SWGAMBEDeviceReport::getDevicePath() {
|
||||||
|
return device_path;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
SWGAMBEDeviceReport::setDevicePath(QString* device_path) {
|
||||||
|
this->device_path = device_path;
|
||||||
|
this->m_device_path_isSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
qint32
|
||||||
|
SWGAMBEDeviceReport::getSuccessCount() {
|
||||||
|
return success_count;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
SWGAMBEDeviceReport::setSuccessCount(qint32 success_count) {
|
||||||
|
this->success_count = success_count;
|
||||||
|
this->m_success_count_isSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
qint32
|
||||||
|
SWGAMBEDeviceReport::getFailureCount() {
|
||||||
|
return failure_count;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
SWGAMBEDeviceReport::setFailureCount(qint32 failure_count) {
|
||||||
|
this->failure_count = failure_count;
|
||||||
|
this->m_failure_count_isSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
SWGAMBEDeviceReport::isSet(){
|
||||||
|
bool isObjectUpdated = false;
|
||||||
|
do{
|
||||||
|
if(device_path && *device_path != QString("")){
|
||||||
|
isObjectUpdated = true; break;
|
||||||
|
}
|
||||||
|
if(m_success_count_isSet){
|
||||||
|
isObjectUpdated = true; break;
|
||||||
|
}
|
||||||
|
if(m_failure_count_isSet){
|
||||||
|
isObjectUpdated = true; break;
|
||||||
|
}
|
||||||
|
}while(false);
|
||||||
|
return isObjectUpdated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
71
swagger/sdrangel/code/qt5/client/SWGAMBEDeviceReport.h
Normal file
71
swagger/sdrangel/code/qt5/client/SWGAMBEDeviceReport.h
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* 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: 7.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SWGAMBEDeviceReport.h
|
||||||
|
*
|
||||||
|
* Report of AMBE device in use
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SWGAMBEDeviceReport_H_
|
||||||
|
#define SWGAMBEDeviceReport_H_
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "SWGObject.h"
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
|
namespace SWGSDRangel {
|
||||||
|
|
||||||
|
class SWG_API SWGAMBEDeviceReport: public SWGObject {
|
||||||
|
public:
|
||||||
|
SWGAMBEDeviceReport();
|
||||||
|
SWGAMBEDeviceReport(QString* json);
|
||||||
|
virtual ~SWGAMBEDeviceReport();
|
||||||
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
|
||||||
|
virtual QString asJson () override;
|
||||||
|
virtual QJsonObject* asJsonObject() override;
|
||||||
|
virtual void fromJsonObject(QJsonObject &json) override;
|
||||||
|
virtual SWGAMBEDeviceReport* fromJson(QString &jsonString) override;
|
||||||
|
|
||||||
|
QString* getDevicePath();
|
||||||
|
void setDevicePath(QString* device_path);
|
||||||
|
|
||||||
|
qint32 getSuccessCount();
|
||||||
|
void setSuccessCount(qint32 success_count);
|
||||||
|
|
||||||
|
qint32 getFailureCount();
|
||||||
|
void setFailureCount(qint32 failure_count);
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool isSet() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString* device_path;
|
||||||
|
bool m_device_path_isSet;
|
||||||
|
|
||||||
|
qint32 success_count;
|
||||||
|
bool m_success_count_isSet;
|
||||||
|
|
||||||
|
qint32 failure_count;
|
||||||
|
bool m_failure_count_isSet;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SWGAMBEDeviceReport_H_ */
|
@ -42,7 +42,7 @@ void
|
|||||||
SWGAMBEReport::init() {
|
SWGAMBEReport::init() {
|
||||||
serial = new SWGDVSerialDevices();
|
serial = new SWGDVSerialDevices();
|
||||||
m_serial_isSet = false;
|
m_serial_isSet = false;
|
||||||
devices = new SWGAMBEDevices();
|
devices = new QList<SWGAMBEDeviceReport*>();
|
||||||
m_devices_isSet = false;
|
m_devices_isSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +52,10 @@ SWGAMBEReport::cleanup() {
|
|||||||
delete serial;
|
delete serial;
|
||||||
}
|
}
|
||||||
if(devices != nullptr) {
|
if(devices != nullptr) {
|
||||||
|
auto arr = devices;
|
||||||
|
for(auto o: *arr) {
|
||||||
|
delete o;
|
||||||
|
}
|
||||||
delete devices;
|
delete devices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,8 +73,8 @@ void
|
|||||||
SWGAMBEReport::fromJsonObject(QJsonObject &pJson) {
|
SWGAMBEReport::fromJsonObject(QJsonObject &pJson) {
|
||||||
::SWGSDRangel::setValue(&serial, pJson["serial"], "SWGDVSerialDevices", "SWGDVSerialDevices");
|
::SWGSDRangel::setValue(&serial, pJson["serial"], "SWGDVSerialDevices", "SWGDVSerialDevices");
|
||||||
|
|
||||||
::SWGSDRangel::setValue(&devices, pJson["devices"], "SWGAMBEDevices", "SWGAMBEDevices");
|
|
||||||
|
|
||||||
|
::SWGSDRangel::setValue(&devices, pJson["devices"], "QList", "SWGAMBEDeviceReport");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
@ -90,8 +94,8 @@ SWGAMBEReport::asJsonObject() {
|
|||||||
if((serial != nullptr) && (serial->isSet())){
|
if((serial != nullptr) && (serial->isSet())){
|
||||||
toJsonValue(QString("serial"), serial, obj, QString("SWGDVSerialDevices"));
|
toJsonValue(QString("serial"), serial, obj, QString("SWGDVSerialDevices"));
|
||||||
}
|
}
|
||||||
if((devices != nullptr) && (devices->isSet())){
|
if(devices && devices->size() > 0){
|
||||||
toJsonValue(QString("devices"), devices, obj, QString("SWGAMBEDevices"));
|
toJsonArray((QList<void*>*)devices, obj, "devices", "SWGAMBEDeviceReport");
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@ -107,12 +111,12 @@ SWGAMBEReport::setSerial(SWGDVSerialDevices* serial) {
|
|||||||
this->m_serial_isSet = true;
|
this->m_serial_isSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWGAMBEDevices*
|
QList<SWGAMBEDeviceReport*>*
|
||||||
SWGAMBEReport::getDevices() {
|
SWGAMBEReport::getDevices() {
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
SWGAMBEReport::setDevices(SWGAMBEDevices* devices) {
|
SWGAMBEReport::setDevices(QList<SWGAMBEDeviceReport*>* devices) {
|
||||||
this->devices = devices;
|
this->devices = devices;
|
||||||
this->m_devices_isSet = true;
|
this->m_devices_isSet = true;
|
||||||
}
|
}
|
||||||
@ -125,7 +129,7 @@ SWGAMBEReport::isSet(){
|
|||||||
if(serial && serial->isSet()){
|
if(serial && serial->isSet()){
|
||||||
isObjectUpdated = true; break;
|
isObjectUpdated = true; break;
|
||||||
}
|
}
|
||||||
if(devices && devices->isSet()){
|
if(devices && (devices->size() > 0)){
|
||||||
isObjectUpdated = true; break;
|
isObjectUpdated = true; break;
|
||||||
}
|
}
|
||||||
}while(false);
|
}while(false);
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
|
||||||
#include "SWGAMBEDevices.h"
|
#include "SWGAMBEDeviceReport.h"
|
||||||
#include "SWGDVSerialDevices.h"
|
#include "SWGDVSerialDevices.h"
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
#include "SWGObject.h"
|
#include "SWGObject.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
@ -46,8 +47,8 @@ public:
|
|||||||
SWGDVSerialDevices* getSerial();
|
SWGDVSerialDevices* getSerial();
|
||||||
void setSerial(SWGDVSerialDevices* serial);
|
void setSerial(SWGDVSerialDevices* serial);
|
||||||
|
|
||||||
SWGAMBEDevices* getDevices();
|
QList<SWGAMBEDeviceReport*>* getDevices();
|
||||||
void setDevices(SWGAMBEDevices* devices);
|
void setDevices(QList<SWGAMBEDeviceReport*>* devices);
|
||||||
|
|
||||||
|
|
||||||
virtual bool isSet() override;
|
virtual bool isSet() override;
|
||||||
@ -56,7 +57,7 @@ private:
|
|||||||
SWGDVSerialDevices* serial;
|
SWGDVSerialDevices* serial;
|
||||||
bool m_serial_isSet;
|
bool m_serial_isSet;
|
||||||
|
|
||||||
SWGAMBEDevices* devices;
|
QList<SWGAMBEDeviceReport*>* devices;
|
||||||
bool m_devices_isSet;
|
bool m_devices_isSet;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "SWGAISSettings.h"
|
#include "SWGAISSettings.h"
|
||||||
#include "SWGAMBEActions.h"
|
#include "SWGAMBEActions.h"
|
||||||
#include "SWGAMBEDevice.h"
|
#include "SWGAMBEDevice.h"
|
||||||
|
#include "SWGAMBEDeviceReport.h"
|
||||||
#include "SWGAMBEDevices.h"
|
#include "SWGAMBEDevices.h"
|
||||||
#include "SWGAMBEReport.h"
|
#include "SWGAMBEReport.h"
|
||||||
#include "SWGAMBESettings.h"
|
#include "SWGAMBESettings.h"
|
||||||
@ -397,6 +398,11 @@ namespace SWGSDRangel {
|
|||||||
obj->init();
|
obj->init();
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
if(QString("SWGAMBEDeviceReport").compare(type) == 0) {
|
||||||
|
SWGAMBEDeviceReport *obj = new SWGAMBEDeviceReport();
|
||||||
|
obj->init();
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
if(QString("SWGAMBEDevices").compare(type) == 0) {
|
if(QString("SWGAMBEDevices").compare(type) == 0) {
|
||||||
SWGAMBEDevices *obj = new SWGAMBEDevices();
|
SWGAMBEDevices *obj = new SWGAMBEDevices();
|
||||||
obj->init();
|
obj->init();
|
||||||
|
Loading…
Reference in New Issue
Block a user