sdrangel/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.cpp

183 lines
3.9 KiB
C++

/**
* SDRangel
* This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube
*
* 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "SWGDeviceListItem.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace Swagger {
SWGDeviceListItem::SWGDeviceListItem(QString* json) {
init();
this->fromJson(*json);
}
SWGDeviceListItem::SWGDeviceListItem() {
init();
}
SWGDeviceListItem::~SWGDeviceListItem() {
this->cleanup();
}
void
SWGDeviceListItem::init() {
hwType = new QString("");
tx = false;
nbStreams = NULL;
streamIndex = NULL;
sequence = NULL;
serial = new QString("");
}
void
SWGDeviceListItem::cleanup() {
if(hwType != NULL) {
delete hwType;
}
if(serial != NULL) {
delete serial;
}
}
SWGDeviceListItem*
SWGDeviceListItem::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGDeviceListItem::fromJsonObject(QJsonObject &pJson) {
setValue(&hwType, pJson["hwType"], "QString", "QString");
setValue(&tx, pJson["tx"], "bool", "");
setValue(&nbStreams, pJson["nbStreams"], "qint32", "");
setValue(&streamIndex, pJson["streamIndex"], "qint32", "");
setValue(&sequence, pJson["sequence"], "qint32", "");
setValue(&serial, pJson["serial"], "QString", "QString");
}
QString
SWGDeviceListItem::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject*
SWGDeviceListItem::asJsonObject() {
QJsonObject* obj = new QJsonObject();
toJsonValue(QString("hwType"), hwType, obj, QString("QString"));
obj->insert("tx", QJsonValue(tx));
obj->insert("nbStreams", QJsonValue(nbStreams));
obj->insert("streamIndex", QJsonValue(streamIndex));
obj->insert("sequence", QJsonValue(sequence));
toJsonValue(QString("serial"), serial, obj, QString("QString"));
return obj;
}
QString*
SWGDeviceListItem::getHwType() {
return hwType;
}
void
SWGDeviceListItem::setHwType(QString* hwType) {
this->hwType = hwType;
}
bool
SWGDeviceListItem::getTx() {
return tx;
}
void
SWGDeviceListItem::setTx(bool tx) {
this->tx = tx;
}
qint32
SWGDeviceListItem::getNbStreams() {
return nbStreams;
}
void
SWGDeviceListItem::setNbStreams(qint32 nbStreams) {
this->nbStreams = nbStreams;
}
qint32
SWGDeviceListItem::getStreamIndex() {
return streamIndex;
}
void
SWGDeviceListItem::setStreamIndex(qint32 streamIndex) {
this->streamIndex = streamIndex;
}
qint32
SWGDeviceListItem::getSequence() {
return sequence;
}
void
SWGDeviceListItem::setSequence(qint32 sequence) {
this->sequence = sequence;
}
QString*
SWGDeviceListItem::getSerial() {
return serial;
}
void
SWGDeviceListItem::setSerial(QString* serial) {
this->serial = serial;
}
} /* namespace Swagger */