kopia lustrzana https://github.com/f4exb/sdrangel
v7: added API for configurations and updated presets API. Implements #1234
rodzic
4eba3bb871
commit
1bcecec103
|
@ -117,7 +117,6 @@ int ChannelAnalyzer::getChannelSampleRate()
|
|||
m_basebandSampleRate = source->getSampleRate();
|
||||
}
|
||||
|
||||
qDebug("ChannelAnalyzer::getChannelSampleRate: %d", m_basebandSampleRate);
|
||||
return m_basebandSampleRate;
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ void VorLocalizerWorker::updateHardware()
|
|||
quint64 VorLocalizerWorker::getDeviceCenterFrequency(int deviceIndex)
|
||||
{
|
||||
std::vector<DeviceSet*> deviceSets = MainCore::instance()->getDeviceSets();
|
||||
if (deviceIndex < deviceSets.size())
|
||||
if (deviceIndex < (int) deviceSets.size())
|
||||
{
|
||||
DeviceSet *deviceSet = deviceSets[deviceIndex];
|
||||
if (deviceSet->m_deviceSourceEngine)
|
||||
|
@ -233,7 +233,7 @@ quint64 VorLocalizerWorker::getDeviceCenterFrequency(int deviceIndex)
|
|||
int VorLocalizerWorker::getDeviceSampleRate(int deviceIndex)
|
||||
{
|
||||
std::vector<DeviceSet*> deviceSets = MainCore::instance()->getDeviceSets();
|
||||
if (deviceIndex < deviceSets.size())
|
||||
if (deviceIndex < (int) deviceSets.size())
|
||||
{
|
||||
DeviceSet *deviceSet = deviceSets[deviceIndex];
|
||||
if (deviceSet->m_deviceSourceEngine)
|
||||
|
|
|
@ -35,6 +35,9 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteInstance, Message)
|
|||
MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadPreset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgSavePreset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeletePreset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadConfiguration, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgSaveConfiguration, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteConfiguration, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadFeatureSetPreset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgSaveFeatureSetPreset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteFeatureSetPreset, Message)
|
||||
|
|
|
@ -167,6 +167,69 @@ public:
|
|||
{ }
|
||||
};
|
||||
|
||||
class SDRBASE_API MsgLoadConfiguration : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const Configuration *getConfiguration() const { return m_configuration; }
|
||||
|
||||
static MsgLoadConfiguration* create(const Configuration *configuration)
|
||||
{
|
||||
return new MsgLoadConfiguration(configuration);
|
||||
}
|
||||
|
||||
private:
|
||||
const Configuration *m_configuration;
|
||||
|
||||
MsgLoadConfiguration(const Configuration *configuration) :
|
||||
Message(),
|
||||
m_configuration(configuration)
|
||||
{ }
|
||||
};
|
||||
|
||||
class SDRBASE_API MsgSaveConfiguration : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
Configuration *getConfiguration() const { return m_configuration; }
|
||||
bool isNewConfiguration() const { return m_newConfiguration; }
|
||||
|
||||
static MsgSaveConfiguration* create(Configuration *configuration, bool newConfiguration)
|
||||
{
|
||||
return new MsgSaveConfiguration(configuration, newConfiguration);
|
||||
}
|
||||
|
||||
private:
|
||||
Configuration *m_configuration;
|
||||
bool m_newConfiguration;
|
||||
|
||||
MsgSaveConfiguration(Configuration *configuration, bool newConfiguration) :
|
||||
Message(),
|
||||
m_configuration(configuration),
|
||||
m_newConfiguration(newConfiguration)
|
||||
{ }
|
||||
};
|
||||
|
||||
class SDRBASE_API MsgDeleteConfiguration : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const Configuration *getConfiguration() const { return m_configuration; }
|
||||
|
||||
static MsgDeleteConfiguration* create(const Configuration *configuration)
|
||||
{
|
||||
return new MsgDeleteConfiguration(configuration);
|
||||
}
|
||||
|
||||
private:
|
||||
const Configuration *m_configuration;
|
||||
|
||||
MsgDeleteConfiguration(const Configuration *configuration) :
|
||||
Message(),
|
||||
m_configuration(configuration)
|
||||
{ }
|
||||
};
|
||||
|
||||
class SDRBASE_API MsgLoadFeatureSetPreset : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -821,7 +821,7 @@ paths:
|
|||
/sdrangel/preset/file:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: import a preset from file as a new preset (server only).
|
||||
description: import a preset from file as a new preset.
|
||||
operationId: instancePresetFilePut
|
||||
tags:
|
||||
- Instance
|
||||
|
@ -830,10 +830,10 @@ paths:
|
|||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: import details
|
||||
description: File path
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/PresetImport"
|
||||
$ref: "#/definitions/FilePath"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return preset identification
|
||||
|
@ -883,6 +883,337 @@ paths:
|
|||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/preset/blob:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: deserialize base64 blob to a new preset.
|
||||
operationId: instancePresetBlobPut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Blob in base64 format
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return preset identification
|
||||
schema:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: serialize a preset to a base64 blob.
|
||||
operationId: instancePresetBlobPost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Preset identification
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return blob
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Preset not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configurations:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
description: List all configurations in the instance
|
||||
operationId: instanceConfigurationsGet
|
||||
tags:
|
||||
- Instance
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configurations list
|
||||
schema:
|
||||
$ref: "#/definitions/Configurations"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configuration:
|
||||
x-swagger-router-controller: instance
|
||||
patch:
|
||||
description: Load a configuration
|
||||
operationId: instanceConfigurationPatch
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Load configuration settings
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the selected configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: No configuration found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
put:
|
||||
description: Update an existing configuration with current setup.
|
||||
operationId: instanceConfigurationPut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: save setup to the configuration
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the selected configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: No configuration found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: Create a new configuration from the current setup.
|
||||
operationId: instanceConfigurationPost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: save setup in a new configuration
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the created configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"409":
|
||||
description: Configuration already exists
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
delete:
|
||||
description: Deletes a configuration
|
||||
operationId: instanceConfigurationDelete
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: delete this configuration
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the selected configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Configuration not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configuration/file:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: import a configuration from file as a new configuration.
|
||||
operationId: instanceConfigurationFilePut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: File path
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/FilePath"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configuration identification
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: File not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: export a configuration to file.
|
||||
operationId: instanceConfigurationFilePost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: export details
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationImportExport"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configuration identification
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Configuration or file path not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configuration/blob:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: deserialize base64 blob to a new configuration.
|
||||
operationId: instanceConfigurationBlobPut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Blob in base64 format
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configuration identification
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: serialize a configuration to a base64 blob.
|
||||
operationId: instanceConfigurationBlobPost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: configuration identification
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return blob
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Preset not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/featurepresets:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
|
@ -3034,28 +3365,106 @@ definitions:
|
|||
$ref: "#/definitions/PresetIdentifier"
|
||||
|
||||
PresetImport:
|
||||
description: "Details to import preset from file in preset list"
|
||||
description: "Details to import new preset from file"
|
||||
required:
|
||||
- filePath
|
||||
properties:
|
||||
groupName:
|
||||
description: "If present overrides imported preset group name with this name"
|
||||
type: string
|
||||
description:
|
||||
description: "If present overrides imported preset description with this description"
|
||||
type: string
|
||||
preset:
|
||||
description: "New preset details"
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
filePath:
|
||||
description: "Path of the import file"
|
||||
type: string
|
||||
|
||||
PresetExport:
|
||||
description: "Details to export a preset to file"
|
||||
description: "Details to export a preset to a file"
|
||||
properties:
|
||||
filePath:
|
||||
description: "Path of the export file"
|
||||
type: string
|
||||
preset:
|
||||
description: "Preset to export"
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
|
||||
Base64Blob:
|
||||
description: "Binary blob in base64 format"
|
||||
required:
|
||||
- blob
|
||||
properties:
|
||||
blob:
|
||||
description: "Blob in base64"
|
||||
type: string
|
||||
|
||||
FilePath:
|
||||
description: "File path"
|
||||
required:
|
||||
- filePath
|
||||
properties:
|
||||
filePath:
|
||||
description: "File path"
|
||||
type: string
|
||||
|
||||
Configurations:
|
||||
description: "Configuration presets"
|
||||
required:
|
||||
- nbGroups
|
||||
properties:
|
||||
nbGroups:
|
||||
description: "Number of configuration groups"
|
||||
type: integer
|
||||
groups:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/ConfigurationGroup"
|
||||
|
||||
ConfigurationGroup:
|
||||
description: "Group of configuration"
|
||||
required:
|
||||
- groupName
|
||||
- nbPresets
|
||||
properties:
|
||||
groupName:
|
||||
description: "Name of the configuration group"
|
||||
type: string
|
||||
nbConfigurations:
|
||||
description: "Number of configurations in the group"
|
||||
type: integer
|
||||
configurations:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/ConfigurationItem"
|
||||
|
||||
ConfigurationIdentifier:
|
||||
description: "Configuration item"
|
||||
required:
|
||||
- groupName
|
||||
- name
|
||||
properties:
|
||||
groupName:
|
||||
description: "Name of the preset group"
|
||||
type: string
|
||||
name:
|
||||
description: "Descriptive name of the preset"
|
||||
type: string
|
||||
|
||||
ConfigurationItem:
|
||||
description: "Configuration preset item"
|
||||
required:
|
||||
- name
|
||||
properties:
|
||||
name:
|
||||
description: "Descriptive name of the configuration"
|
||||
type: string
|
||||
|
||||
ConfigurationImportExport:
|
||||
description: "Details to impprt/export a configuration from/to file"
|
||||
properties:
|
||||
filePath:
|
||||
description: "Path of the import file"
|
||||
type: string
|
||||
preset:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
configuration:
|
||||
description: "On import new configuration details. On export configuration to export from"
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
|
||||
FeaturePresets:
|
||||
description: "Feature settings presets"
|
||||
|
|
|
@ -238,6 +238,16 @@ void MainSettings::deletePreset(const Preset* preset)
|
|||
delete (Preset*)preset;
|
||||
}
|
||||
|
||||
QByteArray MainSettings::serializePreset(const Preset* preset) const
|
||||
{
|
||||
return preset->serialize();
|
||||
}
|
||||
|
||||
bool MainSettings::deserializePreset(const QByteArray& blob, Preset* preset)
|
||||
{
|
||||
return preset->deserialize(blob);
|
||||
}
|
||||
|
||||
void MainSettings::deletePresetGroup(const QString& groupName)
|
||||
{
|
||||
Presets::iterator it = m_presets.begin();
|
||||
|
@ -476,6 +486,16 @@ void MainSettings::deleteConfiguration(const Configuration *configuration)
|
|||
delete (Configuration*) configuration;
|
||||
}
|
||||
|
||||
QByteArray MainSettings::serializeConfiguration(const Configuration *configuration) const
|
||||
{
|
||||
return configuration->serialize();
|
||||
}
|
||||
|
||||
bool MainSettings::deserializeConfiguration(const QByteArray& blob, Configuration *configuration)
|
||||
{
|
||||
return configuration->deserialize(blob);
|
||||
}
|
||||
|
||||
const Configuration* MainSettings::getConfiguration(const QString& groupName, const QString& description) const
|
||||
{
|
||||
int nbConfigurations = getConfigurationCount();
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
Preset* newPreset(const QString& group, const QString& description);
|
||||
void addPreset(Preset *preset);
|
||||
void deletePreset(const Preset* preset);
|
||||
QByteArray serializePreset(const Preset* preset) const;
|
||||
bool deserializePreset(const QByteArray& blob, Preset* preset);
|
||||
int getPresetCount() const { return m_presets.count(); }
|
||||
const Preset* getPreset(int index) const { return m_presets[index]; }
|
||||
const Preset* getPreset(const QString& groupName, quint64 centerFrequency, const QString& description, const QString& type) const;
|
||||
|
@ -75,6 +77,8 @@ public:
|
|||
Configuration* newConfiguration(const QString& group, const QString& description);
|
||||
void addConfiguration(Configuration *configuration);
|
||||
void deleteConfiguration(const Configuration *configuration);
|
||||
QByteArray serializeConfiguration(const Configuration *configuration) const;
|
||||
bool deserializeConfiguration(const QByteArray& blob, Configuration *configuration);
|
||||
int getConfigurationCount() const { return m_configurations.size(); }
|
||||
const Configuration* getConfiguration(int index) const { return m_configurations[index]; }
|
||||
const Configuration* getConfiguration(const QString& groupName, const QString& description) const;
|
||||
|
|
|
@ -407,3 +407,16 @@ const QByteArray* Preset::findBestDeviceConfigSoapy(const QString& sourceId, con
|
|||
return &(it->m_config);
|
||||
}
|
||||
}
|
||||
|
||||
QString Preset::getPresetTypeChar(PresetType presetType)
|
||||
{
|
||||
if (presetType == PresetSource) {
|
||||
return "R";
|
||||
} else if (presetType == PresetSink) {
|
||||
return "T";
|
||||
} else if (presetType == PresetMIMO) {
|
||||
return "M";
|
||||
} else {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
bool isMIMOPreset() const { return m_presetType == PresetMIMO; }
|
||||
PresetType getPresetType() const { return m_presetType; }
|
||||
void setPresetType(PresetType presetType) { m_presetType = presetType; }
|
||||
static QString getPresetTypeChar(PresetType presetType);
|
||||
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
|
|
@ -57,6 +57,12 @@
|
|||
#include "SWGPresetItem.h"
|
||||
#include "SWGPresetTransfer.h"
|
||||
#include "SWGPresetIdentifier.h"
|
||||
#include "SWGPresetExport.h"
|
||||
#include "SWGConfigurations.h"
|
||||
#include "SWGConfigurationIdentifier.h"
|
||||
#include "SWGConfigurationImportExport.h"
|
||||
#include "SWGBase64Blob.h"
|
||||
#include "SWGFilePath.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
|
@ -1169,7 +1175,7 @@ int WebAPIAdapter::instancePresetsGet(
|
|||
swgPresets->append(new SWGSDRangel::SWGPresetItem);
|
||||
swgPresets->back()->init();
|
||||
swgPresets->back()->setCenterFrequency(preset->getCenterFrequency());
|
||||
*swgPresets->back()->getType() = preset->isSourcePreset() ? "R" : preset->isSinkPreset() ? "T" : preset->isMIMOPreset() ? "M" : "X";
|
||||
*swgPresets->back()->getType() = Preset::getPresetTypeChar(preset->getPresetType());
|
||||
*swgPresets->back()->getName() = preset->getDescription();
|
||||
nbPresetsThisGroup++;
|
||||
}
|
||||
|
@ -1241,7 +1247,7 @@ int WebAPIAdapter::instancePresetPatch(
|
|||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : selectedPreset->isSinkPreset() ? "T" : selectedPreset->isMIMOPreset() ? "M" : "X";
|
||||
*response.getType() = Preset::getPresetTypeChar(selectedPreset->getPresetType());
|
||||
*response.getName() = selectedPreset->getDescription();
|
||||
|
||||
return 202;
|
||||
|
@ -1310,7 +1316,7 @@ int WebAPIAdapter::instancePresetPut(
|
|||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : selectedPreset->isSinkPreset() ? "T": selectedPreset->isMIMOPreset() ? "M" : "X";
|
||||
*response.getType() = Preset::getPresetTypeChar(selectedPreset->getPresetType());
|
||||
*response.getName() = selectedPreset->getDescription();
|
||||
|
||||
return 202;
|
||||
|
@ -1373,7 +1379,7 @@ int WebAPIAdapter::instancePresetPost(
|
|||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : selectedPreset->isSinkPreset() ? "T" : selectedPreset->isMIMOPreset() ? "M" : "X";
|
||||
*response.getType() = Preset::getPresetTypeChar(selectedPreset->getPresetType());
|
||||
*response.getName() = selectedPreset->getDescription();
|
||||
|
||||
return 202;
|
||||
|
@ -1390,6 +1396,7 @@ int WebAPIAdapter::instancePresetDelete(
|
|||
|
||||
if (selectedPreset == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no preset [%1, %2, %3 %4]")
|
||||
.arg(*response.getGroupName())
|
||||
.arg(response.getCenterFrequency())
|
||||
|
@ -1400,7 +1407,7 @@ int WebAPIAdapter::instancePresetDelete(
|
|||
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : selectedPreset->isSinkPreset() ? "T" : selectedPreset->isMIMOPreset() ? "M" : "X";
|
||||
*response.getType() = Preset::getPresetTypeChar(selectedPreset->getPresetType());
|
||||
*response.getName() = selectedPreset->getDescription();
|
||||
|
||||
MainCore::MsgDeletePreset *msg = MainCore::MsgDeletePreset::create(const_cast<Preset*>(selectedPreset));
|
||||
|
@ -1409,6 +1416,549 @@ int WebAPIAdapter::instancePresetDelete(
|
|||
return 202;
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instancePresetFilePut(
|
||||
SWGSDRangel::SWGFilePath& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
QString filePath = *query.getFilePath();
|
||||
|
||||
if (QFileInfo::exists(filePath))
|
||||
{
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QByteArray base64Str;
|
||||
QTextStream instream(&file);
|
||||
instream >> base64Str;
|
||||
file.close();
|
||||
Preset *newPreset = m_mainCore->m_settings.newPreset("TBD", "TBD");
|
||||
|
||||
if (newPreset->deserialize(QByteArray::fromBase64(base64Str)))
|
||||
{
|
||||
response.init();
|
||||
*response.getGroupName() = newPreset->getGroup();
|
||||
response.setCenterFrequency(newPreset->getCenterFrequency());
|
||||
*response.getName() = newPreset->getDescription();
|
||||
*response.getType() = Preset::getPresetTypeChar(newPreset->getPresetType());
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot deserialize preset from file %1").arg(filePath);
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot read file %1").arg(filePath);
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("File %1 is not found").arg(filePath);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instancePresetFilePost(
|
||||
SWGSDRangel::SWGPresetExport& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
QString filePath = *query.getFilePath();
|
||||
|
||||
if (QFileInfo(filePath).absoluteDir().exists())
|
||||
{
|
||||
SWGSDRangel::SWGPresetIdentifier *presetId = query.getPreset();
|
||||
const Preset *selectedPreset = m_mainCore->m_settings.getPreset(
|
||||
*presetId->getGroupName(),
|
||||
presetId->getCenterFrequency(),
|
||||
*presetId->getName(),
|
||||
*presetId->getType());
|
||||
|
||||
if (selectedPreset)
|
||||
{
|
||||
QString base64Str = selectedPreset->serialize().toBase64();
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
||||
if (fileInfo.suffix() != "prex") {
|
||||
filePath += ".prex";
|
||||
}
|
||||
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.open(QIODevice::ReadWrite | QIODevice::Text))
|
||||
{
|
||||
QTextStream outstream(&file);
|
||||
outstream << base64Str;
|
||||
file.close();
|
||||
response.init();
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getName() = selectedPreset->getDescription();
|
||||
*response.getType() = Preset::getPresetTypeChar(selectedPreset->getPresetType());
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot open %1 for writing").arg(filePath);
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no preset [%1, %2, %3, %4]")
|
||||
.arg(*presetId->getGroupName())
|
||||
.arg(presetId->getCenterFrequency())
|
||||
.arg(*presetId->getName())
|
||||
.arg(*presetId->getType());
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("File %1 directory does not exist").arg(filePath);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instancePresetBlobPut(
|
||||
SWGSDRangel::SWGBase64Blob& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
QString *base64Str = query.getBlob();
|
||||
|
||||
if (base64Str)
|
||||
{
|
||||
Preset *newPreset = m_mainCore->m_settings.newPreset("TBD", "TBD");
|
||||
|
||||
if (newPreset)
|
||||
{
|
||||
QByteArray blob = QByteArray::fromBase64(base64Str->toUtf8());
|
||||
|
||||
if (newPreset->deserialize(blob))
|
||||
{
|
||||
response.init();
|
||||
*response.getGroupName() = newPreset->getGroup();
|
||||
response.setCenterFrequency(newPreset->getCenterFrequency());
|
||||
*response.getName() = newPreset->getDescription();
|
||||
*response.getType() = Preset::getPresetTypeChar(newPreset->getPresetType());
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainCore->m_settings.deletePreset(newPreset);
|
||||
error.init();
|
||||
*error.getMessage() = QString("Could not deserialize blob to preset");
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot create new preset");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Blob not specified");
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instancePresetBlobPost(
|
||||
SWGSDRangel::SWGPresetIdentifier& query,
|
||||
SWGSDRangel::SWGBase64Blob& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
const Preset *selectedPreset = m_mainCore->m_settings.getPreset(
|
||||
*query.getGroupName(),
|
||||
query.getCenterFrequency(),
|
||||
*query.getName(),
|
||||
*query.getType());
|
||||
|
||||
if (selectedPreset)
|
||||
{
|
||||
QString base64Str = selectedPreset->serialize().toBase64();
|
||||
response.init();
|
||||
*response.getBlob() = base64Str;
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no preset [%1, %2, %3, %4]")
|
||||
.arg(*query.getGroupName())
|
||||
.arg(query.getCenterFrequency())
|
||||
.arg(*query.getName())
|
||||
.arg(*query.getType());
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationsGet(
|
||||
SWGSDRangel::SWGConfigurations& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) error;
|
||||
int nbConfigurations = m_mainCore->m_settings.getConfigurationCount();
|
||||
int nbGroups = 0;
|
||||
int nbConfigurationsThisGroup = 0;
|
||||
QString groupName;
|
||||
response.init();
|
||||
QList<SWGSDRangel::SWGConfigurationGroup*> *groups = response.getGroups();
|
||||
QList<SWGSDRangel::SWGConfigurationItem*> *swgConfigurations = nullptr;
|
||||
int i = 0;
|
||||
|
||||
// Configurations are sorted by group first
|
||||
|
||||
for (; i < nbConfigurations; i++)
|
||||
{
|
||||
const Configuration *configuration = m_mainCore->m_settings.getConfiguration(i);
|
||||
|
||||
if ((i == 0) || (groupName != configuration->getGroup())) // new group
|
||||
{
|
||||
if (i > 0) {
|
||||
groups->back()->setNbConfigurations(nbConfigurationsThisGroup);
|
||||
}
|
||||
|
||||
groups->append(new SWGSDRangel::SWGConfigurationGroup);
|
||||
groups->back()->init();
|
||||
groupName = configuration->getGroup();
|
||||
*groups->back()->getGroupName() = groupName;
|
||||
swgConfigurations = groups->back()->getConfigurations();
|
||||
nbGroups++;
|
||||
nbConfigurationsThisGroup = 0;
|
||||
}
|
||||
|
||||
swgConfigurations->append(new SWGSDRangel::SWGConfigurationItem);
|
||||
swgConfigurations->back()->init();
|
||||
*swgConfigurations->back()->getName() = configuration->getDescription();
|
||||
nbConfigurationsThisGroup++;
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
groups->back()->setNbConfigurations(nbConfigurationsThisGroup);
|
||||
}
|
||||
|
||||
response.setNbGroups(nbGroups);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationPatch(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier *configurationIdentifier = &response;
|
||||
|
||||
const Configuration *selectedConfiguration = m_mainCore->m_settings.getConfiguration(
|
||||
*configurationIdentifier->getGroupName(),
|
||||
*configurationIdentifier->getName()
|
||||
);
|
||||
|
||||
if (selectedConfiguration == nullptr)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no configuration [%1, %2]")
|
||||
.arg(*configurationIdentifier->getGroupName())
|
||||
.arg(*configurationIdentifier->getName());
|
||||
return 404;
|
||||
}
|
||||
|
||||
MainCore::MsgLoadConfiguration *msg = MainCore::MsgLoadConfiguration::create(selectedConfiguration);
|
||||
m_mainCore->m_mainMessageQueue->push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getGroupName() = selectedConfiguration->getGroup();
|
||||
*response.getName() = selectedConfiguration->getDescription();
|
||||
|
||||
return 202;
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationPut(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier *configurationIdentifier = &response;
|
||||
|
||||
const Configuration *selectedConfiguration = m_mainCore->m_settings.getConfiguration(
|
||||
*configurationIdentifier->getGroupName(),
|
||||
*configurationIdentifier->getName()
|
||||
);
|
||||
|
||||
if (selectedConfiguration == nullptr)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no configuration [%1, %2]")
|
||||
.arg(*configurationIdentifier->getGroupName())
|
||||
.arg(*configurationIdentifier->getName());
|
||||
return 404;
|
||||
}
|
||||
|
||||
MainCore::MsgSaveConfiguration *msg = MainCore::MsgSaveConfiguration::create(const_cast<Configuration*>(selectedConfiguration), false);
|
||||
m_mainCore->m_mainMessageQueue->push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getGroupName() = selectedConfiguration->getGroup();
|
||||
*response.getName() = selectedConfiguration->getDescription();
|
||||
|
||||
return 202;
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationPost(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier *configurationIdentifier = &response;
|
||||
|
||||
const Configuration *selectedConfiguration = m_mainCore->m_settings.getConfiguration(
|
||||
*configurationIdentifier->getGroupName(),
|
||||
*configurationIdentifier->getName()
|
||||
);
|
||||
|
||||
if (selectedConfiguration == nullptr) // save on a new preset
|
||||
{
|
||||
selectedConfiguration = m_mainCore->m_settings.newConfiguration(
|
||||
*configurationIdentifier->getGroupName(),
|
||||
*configurationIdentifier->getName()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Preset already exists [%1, %2]")
|
||||
.arg(*configurationIdentifier->getGroupName())
|
||||
.arg(*configurationIdentifier->getName());
|
||||
return 409;
|
||||
}
|
||||
|
||||
MainCore::MsgSaveConfiguration *msg = MainCore::MsgSaveConfiguration::create(const_cast<Configuration*>(selectedConfiguration), true);
|
||||
m_mainCore->m_mainMessageQueue->push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getGroupName() = selectedConfiguration->getGroup();
|
||||
*response.getName() = selectedConfiguration->getDescription();
|
||||
|
||||
return 202;
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationDelete(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
const Configuration *selectedConfiguration = m_mainCore->m_settings.getConfiguration(
|
||||
*response.getGroupName(),
|
||||
*response.getName());
|
||||
|
||||
if (selectedConfiguration == nullptr)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no configuration [%1, %2]")
|
||||
.arg(*response.getGroupName())
|
||||
.arg(*response.getName());
|
||||
return 404;
|
||||
}
|
||||
|
||||
*response.getGroupName() = selectedConfiguration->getGroup();
|
||||
*response.getName() = selectedConfiguration->getDescription();
|
||||
|
||||
MainCore::MsgDeleteConfiguration *msg = MainCore::MsgDeleteConfiguration::create(const_cast<Configuration*>(selectedConfiguration));
|
||||
m_mainCore->m_mainMessageQueue->push(msg);
|
||||
|
||||
return 202;
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationFilePut(
|
||||
SWGSDRangel::SWGFilePath& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
QString filePath = *query.getFilePath();
|
||||
|
||||
if (QFileInfo::exists(filePath))
|
||||
{
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QByteArray base64Str;
|
||||
QTextStream instream(&file);
|
||||
instream >> base64Str;
|
||||
file.close();
|
||||
Configuration *newConfiguration = m_mainCore->m_settings.newConfiguration("TBD", "TBD");
|
||||
|
||||
if (newConfiguration->deserialize(QByteArray::fromBase64(base64Str)))
|
||||
{
|
||||
response.init();
|
||||
*response.getGroupName() = newConfiguration->getGroup();
|
||||
*response.getName() = newConfiguration->getDescription();
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot deserialize configuration from file %1").arg(filePath);
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot read file %1").arg(filePath);
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("File %1 is not found").arg(filePath);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationFilePost(
|
||||
SWGSDRangel::SWGConfigurationImportExport& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
QString filePath = *query.getFilePath();
|
||||
|
||||
if (QFileInfo(filePath).absoluteDir().exists())
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier *configurationId = query.getConfiguration();
|
||||
const Configuration *selectedConfiguration = m_mainCore->m_settings.getConfiguration(
|
||||
*configurationId->getGroupName(),
|
||||
*configurationId->getName());
|
||||
|
||||
if (selectedConfiguration)
|
||||
{
|
||||
QString base64Str = selectedConfiguration->serialize().toBase64();
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
||||
if (fileInfo.suffix() != "cfgx") {
|
||||
filePath += ".cfgx";
|
||||
}
|
||||
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.open(QIODevice::ReadWrite | QIODevice::Text))
|
||||
{
|
||||
QTextStream outstream(&file);
|
||||
outstream << base64Str;
|
||||
file.close();
|
||||
response.init();
|
||||
*response.getGroupName() = selectedConfiguration->getGroup();
|
||||
*response.getName() = selectedConfiguration->getDescription();
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot open file %1 for writing").arg(filePath);
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no configuration [%1, %2]")
|
||||
.arg(*configurationId->getGroupName())
|
||||
.arg(*configurationId->getName());
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("File %1 directory does not exist").arg(filePath);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationBlobPut(
|
||||
SWGSDRangel::SWGBase64Blob& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
QString *base64Str = query.getBlob();
|
||||
|
||||
if (base64Str)
|
||||
{
|
||||
Configuration *newConfiguration = m_mainCore->m_settings.newConfiguration("TBD", "TBD");
|
||||
|
||||
if (newConfiguration)
|
||||
{
|
||||
QByteArray blob = QByteArray::fromBase64(base64Str->toUtf8());
|
||||
|
||||
if (newConfiguration->deserialize(blob))
|
||||
{
|
||||
response.init();
|
||||
*response.getGroupName() = newConfiguration->getGroup();
|
||||
*response.getName() = newConfiguration->getDescription();
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainCore->m_settings.deleteConfiguration(newConfiguration);
|
||||
error.init();
|
||||
*error.getMessage() = QString("Could not deserialize blob");
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Cannot create new configuration");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Blob not specified");
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceConfigurationBlobPost(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& query,
|
||||
SWGSDRangel::SWGBase64Blob& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
const Configuration *selectedConfiguration = m_mainCore->m_settings.getConfiguration(
|
||||
*query.getGroupName(),
|
||||
*query.getName());
|
||||
|
||||
if (selectedConfiguration)
|
||||
{
|
||||
QString base64Str = selectedConfiguration->serialize().toBase64();
|
||||
response.init();
|
||||
*response.getBlob() = base64Str;
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no configuration [%1, %2]")
|
||||
.arg(*query.getGroupName())
|
||||
.arg(*query.getName());
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapter::instanceFeaturePresetsGet(
|
||||
SWGSDRangel::SWGFeaturePresets& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
|
|
|
@ -195,6 +195,66 @@ public:
|
|||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instancePresetFilePut(
|
||||
SWGSDRangel::SWGFilePath& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instancePresetFilePost(
|
||||
SWGSDRangel::SWGPresetExport& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instancePresetBlobPut(
|
||||
SWGSDRangel::SWGBase64Blob& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instancePresetBlobPost(
|
||||
SWGSDRangel::SWGPresetIdentifier& query,
|
||||
SWGSDRangel::SWGBase64Blob& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationsGet(
|
||||
SWGSDRangel::SWGConfigurations& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationPatch(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationPut(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationPost(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationDelete(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationFilePut(
|
||||
SWGSDRangel::SWGFilePath& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationFilePost(
|
||||
SWGSDRangel::SWGConfigurationImportExport& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationBlobPut(
|
||||
SWGSDRangel::SWGBase64Blob& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceConfigurationBlobPost(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& query,
|
||||
SWGSDRangel::SWGBase64Blob& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceFeaturePresetsGet(
|
||||
SWGSDRangel::SWGFeaturePresets& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
|
|
@ -40,6 +40,11 @@ QString WebAPIAdapterInterface::instanceLimeRFEPowerURL = "/sdrangel/limerfe/pow
|
|||
QString WebAPIAdapterInterface::instancePresetsURL = "/sdrangel/presets";
|
||||
QString WebAPIAdapterInterface::instancePresetURL = "/sdrangel/preset";
|
||||
QString WebAPIAdapterInterface::instancePresetFileURL = "/sdrangel/preset/file";
|
||||
QString WebAPIAdapterInterface::instancePresetBlobURL = "/sdrangel/preset/blob";
|
||||
QString WebAPIAdapterInterface::instanceConfigurationsURL = "/sdrangel/configurations";
|
||||
QString WebAPIAdapterInterface::instanceConfigurationURL = "/sdrangel/configuration";
|
||||
QString WebAPIAdapterInterface::instanceConfigurationFileURL = "/sdrangel/configuration/file";
|
||||
QString WebAPIAdapterInterface::instanceConfigurationBlobURL = "/sdrangel/configuration/blob";
|
||||
QString WebAPIAdapterInterface::instanceFeaturePresetsURL = "/sdrangel/featurepresets";
|
||||
QString WebAPIAdapterInterface::instanceFeaturePresetURL = "/sdrangel/featurepreset";
|
||||
QString WebAPIAdapterInterface::instanceDeviceSetsURL = "/sdrangel/devicesets";
|
||||
|
|
|
@ -51,6 +51,14 @@ namespace SWGSDRangel
|
|||
class SWGPresetIdentifier;
|
||||
class SWGPresetImport;
|
||||
class SWGPresetExport;
|
||||
class SWGPresetDeserialize;
|
||||
class SWGPresetSerialize;
|
||||
class SWGBase64Blob;
|
||||
class SWGFilePath;
|
||||
class SWGConfigurations;
|
||||
class SWGConfigurationIdentifier;
|
||||
class SWGConfigurationImportExport;
|
||||
class SWGConfigurationDeserialize;
|
||||
class SWGDeviceSetList;
|
||||
class SWGDeviceSet;
|
||||
class SWGDeviceListItem;
|
||||
|
@ -625,7 +633,7 @@ public:
|
|||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instancePresetFilePut(
|
||||
SWGSDRangel::SWGPresetImport& query,
|
||||
SWGSDRangel::SWGFilePath& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
|
@ -652,6 +660,172 @@ public:
|
|||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/preset/blob (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instancePresetBlobPut(
|
||||
SWGSDRangel::SWGBase64Blob& query,
|
||||
SWGSDRangel::SWGPresetIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) query;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/preset/blob (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instancePresetBlobPost(
|
||||
SWGSDRangel::SWGPresetIdentifier& query,
|
||||
SWGSDRangel::SWGBase64Blob& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) query;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/presets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationsGet(
|
||||
SWGSDRangel::SWGConfigurations& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationPatch(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationPut(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationPost(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationDelete(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration/file (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationFilePut(
|
||||
SWGSDRangel::SWGFilePath& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) query;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration/file (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationFilePost(
|
||||
SWGSDRangel::SWGConfigurationImportExport& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) query;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration/blob (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationBlobPut(
|
||||
SWGSDRangel::SWGBase64Blob& query,
|
||||
SWGSDRangel::SWGConfigurationIdentifier& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) query;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/configuration/blob (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceConfigurationBlobPost(
|
||||
SWGSDRangel::SWGConfigurationIdentifier& query,
|
||||
SWGSDRangel::SWGBase64Blob& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) query;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/featurepresets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
|
@ -1468,6 +1642,11 @@ public:
|
|||
static QString instancePresetsURL;
|
||||
static QString instancePresetURL;
|
||||
static QString instancePresetFileURL;
|
||||
static QString instancePresetBlobURL;
|
||||
static QString instanceConfigurationsURL;
|
||||
static QString instanceConfigurationURL;
|
||||
static QString instanceConfigurationFileURL;
|
||||
static QString instanceConfigurationBlobURL;
|
||||
static QString instanceFeaturePresetsURL;
|
||||
static QString instanceFeaturePresetURL;
|
||||
static QString instanceDeviceSetsURL;
|
||||
|
|
|
@ -43,6 +43,11 @@
|
|||
#include "SWGPresetIdentifier.h"
|
||||
#include "SWGPresetImport.h"
|
||||
#include "SWGPresetExport.h"
|
||||
#include "SWGBase64Blob.h"
|
||||
#include "SWGFilePath.h"
|
||||
#include "SWGConfigurations.h"
|
||||
#include "SWGConfigurationIdentifier.h"
|
||||
#include "SWGConfigurationImportExport.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
|
@ -151,6 +156,16 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
|||
instancePresetService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instancePresetFileURL) {
|
||||
instancePresetFileService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instancePresetBlobURL) {
|
||||
instancePresetBlobService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceConfigurationsURL) {
|
||||
instanceConfigurationsService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceConfigurationURL) {
|
||||
instanceConfigurationService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceConfigurationFileURL) {
|
||||
instanceConfigurationFileService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceConfigurationBlobURL) {
|
||||
instanceConfigurationBlobService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceFeaturePresetsURL) {
|
||||
instanceFeaturePresetsService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceFeaturePresetURL) {
|
||||
|
@ -1287,7 +1302,7 @@ void WebAPIRequestMapper::instancePresetFileService(qtwebapp::HttpRequest& reque
|
|||
|
||||
if (request.getMethod() == "PUT")
|
||||
{
|
||||
SWGSDRangel::SWGPresetImport query;
|
||||
SWGSDRangel::SWGFilePath query;
|
||||
SWGSDRangel::SWGPresetIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
@ -1370,6 +1385,462 @@ void WebAPIRequestMapper::instancePresetFileService(qtwebapp::HttpRequest& reque
|
|||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instancePresetBlobService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (request.getMethod() == "PUT")
|
||||
{
|
||||
SWGSDRangel::SWGBase64Blob query;
|
||||
SWGSDRangel::SWGPresetIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
query.fromJson(jsonStr);
|
||||
|
||||
if (query.getBlob())
|
||||
{
|
||||
int status = m_adapter->instancePresetBlobPut(query, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "POST")
|
||||
{
|
||||
SWGSDRangel::SWGPresetIdentifier query;
|
||||
SWGSDRangel::SWGBase64Blob normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
query.fromJson(jsonStr);
|
||||
|
||||
if (validatePresetIdentifer(query))
|
||||
{
|
||||
int status = m_adapter->instancePresetBlobPost(query, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instanceConfigurationsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurations normalResponse;
|
||||
int status = m_adapter->instanceConfigurationsGet(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instanceConfigurationService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (request.getMethod() == "PATCH")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
normalResponse.fromJson(jsonStr);
|
||||
|
||||
if (validateConfigurationIdentifier(normalResponse))
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationPatch(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "PUT")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
normalResponse.fromJson(jsonStr);
|
||||
|
||||
if (validateConfigurationIdentifier(normalResponse))
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationPut(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "POST")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
normalResponse.fromJson(jsonStr);
|
||||
|
||||
if (validateConfigurationIdentifier(normalResponse))
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationPost(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "DELETE")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
normalResponse.fromJson(jsonStr);
|
||||
|
||||
if (validateConfigurationIdentifier(normalResponse))
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationDelete(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instanceConfigurationFileService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (request.getMethod() == "PUT")
|
||||
{
|
||||
SWGSDRangel::SWGFilePath query;
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
query.fromJson(jsonStr);
|
||||
|
||||
if (query.getFilePath())
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationFilePut(query, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "POST")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationImportExport query;
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
query.fromJson(jsonStr);
|
||||
|
||||
if (query.getFilePath() && query.getConfiguration() && validateConfigurationIdentifier(*query.getConfiguration()))
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationFilePost(query, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instanceConfigurationBlobService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (request.getMethod() == "PUT")
|
||||
{
|
||||
SWGSDRangel::SWGBase64Blob query;
|
||||
SWGSDRangel::SWGConfigurationIdentifier normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
query.fromJson(jsonStr);
|
||||
|
||||
if (query.getBlob())
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationBlobPut(query, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "POST")
|
||||
{
|
||||
SWGSDRangel::SWGConfigurationIdentifier query;
|
||||
SWGSDRangel::SWGBase64Blob normalResponse;
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
query.fromJson(jsonStr);
|
||||
|
||||
if (validateConfigurationIdentifier(query))
|
||||
{
|
||||
int status = m_adapter->instanceConfigurationBlobPost(query, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON request");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON request";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(400,"Invalid JSON format");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid JSON format";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instanceFeaturePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
|
@ -3096,6 +3567,11 @@ bool WebAPIRequestMapper::validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifi
|
|||
return (presetIdentifier.getGroupName() && presetIdentifier.getName() && presetIdentifier.getType());
|
||||
}
|
||||
|
||||
bool WebAPIRequestMapper::validateConfigurationIdentifier(SWGSDRangel::SWGConfigurationIdentifier& configruationIdentifier)
|
||||
{
|
||||
return configruationIdentifier.getGroupName() && configruationIdentifier.getName();
|
||||
}
|
||||
|
||||
bool WebAPIRequestMapper::validateFeaturePresetIdentifer(SWGSDRangel::SWGFeaturePresetIdentifier& presetIdentifier)
|
||||
{
|
||||
return (presetIdentifier.getGroupName() && presetIdentifier.getDescription());
|
||||
|
@ -3116,6 +3592,21 @@ bool WebAPIRequestMapper::validatePresetExport(SWGSDRangel::SWGPresetExport& pre
|
|||
return validatePresetIdentifer(*presetIdentifier);
|
||||
}
|
||||
|
||||
bool WebAPIRequestMapper::validateConfigurationImportExport(SWGSDRangel::SWGConfigurationImportExport& configurationImportExport)
|
||||
{
|
||||
if (configurationImportExport.getFilePath() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SWGSDRangel::SWGConfigurationIdentifier *congfigurationIdentifier = configurationImportExport.getConfiguration();
|
||||
|
||||
if (congfigurationIdentifier == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return validateConfigurationIdentifier(*congfigurationIdentifier);
|
||||
}
|
||||
|
||||
bool WebAPIRequestMapper::validateDeviceListItem(SWGSDRangel::SWGDeviceListItem& deviceListItem, QJsonObject& jsonObject)
|
||||
{
|
||||
if (jsonObject.contains("direction")) {
|
||||
|
|
|
@ -76,6 +76,11 @@ private:
|
|||
void instancePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instancePresetFileService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instancePresetBlobService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceConfigurationsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceConfigurationService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceConfigurationFileService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceConfigurationBlobService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceFeaturePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceFeaturePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceDeviceSetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
|
@ -124,6 +129,8 @@ private:
|
|||
bool validateAMBEDevices(SWGSDRangel::SWGAMBEDevices& ambeDevices, QJsonObject& jsonObject);
|
||||
bool validateLimeRFEConfig(SWGSDRangel::SWGLimeRFESettings& limeRFESettings, QJsonObject& jsonObject, QStringList& limeRFESettingsKeys);
|
||||
bool validateConfig(SWGSDRangel::SWGInstanceConfigResponse& config, QJsonObject& jsonObject, WebAPIAdapterInterface::ConfigKeys& configKeys);
|
||||
bool validateConfigurationIdentifier(SWGSDRangel::SWGConfigurationIdentifier& configurationIdentifier);
|
||||
bool validateConfigurationImportExport(SWGSDRangel::SWGConfigurationImportExport& configuratopmImportExport);
|
||||
|
||||
bool appendFeatureSetPresetKeys(
|
||||
SWGSDRangel::SWGFeatureSetPreset *preset,
|
||||
|
|
|
@ -1599,6 +1599,28 @@ bool MainWindow::handleMessage(const Message& cmd)
|
|||
m_mainCore->m_settings.deletePreset(presetToDelete);
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgLoadConfiguration::match(cmd))
|
||||
{
|
||||
MainCore::MsgLoadConfiguration& notif = (MainCore::MsgLoadConfiguration&) cmd;
|
||||
const Configuration *configuration = notif.getConfiguration();
|
||||
loadConfiguration(configuration, false);
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgSaveConfiguration::match(cmd))
|
||||
{
|
||||
MainCore::MsgSaveConfiguration& notif = (MainCore::MsgSaveConfiguration&) cmd;
|
||||
Configuration *configuration = notif.getConfiguration();
|
||||
saveConfiguration(configuration);
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgDeleteConfiguration::match(cmd))
|
||||
{
|
||||
MainCore::MsgDeleteConfiguration& notif = (MainCore::MsgDeleteConfiguration&) cmd;
|
||||
const Configuration *configurationToDelete = notif.getConfiguration();
|
||||
// remove configuration from settings
|
||||
m_mainCore->m_settings.deleteConfiguration(configurationToDelete);
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgDeleteFeatureSetPreset::match(cmd))
|
||||
{
|
||||
MainCore::MsgDeleteFeatureSetPreset& notif = (MainCore::MsgDeleteFeatureSetPreset&) cmd;
|
||||
|
|
|
@ -133,6 +133,14 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||
m_mainCore->m_settings.deletePreset(presetToDelete);
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgDeleteConfiguration::match(cmd))
|
||||
{
|
||||
MainCore::MsgDeleteConfiguration& notif = (MainCore::MsgDeleteConfiguration&) cmd;
|
||||
const Configuration *configuationToDelete = notif.getConfiguration();
|
||||
// remove configuration from settings
|
||||
m_mainCore->m_settings.deleteConfiguration(configuationToDelete);
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgLoadFeatureSetPreset::match(cmd))
|
||||
{
|
||||
MainCore::MsgLoadFeatureSetPreset& notif = (MainCore::MsgLoadFeatureSetPreset&) cmd;
|
||||
|
|
|
@ -821,7 +821,7 @@ paths:
|
|||
/sdrangel/preset/file:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: import a preset from file as a new preset (server only).
|
||||
description: import a preset from file as a new preset.
|
||||
operationId: instancePresetFilePut
|
||||
tags:
|
||||
- Instance
|
||||
|
@ -830,10 +830,10 @@ paths:
|
|||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: import details
|
||||
description: File path
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/PresetImport"
|
||||
$ref: "#/definitions/FilePath"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return preset identification
|
||||
|
@ -883,6 +883,337 @@ paths:
|
|||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/preset/blob:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: deserialize base64 blob to a new preset.
|
||||
operationId: instancePresetBlobPut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Blob in base64 format
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return preset identification
|
||||
schema:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: serialize a preset to a base64 blob.
|
||||
operationId: instancePresetBlobPost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Preset identification
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return blob
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Preset not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configurations:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
description: List all configurations in the instance
|
||||
operationId: instanceConfigurationsGet
|
||||
tags:
|
||||
- Instance
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configurations list
|
||||
schema:
|
||||
$ref: "#/definitions/Configurations"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configuration:
|
||||
x-swagger-router-controller: instance
|
||||
patch:
|
||||
description: Load a configuration
|
||||
operationId: instanceConfigurationPatch
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Load configuration settings
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the selected configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: No configuration found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
put:
|
||||
description: Update an existing configuration with current setup.
|
||||
operationId: instanceConfigurationPut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: save setup to the configuration
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the selected configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: No configuration found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: Create a new configuration from the current setup.
|
||||
operationId: instanceConfigurationPost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: save setup in a new configuration
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the created configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"409":
|
||||
description: Configuration already exists
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
delete:
|
||||
description: Deletes a configuration
|
||||
operationId: instanceConfigurationDelete
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: delete this configuration
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"202":
|
||||
description: On successful sending of the message the selected configuration identification is returned
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Configuration not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configuration/file:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: import a configuration from file as a new configuration.
|
||||
operationId: instanceConfigurationFilePut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: File path
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/FilePath"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configuration identification
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: File not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: export a configuration to file.
|
||||
operationId: instanceConfigurationFilePost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: export details
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationImportExport"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configuration identification
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Configuration or file path not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/configuration/blob:
|
||||
x-swagger-router-controller: instance
|
||||
put:
|
||||
description: deserialize base64 blob to a new configuration.
|
||||
operationId: instanceConfigurationBlobPut
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Blob in base64 format
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return configuration identification
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
post:
|
||||
description: serialize a configuration to a base64 blob.
|
||||
operationId: instanceConfigurationBlobPost
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: configuration identification
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return blob
|
||||
schema:
|
||||
$ref: "#/definitions/Base64Blob"
|
||||
"400":
|
||||
description: Invalid JSON request
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Preset not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/featurepresets:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
|
@ -3034,28 +3365,106 @@ definitions:
|
|||
$ref: "#/definitions/PresetIdentifier"
|
||||
|
||||
PresetImport:
|
||||
description: "Details to import preset from file in preset list"
|
||||
description: "Details to import new preset from file"
|
||||
required:
|
||||
- filePath
|
||||
properties:
|
||||
groupName:
|
||||
description: "If present overrides imported preset group name with this name"
|
||||
type: string
|
||||
description:
|
||||
description: "If present overrides imported preset description with this description"
|
||||
type: string
|
||||
preset:
|
||||
description: "New preset details"
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
filePath:
|
||||
description: "Path of the import file"
|
||||
type: string
|
||||
|
||||
PresetExport:
|
||||
description: "Details to export a preset to file"
|
||||
description: "Details to export a preset to a file"
|
||||
properties:
|
||||
filePath:
|
||||
description: "Path of the export file"
|
||||
type: string
|
||||
preset:
|
||||
description: "Preset to export"
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
|
||||
Base64Blob:
|
||||
description: "Binary blob in base64 format"
|
||||
required:
|
||||
- blob
|
||||
properties:
|
||||
blob:
|
||||
description: "Blob in base64"
|
||||
type: string
|
||||
|
||||
FilePath:
|
||||
description: "File path"
|
||||
required:
|
||||
- filePath
|
||||
properties:
|
||||
filePath:
|
||||
description: "File path"
|
||||
type: string
|
||||
|
||||
Configurations:
|
||||
description: "Configuration presets"
|
||||
required:
|
||||
- nbGroups
|
||||
properties:
|
||||
nbGroups:
|
||||
description: "Number of configuration groups"
|
||||
type: integer
|
||||
groups:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/ConfigurationGroup"
|
||||
|
||||
ConfigurationGroup:
|
||||
description: "Group of configuration"
|
||||
required:
|
||||
- groupName
|
||||
- nbPresets
|
||||
properties:
|
||||
groupName:
|
||||
description: "Name of the configuration group"
|
||||
type: string
|
||||
nbConfigurations:
|
||||
description: "Number of configurations in the group"
|
||||
type: integer
|
||||
configurations:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/ConfigurationItem"
|
||||
|
||||
ConfigurationIdentifier:
|
||||
description: "Configuration item"
|
||||
required:
|
||||
- groupName
|
||||
- name
|
||||
properties:
|
||||
groupName:
|
||||
description: "Name of the preset group"
|
||||
type: string
|
||||
name:
|
||||
description: "Descriptive name of the preset"
|
||||
type: string
|
||||
|
||||
ConfigurationItem:
|
||||
description: "Configuration preset item"
|
||||
required:
|
||||
- name
|
||||
properties:
|
||||
name:
|
||||
description: "Descriptive name of the configuration"
|
||||
type: string
|
||||
|
||||
ConfigurationImportExport:
|
||||
description: "Details to impprt/export a configuration from/to file"
|
||||
properties:
|
||||
filePath:
|
||||
description: "Path of the import file"
|
||||
type: string
|
||||
preset:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
configuration:
|
||||
description: "On import new configuration details. On export configuration to export from"
|
||||
$ref: "#/definitions/ConfigurationIdentifier"
|
||||
|
||||
FeaturePresets:
|
||||
description: "Feature settings presets"
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,110 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGBase64Blob.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGBase64Blob::SWGBase64Blob(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGBase64Blob::SWGBase64Blob() {
|
||||
blob = nullptr;
|
||||
m_blob_isSet = false;
|
||||
}
|
||||
|
||||
SWGBase64Blob::~SWGBase64Blob() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGBase64Blob::init() {
|
||||
blob = new QString("");
|
||||
m_blob_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGBase64Blob::cleanup() {
|
||||
if(blob != nullptr) {
|
||||
delete blob;
|
||||
}
|
||||
}
|
||||
|
||||
SWGBase64Blob*
|
||||
SWGBase64Blob::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGBase64Blob::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&blob, pJson["blob"], "QString", "QString");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGBase64Blob::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGBase64Blob::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(blob != nullptr && *blob != QString("")){
|
||||
toJsonValue(QString("blob"), blob, obj, QString("QString"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGBase64Blob::getBlob() {
|
||||
return blob;
|
||||
}
|
||||
void
|
||||
SWGBase64Blob::setBlob(QString* blob) {
|
||||
this->blob = blob;
|
||||
this->m_blob_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGBase64Blob::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(blob && *blob != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* 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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGBase64Blob.h
|
||||
*
|
||||
* Binary blob in base64 format
|
||||
*/
|
||||
|
||||
#ifndef SWGBase64Blob_H_
|
||||
#define SWGBase64Blob_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGBase64Blob: public SWGObject {
|
||||
public:
|
||||
SWGBase64Blob();
|
||||
SWGBase64Blob(QString* json);
|
||||
virtual ~SWGBase64Blob();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGBase64Blob* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getBlob();
|
||||
void setBlob(QString* blob);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* blob;
|
||||
bool m_blob_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGBase64Blob_H_ */
|
|
@ -0,0 +1,162 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGConfigurationGroup.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGConfigurationGroup::SWGConfigurationGroup(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGConfigurationGroup::SWGConfigurationGroup() {
|
||||
group_name = nullptr;
|
||||
m_group_name_isSet = false;
|
||||
nb_configurations = 0;
|
||||
m_nb_configurations_isSet = false;
|
||||
configurations = nullptr;
|
||||
m_configurations_isSet = false;
|
||||
}
|
||||
|
||||
SWGConfigurationGroup::~SWGConfigurationGroup() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationGroup::init() {
|
||||
group_name = new QString("");
|
||||
m_group_name_isSet = false;
|
||||
nb_configurations = 0;
|
||||
m_nb_configurations_isSet = false;
|
||||
configurations = new QList<SWGConfigurationItem*>();
|
||||
m_configurations_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationGroup::cleanup() {
|
||||
if(group_name != nullptr) {
|
||||
delete group_name;
|
||||
}
|
||||
|
||||
if(configurations != nullptr) {
|
||||
auto arr = configurations;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete configurations;
|
||||
}
|
||||
}
|
||||
|
||||
SWGConfigurationGroup*
|
||||
SWGConfigurationGroup::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationGroup::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&nb_configurations, pJson["nbConfigurations"], "qint32", "");
|
||||
|
||||
|
||||
::SWGSDRangel::setValue(&configurations, pJson["configurations"], "QList", "SWGConfigurationItem");
|
||||
}
|
||||
|
||||
QString
|
||||
SWGConfigurationGroup::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGConfigurationGroup::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(group_name != nullptr && *group_name != QString("")){
|
||||
toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
|
||||
}
|
||||
if(m_nb_configurations_isSet){
|
||||
obj->insert("nbConfigurations", QJsonValue(nb_configurations));
|
||||
}
|
||||
if(configurations && configurations->size() > 0){
|
||||
toJsonArray((QList<void*>*)configurations, obj, "configurations", "SWGConfigurationItem");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGConfigurationGroup::getGroupName() {
|
||||
return group_name;
|
||||
}
|
||||
void
|
||||
SWGConfigurationGroup::setGroupName(QString* group_name) {
|
||||
this->group_name = group_name;
|
||||
this->m_group_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGConfigurationGroup::getNbConfigurations() {
|
||||
return nb_configurations;
|
||||
}
|
||||
void
|
||||
SWGConfigurationGroup::setNbConfigurations(qint32 nb_configurations) {
|
||||
this->nb_configurations = nb_configurations;
|
||||
this->m_nb_configurations_isSet = true;
|
||||
}
|
||||
|
||||
QList<SWGConfigurationItem*>*
|
||||
SWGConfigurationGroup::getConfigurations() {
|
||||
return configurations;
|
||||
}
|
||||
void
|
||||
SWGConfigurationGroup::setConfigurations(QList<SWGConfigurationItem*>* configurations) {
|
||||
this->configurations = configurations;
|
||||
this->m_configurations_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGConfigurationGroup::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(group_name && *group_name != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_nb_configurations_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(configurations && (configurations->size() > 0)){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGConfigurationGroup.h
|
||||
*
|
||||
* Group of configuration
|
||||
*/
|
||||
|
||||
#ifndef SWGConfigurationGroup_H_
|
||||
#define SWGConfigurationGroup_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGConfigurationItem.h"
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGConfigurationGroup: public SWGObject {
|
||||
public:
|
||||
SWGConfigurationGroup();
|
||||
SWGConfigurationGroup(QString* json);
|
||||
virtual ~SWGConfigurationGroup();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGConfigurationGroup* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getGroupName();
|
||||
void setGroupName(QString* group_name);
|
||||
|
||||
qint32 getNbConfigurations();
|
||||
void setNbConfigurations(qint32 nb_configurations);
|
||||
|
||||
QList<SWGConfigurationItem*>* getConfigurations();
|
||||
void setConfigurations(QList<SWGConfigurationItem*>* configurations);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* group_name;
|
||||
bool m_group_name_isSet;
|
||||
|
||||
qint32 nb_configurations;
|
||||
bool m_nb_configurations_isSet;
|
||||
|
||||
QList<SWGConfigurationItem*>* configurations;
|
||||
bool m_configurations_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGConfigurationGroup_H_ */
|
|
@ -0,0 +1,135 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGConfigurationIdentifier.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGConfigurationIdentifier::SWGConfigurationIdentifier(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGConfigurationIdentifier::SWGConfigurationIdentifier() {
|
||||
group_name = nullptr;
|
||||
m_group_name_isSet = false;
|
||||
name = nullptr;
|
||||
m_name_isSet = false;
|
||||
}
|
||||
|
||||
SWGConfigurationIdentifier::~SWGConfigurationIdentifier() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationIdentifier::init() {
|
||||
group_name = new QString("");
|
||||
m_group_name_isSet = false;
|
||||
name = new QString("");
|
||||
m_name_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationIdentifier::cleanup() {
|
||||
if(group_name != nullptr) {
|
||||
delete group_name;
|
||||
}
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
}
|
||||
|
||||
SWGConfigurationIdentifier*
|
||||
SWGConfigurationIdentifier::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationIdentifier::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGConfigurationIdentifier::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGConfigurationIdentifier::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(group_name != nullptr && *group_name != QString("")){
|
||||
toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
|
||||
}
|
||||
if(name != nullptr && *name != QString("")){
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGConfigurationIdentifier::getGroupName() {
|
||||
return group_name;
|
||||
}
|
||||
void
|
||||
SWGConfigurationIdentifier::setGroupName(QString* group_name) {
|
||||
this->group_name = group_name;
|
||||
this->m_group_name_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGConfigurationIdentifier::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
SWGConfigurationIdentifier::setName(QString* name) {
|
||||
this->name = name;
|
||||
this->m_name_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGConfigurationIdentifier::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(group_name && *group_name != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(name && *name != QString("")){
|
||||
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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGConfigurationIdentifier.h
|
||||
*
|
||||
* Configuration item
|
||||
*/
|
||||
|
||||
#ifndef SWGConfigurationIdentifier_H_
|
||||
#define SWGConfigurationIdentifier_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGConfigurationIdentifier: public SWGObject {
|
||||
public:
|
||||
SWGConfigurationIdentifier();
|
||||
SWGConfigurationIdentifier(QString* json);
|
||||
virtual ~SWGConfigurationIdentifier();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGConfigurationIdentifier* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getGroupName();
|
||||
void setGroupName(QString* group_name);
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* group_name;
|
||||
bool m_group_name_isSet;
|
||||
|
||||
QString* name;
|
||||
bool m_name_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGConfigurationIdentifier_H_ */
|
|
@ -0,0 +1,135 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGConfigurationImportExport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGConfigurationImportExport::SWGConfigurationImportExport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGConfigurationImportExport::SWGConfigurationImportExport() {
|
||||
file_path = nullptr;
|
||||
m_file_path_isSet = false;
|
||||
configuration = nullptr;
|
||||
m_configuration_isSet = false;
|
||||
}
|
||||
|
||||
SWGConfigurationImportExport::~SWGConfigurationImportExport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationImportExport::init() {
|
||||
file_path = new QString("");
|
||||
m_file_path_isSet = false;
|
||||
configuration = new SWGConfigurationIdentifier();
|
||||
m_configuration_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationImportExport::cleanup() {
|
||||
if(file_path != nullptr) {
|
||||
delete file_path;
|
||||
}
|
||||
if(configuration != nullptr) {
|
||||
delete configuration;
|
||||
}
|
||||
}
|
||||
|
||||
SWGConfigurationImportExport*
|
||||
SWGConfigurationImportExport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationImportExport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&configuration, pJson["configuration"], "SWGConfigurationIdentifier", "SWGConfigurationIdentifier");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGConfigurationImportExport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGConfigurationImportExport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(file_path != nullptr && *file_path != QString("")){
|
||||
toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
|
||||
}
|
||||
if((configuration != nullptr) && (configuration->isSet())){
|
||||
toJsonValue(QString("configuration"), configuration, obj, QString("SWGConfigurationIdentifier"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGConfigurationImportExport::getFilePath() {
|
||||
return file_path;
|
||||
}
|
||||
void
|
||||
SWGConfigurationImportExport::setFilePath(QString* file_path) {
|
||||
this->file_path = file_path;
|
||||
this->m_file_path_isSet = true;
|
||||
}
|
||||
|
||||
SWGConfigurationIdentifier*
|
||||
SWGConfigurationImportExport::getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
void
|
||||
SWGConfigurationImportExport::setConfiguration(SWGConfigurationIdentifier* configuration) {
|
||||
this->configuration = configuration;
|
||||
this->m_configuration_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGConfigurationImportExport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(file_path && *file_path != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(configuration && configuration->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* 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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGConfigurationImportExport.h
|
||||
*
|
||||
* Details to impprt/export a configuration from/to file
|
||||
*/
|
||||
|
||||
#ifndef SWGConfigurationImportExport_H_
|
||||
#define SWGConfigurationImportExport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGConfigurationIdentifier.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGConfigurationImportExport: public SWGObject {
|
||||
public:
|
||||
SWGConfigurationImportExport();
|
||||
SWGConfigurationImportExport(QString* json);
|
||||
virtual ~SWGConfigurationImportExport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGConfigurationImportExport* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getFilePath();
|
||||
void setFilePath(QString* file_path);
|
||||
|
||||
SWGConfigurationIdentifier* getConfiguration();
|
||||
void setConfiguration(SWGConfigurationIdentifier* configuration);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* file_path;
|
||||
bool m_file_path_isSet;
|
||||
|
||||
SWGConfigurationIdentifier* configuration;
|
||||
bool m_configuration_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGConfigurationImportExport_H_ */
|
|
@ -0,0 +1,110 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGConfigurationItem.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGConfigurationItem::SWGConfigurationItem(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGConfigurationItem::SWGConfigurationItem() {
|
||||
name = nullptr;
|
||||
m_name_isSet = false;
|
||||
}
|
||||
|
||||
SWGConfigurationItem::~SWGConfigurationItem() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationItem::init() {
|
||||
name = new QString("");
|
||||
m_name_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationItem::cleanup() {
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
}
|
||||
|
||||
SWGConfigurationItem*
|
||||
SWGConfigurationItem::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurationItem::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGConfigurationItem::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGConfigurationItem::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(name != nullptr && *name != QString("")){
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGConfigurationItem::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
SWGConfigurationItem::setName(QString* name) {
|
||||
this->name = name;
|
||||
this->m_name_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGConfigurationItem::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(name && *name != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* 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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGConfigurationItem.h
|
||||
*
|
||||
* Configuration preset item
|
||||
*/
|
||||
|
||||
#ifndef SWGConfigurationItem_H_
|
||||
#define SWGConfigurationItem_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGConfigurationItem: public SWGObject {
|
||||
public:
|
||||
SWGConfigurationItem();
|
||||
SWGConfigurationItem(QString* json);
|
||||
virtual ~SWGConfigurationItem();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGConfigurationItem* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* name;
|
||||
bool m_name_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGConfigurationItem_H_ */
|
|
@ -0,0 +1,137 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGConfigurations.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGConfigurations::SWGConfigurations(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGConfigurations::SWGConfigurations() {
|
||||
nb_groups = 0;
|
||||
m_nb_groups_isSet = false;
|
||||
groups = nullptr;
|
||||
m_groups_isSet = false;
|
||||
}
|
||||
|
||||
SWGConfigurations::~SWGConfigurations() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurations::init() {
|
||||
nb_groups = 0;
|
||||
m_nb_groups_isSet = false;
|
||||
groups = new QList<SWGConfigurationGroup*>();
|
||||
m_groups_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurations::cleanup() {
|
||||
|
||||
if(groups != nullptr) {
|
||||
auto arr = groups;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete groups;
|
||||
}
|
||||
}
|
||||
|
||||
SWGConfigurations*
|
||||
SWGConfigurations::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGConfigurations::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&nb_groups, pJson["nbGroups"], "qint32", "");
|
||||
|
||||
|
||||
::SWGSDRangel::setValue(&groups, pJson["groups"], "QList", "SWGConfigurationGroup");
|
||||
}
|
||||
|
||||
QString
|
||||
SWGConfigurations::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGConfigurations::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_nb_groups_isSet){
|
||||
obj->insert("nbGroups", QJsonValue(nb_groups));
|
||||
}
|
||||
if(groups && groups->size() > 0){
|
||||
toJsonArray((QList<void*>*)groups, obj, "groups", "SWGConfigurationGroup");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGConfigurations::getNbGroups() {
|
||||
return nb_groups;
|
||||
}
|
||||
void
|
||||
SWGConfigurations::setNbGroups(qint32 nb_groups) {
|
||||
this->nb_groups = nb_groups;
|
||||
this->m_nb_groups_isSet = true;
|
||||
}
|
||||
|
||||
QList<SWGConfigurationGroup*>*
|
||||
SWGConfigurations::getGroups() {
|
||||
return groups;
|
||||
}
|
||||
void
|
||||
SWGConfigurations::setGroups(QList<SWGConfigurationGroup*>* groups) {
|
||||
this->groups = groups;
|
||||
this->m_groups_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGConfigurations::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_nb_groups_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(groups && (groups->size() > 0)){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* 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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGConfigurations.h
|
||||
*
|
||||
* Configuration presets
|
||||
*/
|
||||
|
||||
#ifndef SWGConfigurations_H_
|
||||
#define SWGConfigurations_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGConfigurationGroup.h"
|
||||
#include <QList>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGConfigurations: public SWGObject {
|
||||
public:
|
||||
SWGConfigurations();
|
||||
SWGConfigurations(QString* json);
|
||||
virtual ~SWGConfigurations();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGConfigurations* fromJson(QString &jsonString) override;
|
||||
|
||||
qint32 getNbGroups();
|
||||
void setNbGroups(qint32 nb_groups);
|
||||
|
||||
QList<SWGConfigurationGroup*>* getGroups();
|
||||
void setGroups(QList<SWGConfigurationGroup*>* groups);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
qint32 nb_groups;
|
||||
bool m_nb_groups_isSet;
|
||||
|
||||
QList<SWGConfigurationGroup*>* groups;
|
||||
bool m_groups_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGConfigurations_H_ */
|
|
@ -0,0 +1,110 @@
|
|||
/**
|
||||
* 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: 6.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 "SWGFilePath.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGFilePath::SWGFilePath(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGFilePath::SWGFilePath() {
|
||||
file_path = nullptr;
|
||||
m_file_path_isSet = false;
|
||||
}
|
||||
|
||||
SWGFilePath::~SWGFilePath() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGFilePath::init() {
|
||||
file_path = new QString("");
|
||||
m_file_path_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGFilePath::cleanup() {
|
||||
if(file_path != nullptr) {
|
||||
delete file_path;
|
||||
}
|
||||
}
|
||||
|
||||
SWGFilePath*
|
||||
SWGFilePath::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGFilePath::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGFilePath::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGFilePath::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(file_path != nullptr && *file_path != QString("")){
|
||||
toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGFilePath::getFilePath() {
|
||||
return file_path;
|
||||
}
|
||||
void
|
||||
SWGFilePath::setFilePath(QString* file_path) {
|
||||
this->file_path = file_path;
|
||||
this->m_file_path_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGFilePath::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(file_path && *file_path != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* 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: 6.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGFilePath.h
|
||||
*
|
||||
* File path
|
||||
*/
|
||||
|
||||
#ifndef SWGFilePath_H_
|
||||
#define SWGFilePath_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGFilePath: public SWGObject {
|
||||
public:
|
||||
SWGFilePath();
|
||||
SWGFilePath(QString* json);
|
||||
virtual ~SWGFilePath();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGFilePath* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getFilePath();
|
||||
void setFilePath(QString* file_path);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* file_path;
|
||||
bool m_file_path_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGFilePath_H_ */
|
|
@ -892,6 +892,498 @@ SWGInstanceApi::instanceConfigPutCallback(SWGHttpRequestWorker * worker) {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationBlobPost(SWGConfigurationIdentifier& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration/blob");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationBlobPostCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationBlobPostCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGBase64Blob* output = static_cast<SWGBase64Blob*>(create(json, QString("SWGBase64Blob")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationBlobPostSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationBlobPostSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationBlobPostSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationBlobPut(SWGBase64Blob& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration/blob");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationBlobPutCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationBlobPutCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationBlobPutSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationBlobPutSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationBlobPutSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationDelete(SWGConfigurationIdentifier& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationDeleteCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationDeleteCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationDeleteSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationDeleteSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationDeleteSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationFilePost(SWGConfigurationImportExport& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration/file");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationFilePostCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationFilePostCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationFilePostSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationFilePostSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationFilePostSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationFilePut(SWGFilePath& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration/file");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationFilePutCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationFilePutCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationFilePutSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationFilePutSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationFilePutSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationPatch(SWGConfigurationIdentifier& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "PATCH");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationPatchCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationPatchCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationPatchSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationPatchSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationPatchSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationPost(SWGConfigurationIdentifier& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationPostCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationPostCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationPostSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationPostSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationPostSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationPut(SWGConfigurationIdentifier& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configuration");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationPutCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationPutCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurationIdentifier* output = static_cast<SWGConfigurationIdentifier*>(create(json, QString("SWGConfigurationIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationPutSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationPutSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationPutSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationsGet() {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/configurations");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceConfigurationsGetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceConfigurationsGetCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGConfigurations* output = static_cast<SWGConfigurations*>(create(json, QString("SWGConfigurations")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceConfigurationsGetSignal(output);
|
||||
} else {
|
||||
emit instanceConfigurationsGetSignalE(output, error_type, error_str);
|
||||
emit instanceConfigurationsGetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceDelete() {
|
||||
QString fullPath;
|
||||
|
@ -1711,6 +2203,116 @@ SWGInstanceApi::instanceLoggingPutCallback(SWGHttpRequestWorker * worker) {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instancePresetBlobPost(SWGPresetIdentifier& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/blob");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instancePresetBlobPostCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instancePresetBlobPostCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGBase64Blob* output = static_cast<SWGBase64Blob*>(create(json, QString("SWGBase64Blob")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instancePresetBlobPostSignal(output);
|
||||
} else {
|
||||
emit instancePresetBlobPostSignalE(output, error_type, error_str);
|
||||
emit instancePresetBlobPostSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instancePresetBlobPut(SWGBase64Blob& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/blob");
|
||||
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output.toUtf8());
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instancePresetBlobPutCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instancePresetBlobPutCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instancePresetBlobPutSignal(output);
|
||||
} else {
|
||||
emit instancePresetBlobPutSignalE(output, error_type, error_str);
|
||||
emit instancePresetBlobPutSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier& body) {
|
||||
QString fullPath;
|
||||
|
@ -1822,7 +2424,7 @@ SWGInstanceApi::instancePresetFilePostCallback(SWGHttpRequestWorker * worker) {
|
|||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instancePresetFilePut(SWGPresetImport& body) {
|
||||
SWGInstanceApi::instancePresetFilePut(SWGFilePath& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file");
|
||||
|
||||
|
|
|
@ -20,11 +20,16 @@
|
|||
#include "SWGAudioDevices.h"
|
||||
#include "SWGAudioInputDevice.h"
|
||||
#include "SWGAudioOutputDevice.h"
|
||||
#include "SWGBase64Blob.h"
|
||||
#include "SWGConfigurationIdentifier.h"
|
||||
#include "SWGConfigurationImportExport.h"
|
||||
#include "SWGConfigurations.h"
|
||||
#include "SWGDVSerialDevices.h"
|
||||
#include "SWGDeviceSetList.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
#include "SWGFeaturePresetIdentifier.h"
|
||||
#include "SWGFeaturePresets.h"
|
||||
#include "SWGFilePath.h"
|
||||
#include "SWGInstanceChannelsResponse.h"
|
||||
#include "SWGInstanceConfigResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
|
@ -37,7 +42,6 @@
|
|||
#include "SWGLoggingInfo.h"
|
||||
#include "SWGPresetExport.h"
|
||||
#include "SWGPresetIdentifier.h"
|
||||
#include "SWGPresetImport.h"
|
||||
#include "SWGPresetTransfer.h"
|
||||
#include "SWGPresets.h"
|
||||
#include "SWGSuccessResponse.h"
|
||||
|
@ -74,6 +78,15 @@ public:
|
|||
void instanceConfigGet();
|
||||
void instanceConfigPatch(SWGInstanceConfigResponse& body);
|
||||
void instanceConfigPut(SWGInstanceConfigResponse& body);
|
||||
void instanceConfigurationBlobPost(SWGConfigurationIdentifier& body);
|
||||
void instanceConfigurationBlobPut(SWGBase64Blob& body);
|
||||
void instanceConfigurationDelete(SWGConfigurationIdentifier& body);
|
||||
void instanceConfigurationFilePost(SWGConfigurationImportExport& body);
|
||||
void instanceConfigurationFilePut(SWGFilePath& body);
|
||||
void instanceConfigurationPatch(SWGConfigurationIdentifier& body);
|
||||
void instanceConfigurationPost(SWGConfigurationIdentifier& body);
|
||||
void instanceConfigurationPut(SWGConfigurationIdentifier& body);
|
||||
void instanceConfigurationsGet();
|
||||
void instanceDelete();
|
||||
void instanceDeviceSetsGet();
|
||||
void instanceDevices(qint32 direction);
|
||||
|
@ -89,9 +102,11 @@ public:
|
|||
void instanceLocationPut(SWGLocationInformation& body);
|
||||
void instanceLoggingGet();
|
||||
void instanceLoggingPut(SWGLoggingInfo& body);
|
||||
void instancePresetBlobPost(SWGPresetIdentifier& body);
|
||||
void instancePresetBlobPut(SWGBase64Blob& body);
|
||||
void instancePresetDelete(SWGPresetIdentifier& body);
|
||||
void instancePresetFilePost(SWGPresetExport& body);
|
||||
void instancePresetFilePut(SWGPresetImport& body);
|
||||
void instancePresetFilePut(SWGFilePath& body);
|
||||
void instancePresetGet();
|
||||
void instancePresetPatch(SWGPresetTransfer& body);
|
||||
void instancePresetPost(SWGPresetTransfer& body);
|
||||
|
@ -115,6 +130,15 @@ private:
|
|||
void instanceConfigGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigPatchCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationBlobPostCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationBlobPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationDeleteCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationFilePostCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationFilePutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationPatchCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationPostCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceConfigurationsGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceDeleteCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceDeviceSetsGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceDevicesCallback (SWGHttpRequestWorker * worker);
|
||||
|
@ -130,6 +154,8 @@ private:
|
|||
void instanceLocationPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLoggingGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLoggingPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instancePresetBlobPostCallback (SWGHttpRequestWorker * worker);
|
||||
void instancePresetBlobPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instancePresetDeleteCallback (SWGHttpRequestWorker * worker);
|
||||
void instancePresetFilePostCallback (SWGHttpRequestWorker * worker);
|
||||
void instancePresetFilePutCallback (SWGHttpRequestWorker * worker);
|
||||
|
@ -156,6 +182,15 @@ signals:
|
|||
void instanceConfigGetSignal(SWGInstanceConfigResponse* summary);
|
||||
void instanceConfigPatchSignal(SWGSuccessResponse* summary);
|
||||
void instanceConfigPutSignal(SWGSuccessResponse* summary);
|
||||
void instanceConfigurationBlobPostSignal(SWGBase64Blob* summary);
|
||||
void instanceConfigurationBlobPutSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationDeleteSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationFilePostSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationFilePutSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationPatchSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationPostSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationPutSignal(SWGConfigurationIdentifier* summary);
|
||||
void instanceConfigurationsGetSignal(SWGConfigurations* summary);
|
||||
void instanceDeleteSignal(SWGInstanceSummaryResponse* summary);
|
||||
void instanceDeviceSetsGetSignal(SWGDeviceSetList* summary);
|
||||
void instanceDevicesSignal(SWGInstanceDevicesResponse* summary);
|
||||
|
@ -171,6 +206,8 @@ signals:
|
|||
void instanceLocationPutSignal(SWGLocationInformation* summary);
|
||||
void instanceLoggingGetSignal(SWGLoggingInfo* summary);
|
||||
void instanceLoggingPutSignal(SWGLoggingInfo* summary);
|
||||
void instancePresetBlobPostSignal(SWGBase64Blob* summary);
|
||||
void instancePresetBlobPutSignal(SWGPresetIdentifier* summary);
|
||||
void instancePresetDeleteSignal(SWGPresetIdentifier* summary);
|
||||
void instancePresetFilePostSignal(SWGPresetIdentifier* summary);
|
||||
void instancePresetFilePutSignal(SWGPresetIdentifier* summary);
|
||||
|
@ -196,6 +233,15 @@ signals:
|
|||
void instanceConfigGetSignalE(SWGInstanceConfigResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigPatchSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigPutSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationBlobPostSignalE(SWGBase64Blob* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationBlobPutSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationDeleteSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationFilePostSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationFilePutSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationPatchSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationPostSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationPutSignalE(SWGConfigurationIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationsGetSignalE(SWGConfigurations* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceDeleteSignalE(SWGInstanceSummaryResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceDeviceSetsGetSignalE(SWGDeviceSetList* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceDevicesSignalE(SWGInstanceDevicesResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
@ -211,6 +257,8 @@ signals:
|
|||
void instanceLocationPutSignalE(SWGLocationInformation* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLoggingGetSignalE(SWGLoggingInfo* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLoggingPutSignalE(SWGLoggingInfo* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetBlobPostSignalE(SWGBase64Blob* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetBlobPutSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetDeleteSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetFilePostSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetFilePutSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
@ -236,6 +284,15 @@ signals:
|
|||
void instanceConfigGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationBlobPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationBlobPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationFilePostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationFilePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceConfigurationsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceDeviceSetsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceDevicesSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
@ -251,6 +308,8 @@ signals:
|
|||
void instanceLocationPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLoggingGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLoggingPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetBlobPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetBlobPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetFilePostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instancePresetFilePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "SWGBFMDemodReport.h"
|
||||
#include "SWGBFMDemodSettings.h"
|
||||
#include "SWGBandwidth.h"
|
||||
#include "SWGBase64Blob.h"
|
||||
#include "SWGBeamSteeringCWModSettings.h"
|
||||
#include "SWGBladeRF1InputSettings.h"
|
||||
#include "SWGBladeRF1OutputSettings.h"
|
||||
|
@ -80,6 +81,11 @@
|
|||
#include "SWGChirpChatModSettings.h"
|
||||
#include "SWGCommand.h"
|
||||
#include "SWGComplex.h"
|
||||
#include "SWGConfigurationGroup.h"
|
||||
#include "SWGConfigurationIdentifier.h"
|
||||
#include "SWGConfigurationImportExport.h"
|
||||
#include "SWGConfigurationItem.h"
|
||||
#include "SWGConfigurations.h"
|
||||
#include "SWGDABDemodSettings.h"
|
||||
#include "SWGDATVDemodReport.h"
|
||||
#include "SWGDATVDemodSettings.h"
|
||||
|
@ -116,6 +122,7 @@
|
|||
#include "SWGFileInputReport.h"
|
||||
#include "SWGFileInputSettings.h"
|
||||
#include "SWGFileOutputSettings.h"
|
||||
#include "SWGFilePath.h"
|
||||
#include "SWGFileSinkActions.h"
|
||||
#include "SWGFileSinkReport.h"
|
||||
#include "SWGFileSinkSettings.h"
|
||||
|
@ -520,6 +527,11 @@ namespace SWGSDRangel {
|
|||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGBase64Blob").compare(type) == 0) {
|
||||
SWGBase64Blob *obj = new SWGBase64Blob();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGBeamSteeringCWModSettings").compare(type) == 0) {
|
||||
SWGBeamSteeringCWModSettings *obj = new SWGBeamSteeringCWModSettings();
|
||||
obj->init();
|
||||
|
@ -650,6 +662,31 @@ namespace SWGSDRangel {
|
|||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGConfigurationGroup").compare(type) == 0) {
|
||||
SWGConfigurationGroup *obj = new SWGConfigurationGroup();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGConfigurationIdentifier").compare(type) == 0) {
|
||||
SWGConfigurationIdentifier *obj = new SWGConfigurationIdentifier();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGConfigurationImportExport").compare(type) == 0) {
|
||||
SWGConfigurationImportExport *obj = new SWGConfigurationImportExport();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGConfigurationItem").compare(type) == 0) {
|
||||
SWGConfigurationItem *obj = new SWGConfigurationItem();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGConfigurations").compare(type) == 0) {
|
||||
SWGConfigurations *obj = new SWGConfigurations();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGDABDemodSettings").compare(type) == 0) {
|
||||
SWGDABDemodSettings *obj = new SWGDABDemodSettings();
|
||||
obj->init();
|
||||
|
@ -830,6 +867,11 @@ namespace SWGSDRangel {
|
|||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGFilePath").compare(type) == 0) {
|
||||
SWGFilePath *obj = new SWGFilePath();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGFileSinkActions").compare(type) == 0) {
|
||||
SWGFileSinkActions *obj = new SWGFileSinkActions();
|
||||
obj->init();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/*
|
||||
* SWGPresetExport.h
|
||||
*
|
||||
* Details to export a preset to file
|
||||
* Details to export a preset to a file
|
||||
*/
|
||||
|
||||
#ifndef SWGPresetExport_H_
|
||||
|
|
|
@ -28,10 +28,8 @@ SWGPresetImport::SWGPresetImport(QString* json) {
|
|||
}
|
||||
|
||||
SWGPresetImport::SWGPresetImport() {
|
||||
group_name = nullptr;
|
||||
m_group_name_isSet = false;
|
||||
description = nullptr;
|
||||
m_description_isSet = false;
|
||||
preset = nullptr;
|
||||
m_preset_isSet = false;
|
||||
file_path = nullptr;
|
||||
m_file_path_isSet = false;
|
||||
}
|
||||
|
@ -42,21 +40,16 @@ SWGPresetImport::~SWGPresetImport() {
|
|||
|
||||
void
|
||||
SWGPresetImport::init() {
|
||||
group_name = new QString("");
|
||||
m_group_name_isSet = false;
|
||||
description = new QString("");
|
||||
m_description_isSet = false;
|
||||
preset = new SWGPresetIdentifier();
|
||||
m_preset_isSet = false;
|
||||
file_path = new QString("");
|
||||
m_file_path_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGPresetImport::cleanup() {
|
||||
if(group_name != nullptr) {
|
||||
delete group_name;
|
||||
}
|
||||
if(description != nullptr) {
|
||||
delete description;
|
||||
if(preset != nullptr) {
|
||||
delete preset;
|
||||
}
|
||||
if(file_path != nullptr) {
|
||||
delete file_path;
|
||||
|
@ -74,9 +67,7 @@ SWGPresetImport::fromJson(QString &json) {
|
|||
|
||||
void
|
||||
SWGPresetImport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&description, pJson["description"], "QString", "QString");
|
||||
::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
|
||||
|
||||
::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
|
||||
|
||||
|
@ -96,11 +87,8 @@ SWGPresetImport::asJson ()
|
|||
QJsonObject*
|
||||
SWGPresetImport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(group_name != nullptr && *group_name != QString("")){
|
||||
toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
|
||||
}
|
||||
if(description != nullptr && *description != QString("")){
|
||||
toJsonValue(QString("description"), description, obj, QString("QString"));
|
||||
if((preset != nullptr) && (preset->isSet())){
|
||||
toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier"));
|
||||
}
|
||||
if(file_path != nullptr && *file_path != QString("")){
|
||||
toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
|
||||
|
@ -109,24 +97,14 @@ SWGPresetImport::asJsonObject() {
|
|||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGPresetImport::getGroupName() {
|
||||
return group_name;
|
||||
SWGPresetIdentifier*
|
||||
SWGPresetImport::getPreset() {
|
||||
return preset;
|
||||
}
|
||||
void
|
||||
SWGPresetImport::setGroupName(QString* group_name) {
|
||||
this->group_name = group_name;
|
||||
this->m_group_name_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGPresetImport::getDescription() {
|
||||
return description;
|
||||
}
|
||||
void
|
||||
SWGPresetImport::setDescription(QString* description) {
|
||||
this->description = description;
|
||||
this->m_description_isSet = true;
|
||||
SWGPresetImport::setPreset(SWGPresetIdentifier* preset) {
|
||||
this->preset = preset;
|
||||
this->m_preset_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
|
@ -144,10 +122,7 @@ bool
|
|||
SWGPresetImport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(group_name && *group_name != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(description && *description != QString("")){
|
||||
if(preset && preset->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(file_path && *file_path != QString("")){
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/*
|
||||
* SWGPresetImport.h
|
||||
*
|
||||
* Details to import preset from file in preset list
|
||||
* Details to import new preset from file
|
||||
*/
|
||||
|
||||
#ifndef SWGPresetImport_H_
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGPresetIdentifier.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
|
@ -42,11 +43,8 @@ public:
|
|||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGPresetImport* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getGroupName();
|
||||
void setGroupName(QString* group_name);
|
||||
|
||||
QString* getDescription();
|
||||
void setDescription(QString* description);
|
||||
SWGPresetIdentifier* getPreset();
|
||||
void setPreset(SWGPresetIdentifier* preset);
|
||||
|
||||
QString* getFilePath();
|
||||
void setFilePath(QString* file_path);
|
||||
|
@ -55,11 +53,8 @@ public:
|
|||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* group_name;
|
||||
bool m_group_name_isSet;
|
||||
|
||||
QString* description;
|
||||
bool m_description_isSet;
|
||||
SWGPresetIdentifier* preset;
|
||||
bool m_preset_isSet;
|
||||
|
||||
QString* file_path;
|
||||
bool m_file_path_isSet;
|
||||
|
|
Ładowanie…
Reference in New Issue