kopia lustrzana https://github.com/f4exb/sdrangel
Web API: file source settings getter (1)
rodzic
d6b156a8d3
commit
fc4627f82e
|
@ -21,6 +21,7 @@ set(filesource_FORMS
|
|||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
)
|
||||
|
||||
#include(${QT_USE_FILE})
|
||||
|
@ -41,6 +42,7 @@ target_link_libraries(inputfilesource
|
|||
${QT_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
)
|
||||
|
||||
qt5_use_modules(inputfilesource Core Widgets)
|
||||
|
|
|
@ -20,6 +20,7 @@ QMAKE_CXXFLAGS += -std=c++11
|
|||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += ../../../sdrbase
|
||||
INCLUDEPATH += ../../../sdrgui
|
||||
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||
|
||||
CONFIG(Release):build_subdir = release
|
||||
CONFIG(Debug):build_subdir = debug
|
||||
|
@ -38,5 +39,6 @@ FORMS += filesourcegui.ui
|
|||
|
||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
||||
LIBS += -L../../../swagger/$${build_subdir} -lswagger
|
||||
|
||||
RESOURCES = ../../../sdrgui/resources/res.qrc
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGFileSourceSettings.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
|
@ -290,3 +293,12 @@ bool FileSourceInput::handleMessage(const Message& message)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int FileSourceInput::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setFileSourceSettings(new SWGSDRangel::SWGFileSourceSettings());
|
||||
*response.getFileSourceSettings()->getFileName() = m_settings.m_fileName;
|
||||
return 200;
|
||||
}
|
||||
|
|
|
@ -224,6 +224,10 @@ public:
|
|||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)),
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGObject;
|
||||
class SWGDeviceSettings;
|
||||
}
|
||||
|
||||
class SDRANGEL_API DeviceSampleSink : public QObject {
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
virtual bool handleMessage(const Message& message) = 0;
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGObject *response __attribute__((unused)),
|
||||
SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)),
|
||||
QString& errorMessage)
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGObject;
|
||||
class SWGDeviceSettings;
|
||||
}
|
||||
|
||||
class SDRANGEL_API DeviceSampleSource : public QObject {
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
virtual bool handleMessage(const Message& message) = 0;
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGObject *response __attribute__((unused)),
|
||||
SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)),
|
||||
QString& errorMessage)
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
|
|
|
@ -926,35 +926,31 @@ margin-bottom: 20px;
|
|||
"description" : "List of device sets opened in this instance"
|
||||
};
|
||||
defs.DeviceSettings = {
|
||||
"required" : [ "deviceType" ],
|
||||
"discriminator" : "deviceType",
|
||||
"required" : [ "deviceHwType", "tx" ],
|
||||
"discriminator" : "deviceHwType",
|
||||
"properties" : {
|
||||
"deviceType" : {
|
||||
"type" : "string"
|
||||
"deviceHwType" : {
|
||||
"type" : "string",
|
||||
"description" : "Device hardware type code"
|
||||
},
|
||||
"data" : {
|
||||
"type" : "object",
|
||||
"properties" : { }
|
||||
}
|
||||
},
|
||||
"description" : "Base device settings"
|
||||
};
|
||||
defs.DeviceSettingsImpl = {
|
||||
"properties" : {
|
||||
"fileSource" : {
|
||||
"tx" : {
|
||||
"type" : "integer",
|
||||
"description" : "Not zero if it is a tx device else it is a rx device"
|
||||
},
|
||||
"fileSourceSettings" : {
|
||||
"$ref" : "#/definitions/FileSourceSettings"
|
||||
},
|
||||
"rtlsdr" : {
|
||||
"rtlSdrSettings" : {
|
||||
"$ref" : "#/definitions/RtlSdrSettings"
|
||||
},
|
||||
"limesdrInput" : {
|
||||
"limeSdrInputSettings" : {
|
||||
"$ref" : "#/definitions/LimeSdrInputSettings"
|
||||
},
|
||||
"limesdrOutput" : {
|
||||
"limeSdrOutputSettings" : {
|
||||
"$ref" : "#/definitions/LimeSdrOutputSettings"
|
||||
}
|
||||
},
|
||||
"description" : "dummy structure to handle all devices settings"
|
||||
"description" : "Base device settings"
|
||||
};
|
||||
defs.ErrorResponse = {
|
||||
"required" : [ "message" ],
|
||||
|
@ -9076,7 +9072,7 @@ except ApiException as e:
|
|||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2017-12-06T08:23:29.921+01:00
|
||||
Generated 2017-12-06T19:21:13.596+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -604,6 +604,11 @@ void WebAPIRequestMapper::devicesetDeviceService(const std::string& indexStr, qt
|
|||
else if (request.getMethod() == "GET")
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings normalResponse;
|
||||
normalResponse.cleanup();
|
||||
normalResponse.setFileSourceSettings(0);
|
||||
normalResponse.setRtlSdrSettings(0);
|
||||
normalResponse.setLimeSdrInputSettings(0);
|
||||
normalResponse.setLimeSdrOutputSettings(0);
|
||||
int status = m_adapter->devicesetDeviceGet(deviceSetIndex, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
|
|
|
@ -705,13 +705,17 @@ int WebAPIAdapterGUI::devicesetDeviceGet(
|
|||
|
||||
if (deviceSet->m_deviceSourceEngine) // Rx
|
||||
{
|
||||
response.setDeviceHwType(new QString(deviceSet->m_deviceSourceAPI->getHardwareId()));
|
||||
response.setTx(0);
|
||||
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
|
||||
return source->webapiSettingsGet(response.getData(), *error.getMessage());
|
||||
return source->webapiSettingsGet(response, *error.getMessage());
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkEngine) // Tx
|
||||
{
|
||||
response.setDeviceHwType(new QString(deviceSet->m_deviceSinkAPI->getHardwareId()));
|
||||
response.setTx(1);
|
||||
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
|
||||
return sink->webapiSettingsGet(response.getData(), *error.getMessage());
|
||||
return sink->webapiSettingsGet(response, *error.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -938,23 +938,22 @@ definitions:
|
|||
$ref: "#/definitions/PresetIdentifier"
|
||||
DeviceSettings:
|
||||
description: Base device settings
|
||||
discriminator: deviceType
|
||||
discriminator: deviceHwType
|
||||
required:
|
||||
- deviceType
|
||||
- deviceHwType
|
||||
- tx
|
||||
properties:
|
||||
deviceType:
|
||||
deviceHwType:
|
||||
description: Device hardware type code
|
||||
type: string
|
||||
data:
|
||||
type: object
|
||||
DeviceSettingsImpl:
|
||||
description: dummy structure to handle all devices settings
|
||||
properties:
|
||||
fileSource:
|
||||
tx:
|
||||
description: Not zero if it is a tx device else it is a rx device
|
||||
type: integer
|
||||
fileSourceSettings:
|
||||
$ref: "http://localhost:8081/FileSource.yaml#/FileSourceSettings"
|
||||
rtlsdr:
|
||||
rtlSdrSettings:
|
||||
$ref: "http://localhost:8081/RtlSdr.yaml#/RtlSdrSettings"
|
||||
limesdrInput:
|
||||
limeSdrInputSettings:
|
||||
$ref: "http://localhost:8081/LimeSdr.yaml#/LimeSdrInputSettings"
|
||||
limesdrOutput:
|
||||
limeSdrOutputSettings:
|
||||
$ref: "http://localhost:8081/LimeSdr.yaml#/LimeSdrOutputSettings"
|
||||
|
|
@ -1,201 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
|
@ -926,35 +926,31 @@ margin-bottom: 20px;
|
|||
"description" : "List of device sets opened in this instance"
|
||||
};
|
||||
defs.DeviceSettings = {
|
||||
"required" : [ "deviceType" ],
|
||||
"discriminator" : "deviceType",
|
||||
"required" : [ "deviceHwType", "tx" ],
|
||||
"discriminator" : "deviceHwType",
|
||||
"properties" : {
|
||||
"deviceType" : {
|
||||
"type" : "string"
|
||||
"deviceHwType" : {
|
||||
"type" : "string",
|
||||
"description" : "Device hardware type code"
|
||||
},
|
||||
"data" : {
|
||||
"type" : "object",
|
||||
"properties" : { }
|
||||
}
|
||||
},
|
||||
"description" : "Base device settings"
|
||||
};
|
||||
defs.DeviceSettingsImpl = {
|
||||
"properties" : {
|
||||
"fileSource" : {
|
||||
"tx" : {
|
||||
"type" : "integer",
|
||||
"description" : "Not zero if it is a tx device else it is a rx device"
|
||||
},
|
||||
"fileSourceSettings" : {
|
||||
"$ref" : "#/definitions/FileSourceSettings"
|
||||
},
|
||||
"rtlsdr" : {
|
||||
"rtlSdrSettings" : {
|
||||
"$ref" : "#/definitions/RtlSdrSettings"
|
||||
},
|
||||
"limesdrInput" : {
|
||||
"limeSdrInputSettings" : {
|
||||
"$ref" : "#/definitions/LimeSdrInputSettings"
|
||||
},
|
||||
"limesdrOutput" : {
|
||||
"limeSdrOutputSettings" : {
|
||||
"$ref" : "#/definitions/LimeSdrOutputSettings"
|
||||
}
|
||||
},
|
||||
"description" : "dummy structure to handle all devices settings"
|
||||
"description" : "Base device settings"
|
||||
};
|
||||
defs.ErrorResponse = {
|
||||
"required" : [ "message" ],
|
||||
|
@ -9076,7 +9072,7 @@ except ApiException as e:
|
|||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2017-12-06T08:23:29.921+01:00
|
||||
Generated 2017-12-06T19:21:13.596+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -37,19 +37,36 @@ SWGDeviceSettings::~SWGDeviceSettings() {
|
|||
|
||||
void
|
||||
SWGDeviceSettings::init() {
|
||||
device_type = new QString("");
|
||||
data = NULL;
|
||||
device_hw_type = new QString("");
|
||||
tx = 0;
|
||||
file_source_settings = new SWGFileSourceSettings();
|
||||
rtl_sdr_settings = new SWGRtlSdrSettings();
|
||||
lime_sdr_input_settings = new SWGLimeSdrInputSettings();
|
||||
lime_sdr_output_settings = new SWGLimeSdrOutputSettings();
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSettings::cleanup() {
|
||||
|
||||
if(device_type != nullptr) {
|
||||
delete device_type;
|
||||
if(device_hw_type != nullptr) {
|
||||
delete device_hw_type;
|
||||
}
|
||||
|
||||
if(data != nullptr) {
|
||||
delete data;
|
||||
|
||||
if(file_source_settings != nullptr) {
|
||||
delete file_source_settings;
|
||||
}
|
||||
|
||||
if(rtl_sdr_settings != nullptr) {
|
||||
delete rtl_sdr_settings;
|
||||
}
|
||||
|
||||
if(lime_sdr_input_settings != nullptr) {
|
||||
delete lime_sdr_input_settings;
|
||||
}
|
||||
|
||||
if(lime_sdr_output_settings != nullptr) {
|
||||
delete lime_sdr_output_settings;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,8 +81,12 @@ SWGDeviceSettings::fromJson(QString &json) {
|
|||
|
||||
void
|
||||
SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&device_type, pJson["deviceType"], "QString", "QString");
|
||||
::SWGSDRangel::setValue(&data, pJson["data"], "SWGObject", "SWGObject");
|
||||
::SWGSDRangel::setValue(&device_hw_type, pJson["deviceHwType"], "QString", "QString");
|
||||
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
|
||||
::SWGSDRangel::setValue(&file_source_settings, pJson["fileSourceSettings"], "SWGFileSourceSettings", "SWGFileSourceSettings");
|
||||
::SWGSDRangel::setValue(&rtl_sdr_settings, pJson["rtlSdrSettings"], "SWGRtlSdrSettings", "SWGRtlSdrSettings");
|
||||
::SWGSDRangel::setValue(&lime_sdr_input_settings, pJson["limeSdrInputSettings"], "SWGLimeSdrInputSettings", "SWGLimeSdrInputSettings");
|
||||
::SWGSDRangel::setValue(&lime_sdr_output_settings, pJson["limeSdrOutputSettings"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings");
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -82,29 +103,73 @@ QJsonObject*
|
|||
SWGDeviceSettings::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
toJsonValue(QString("deviceType"), device_type, obj, QString("QString"));
|
||||
toJsonValue(QString("deviceHwType"), device_hw_type, obj, QString("QString"));
|
||||
|
||||
toJsonValue(QString("data"), data, obj, QString("SWGObject"));
|
||||
obj->insert("tx", QJsonValue(tx));
|
||||
|
||||
toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings"));
|
||||
|
||||
toJsonValue(QString("rtlSdrSettings"), rtl_sdr_settings, obj, QString("SWGRtlSdrSettings"));
|
||||
|
||||
toJsonValue(QString("limeSdrInputSettings"), lime_sdr_input_settings, obj, QString("SWGLimeSdrInputSettings"));
|
||||
|
||||
toJsonValue(QString("limeSdrOutputSettings"), lime_sdr_output_settings, obj, QString("SWGLimeSdrOutputSettings"));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGDeviceSettings::getDeviceType() {
|
||||
return device_type;
|
||||
SWGDeviceSettings::getDeviceHwType() {
|
||||
return device_hw_type;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setDeviceType(QString* device_type) {
|
||||
this->device_type = device_type;
|
||||
SWGDeviceSettings::setDeviceHwType(QString* device_hw_type) {
|
||||
this->device_hw_type = device_hw_type;
|
||||
}
|
||||
|
||||
SWGObject*
|
||||
SWGDeviceSettings::getData() {
|
||||
return data;
|
||||
qint32
|
||||
SWGDeviceSettings::getTx() {
|
||||
return tx;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setData(SWGObject* data) {
|
||||
this->data = data;
|
||||
SWGDeviceSettings::setTx(qint32 tx) {
|
||||
this->tx = tx;
|
||||
}
|
||||
|
||||
SWGFileSourceSettings*
|
||||
SWGDeviceSettings::getFileSourceSettings() {
|
||||
return file_source_settings;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setFileSourceSettings(SWGFileSourceSettings* file_source_settings) {
|
||||
this->file_source_settings = file_source_settings;
|
||||
}
|
||||
|
||||
SWGRtlSdrSettings*
|
||||
SWGDeviceSettings::getRtlSdrSettings() {
|
||||
return rtl_sdr_settings;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings) {
|
||||
this->rtl_sdr_settings = rtl_sdr_settings;
|
||||
}
|
||||
|
||||
SWGLimeSdrInputSettings*
|
||||
SWGDeviceSettings::getLimeSdrInputSettings() {
|
||||
return lime_sdr_input_settings;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setLimeSdrInputSettings(SWGLimeSdrInputSettings* lime_sdr_input_settings) {
|
||||
this->lime_sdr_input_settings = lime_sdr_input_settings;
|
||||
}
|
||||
|
||||
SWGLimeSdrOutputSettings*
|
||||
SWGDeviceSettings::getLimeSdrOutputSettings() {
|
||||
return lime_sdr_output_settings;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettings::setLimeSdrOutputSettings(SWGLimeSdrOutputSettings* lime_sdr_output_settings) {
|
||||
this->lime_sdr_output_settings = lime_sdr_output_settings;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "SWGFileSourceSettings.h"
|
||||
#include "SWGLimeSdrInputSettings.h"
|
||||
#include "SWGLimeSdrOutputSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
|
@ -43,16 +46,32 @@ public:
|
|||
void fromJsonObject(QJsonObject &json);
|
||||
SWGDeviceSettings* fromJson(QString &jsonString);
|
||||
|
||||
QString* getDeviceType();
|
||||
void setDeviceType(QString* device_type);
|
||||
QString* getDeviceHwType();
|
||||
void setDeviceHwType(QString* device_hw_type);
|
||||
|
||||
SWGObject* getData();
|
||||
void setData(SWGObject* data);
|
||||
qint32 getTx();
|
||||
void setTx(qint32 tx);
|
||||
|
||||
SWGFileSourceSettings* getFileSourceSettings();
|
||||
void setFileSourceSettings(SWGFileSourceSettings* file_source_settings);
|
||||
|
||||
SWGRtlSdrSettings* getRtlSdrSettings();
|
||||
void setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings);
|
||||
|
||||
SWGLimeSdrInputSettings* getLimeSdrInputSettings();
|
||||
void setLimeSdrInputSettings(SWGLimeSdrInputSettings* lime_sdr_input_settings);
|
||||
|
||||
SWGLimeSdrOutputSettings* getLimeSdrOutputSettings();
|
||||
void setLimeSdrOutputSettings(SWGLimeSdrOutputSettings* lime_sdr_output_settings);
|
||||
|
||||
|
||||
private:
|
||||
QString* device_type;
|
||||
SWGObject* data;
|
||||
QString* device_hw_type;
|
||||
qint32 tx;
|
||||
SWGFileSourceSettings* file_source_settings;
|
||||
SWGRtlSdrSettings* rtl_sdr_settings;
|
||||
SWGLimeSdrInputSettings* lime_sdr_input_settings;
|
||||
SWGLimeSdrOutputSettings* lime_sdr_output_settings;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include "SWGDeviceSettingsImpl.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGDeviceSettingsImpl::SWGDeviceSettingsImpl(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGDeviceSettingsImpl::SWGDeviceSettingsImpl() {
|
||||
init();
|
||||
}
|
||||
|
||||
SWGDeviceSettingsImpl::~SWGDeviceSettingsImpl() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSettingsImpl::init() {
|
||||
file_source = new SWGFileSourceSettings();
|
||||
rtlsdr = new SWGRtlSdrSettings();
|
||||
limesdr_input = new SWGLimeSdrInputSettings();
|
||||
limesdr_output = new SWGLimeSdrOutputSettings();
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSettingsImpl::cleanup() {
|
||||
|
||||
if(file_source != nullptr) {
|
||||
delete file_source;
|
||||
}
|
||||
|
||||
if(rtlsdr != nullptr) {
|
||||
delete rtlsdr;
|
||||
}
|
||||
|
||||
if(limesdr_input != nullptr) {
|
||||
delete limesdr_input;
|
||||
}
|
||||
|
||||
if(limesdr_output != nullptr) {
|
||||
delete limesdr_output;
|
||||
}
|
||||
}
|
||||
|
||||
SWGDeviceSettingsImpl*
|
||||
SWGDeviceSettingsImpl::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSettingsImpl::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&file_source, pJson["fileSource"], "SWGFileSourceSettings", "SWGFileSourceSettings");
|
||||
::SWGSDRangel::setValue(&rtlsdr, pJson["rtlsdr"], "SWGRtlSdrSettings", "SWGRtlSdrSettings");
|
||||
::SWGSDRangel::setValue(&limesdr_input, pJson["limesdrInput"], "SWGLimeSdrInputSettings", "SWGLimeSdrInputSettings");
|
||||
::SWGSDRangel::setValue(&limesdr_output, pJson["limesdrOutput"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings");
|
||||
}
|
||||
|
||||
QString
|
||||
SWGDeviceSettingsImpl::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGDeviceSettingsImpl::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
toJsonValue(QString("fileSource"), file_source, obj, QString("SWGFileSourceSettings"));
|
||||
|
||||
toJsonValue(QString("rtlsdr"), rtlsdr, obj, QString("SWGRtlSdrSettings"));
|
||||
|
||||
toJsonValue(QString("limesdrInput"), limesdr_input, obj, QString("SWGLimeSdrInputSettings"));
|
||||
|
||||
toJsonValue(QString("limesdrOutput"), limesdr_output, obj, QString("SWGLimeSdrOutputSettings"));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
SWGFileSourceSettings*
|
||||
SWGDeviceSettingsImpl::getFileSource() {
|
||||
return file_source;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettingsImpl::setFileSource(SWGFileSourceSettings* file_source) {
|
||||
this->file_source = file_source;
|
||||
}
|
||||
|
||||
SWGRtlSdrSettings*
|
||||
SWGDeviceSettingsImpl::getRtlsdr() {
|
||||
return rtlsdr;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettingsImpl::setRtlsdr(SWGRtlSdrSettings* rtlsdr) {
|
||||
this->rtlsdr = rtlsdr;
|
||||
}
|
||||
|
||||
SWGLimeSdrInputSettings*
|
||||
SWGDeviceSettingsImpl::getLimesdrInput() {
|
||||
return limesdr_input;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettingsImpl::setLimesdrInput(SWGLimeSdrInputSettings* limesdr_input) {
|
||||
this->limesdr_input = limesdr_input;
|
||||
}
|
||||
|
||||
SWGLimeSdrOutputSettings*
|
||||
SWGDeviceSettingsImpl::getLimesdrOutput() {
|
||||
return limesdr_output;
|
||||
}
|
||||
void
|
||||
SWGDeviceSettingsImpl::setLimesdrOutput(SWGLimeSdrOutputSettings* limesdr_output) {
|
||||
this->limesdr_output = limesdr_output;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGDeviceSettingsImpl.h
|
||||
*
|
||||
* dummy structure to handle all devices settings
|
||||
*/
|
||||
|
||||
#ifndef SWGDeviceSettingsImpl_H_
|
||||
#define SWGDeviceSettingsImpl_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGFileSourceSettings.h"
|
||||
#include "SWGLimeSdrInputSettings.h"
|
||||
#include "SWGLimeSdrOutputSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
|
||||
#include "SWGObject.h"
|
||||
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWGDeviceSettingsImpl: public SWGObject {
|
||||
public:
|
||||
SWGDeviceSettingsImpl();
|
||||
SWGDeviceSettingsImpl(QString* json);
|
||||
virtual ~SWGDeviceSettingsImpl();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
SWGDeviceSettingsImpl* fromJson(QString &jsonString);
|
||||
|
||||
SWGFileSourceSettings* getFileSource();
|
||||
void setFileSource(SWGFileSourceSettings* file_source);
|
||||
|
||||
SWGRtlSdrSettings* getRtlsdr();
|
||||
void setRtlsdr(SWGRtlSdrSettings* rtlsdr);
|
||||
|
||||
SWGLimeSdrInputSettings* getLimesdrInput();
|
||||
void setLimesdrInput(SWGLimeSdrInputSettings* limesdr_input);
|
||||
|
||||
SWGLimeSdrOutputSettings* getLimesdrOutput();
|
||||
void setLimesdrOutput(SWGLimeSdrOutputSettings* limesdr_output);
|
||||
|
||||
|
||||
private:
|
||||
SWGFileSourceSettings* file_source;
|
||||
SWGRtlSdrSettings* rtlsdr;
|
||||
SWGLimeSdrInputSettings* limesdr_input;
|
||||
SWGLimeSdrOutputSettings* limesdr_output;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGDeviceSettingsImpl_H_ */
|
|
@ -25,7 +25,6 @@
|
|||
#include "SWGDeviceSet.h"
|
||||
#include "SWGDeviceSetList.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceSettingsImpl.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
#include "SWGFileSourceSettings.h"
|
||||
#include "SWGInstanceChannelsResponse.h"
|
||||
|
@ -80,9 +79,6 @@ namespace SWGSDRangel {
|
|||
if(QString("SWGDeviceSettings").compare(type) == 0) {
|
||||
return new SWGDeviceSettings();
|
||||
}
|
||||
if(QString("SWGDeviceSettingsImpl").compare(type) == 0) {
|
||||
return new SWGDeviceSettingsImpl();
|
||||
}
|
||||
if(QString("SWGErrorResponse").compare(type) == 0) {
|
||||
return new SWGErrorResponse();
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue