1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

API: added /sdrangel/features (GET) to get the list of available feature plugins

This commit is contained in:
f4exb 2021-08-29 00:48:35 +02:00
parent 0ec7ec414d
commit 8d68fa5231
17 changed files with 1512 additions and 2 deletions

View File

@ -4808,6 +4808,32 @@ margin-bottom: 20px;
} }
}, },
"description" : "Represents a FeatureSetPreset::FeatureConfig object" "description" : "Represents a FeatureSetPreset::FeatureConfig object"
};
defs.FeatureListItem = {
"required" : [ "id" ],
"properties" : {
"name" : {
"type" : "string",
"description" : "Displayable name of the feature plugin"
},
"idURI" : {
"type" : "string",
"description" : "Key to identify the feature plugin type in URI form"
},
"id" : {
"type" : "string",
"description" : "Key to identify the feature plugin type as short object name"
},
"version" : {
"type" : "string",
"description" : "Feature plugin version number"
},
"index" : {
"type" : "integer",
"description" : "Index of the feature in the list of registered channels"
}
},
"description" : "Summarized information about feature plugin"
}; };
defs.FeatureReport = { defs.FeatureReport = {
"required" : [ "featureType" ], "required" : [ "featureType" ],
@ -6061,6 +6087,22 @@ margin-bottom: 20px;
} }
}, },
"description" : "Summarized information about logical devices from hardware devices attached to this SDRangel instance" "description" : "Summarized information about logical devices from hardware devices attached to this SDRangel instance"
};
defs.InstanceFeaturesResponse = {
"required" : [ "featurecount" ],
"properties" : {
"featurecount" : {
"type" : "integer",
"description" : "Number of plugins available"
},
"features" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/FeatureListItem"
}
}
},
"description" : "Summarized information about feature plugins available in this SDRangel instance"
}; };
defs.InstanceSummaryResponse = { defs.InstanceSummaryResponse = {
"required" : [ "appname", "architecture", "devicesetlist", "dspRxBits", "dspTxBits", "os", "pid", "qtVersion", "version" ], "required" : [ "appname", "architecture", "devicesetlist", "dspRxBits", "dspTxBits", "os", "pid", "qtVersion", "version" ],
@ -12593,6 +12635,9 @@ margin-bottom: 20px;
<li data-group="Instance" data-name="instanceFeatureSetsGet" class=""> <li data-group="Instance" data-name="instanceFeatureSetsGet" class="">
<a href="#api-Instance-instanceFeatureSetsGet">instanceFeatureSetsGet</a> <a href="#api-Instance-instanceFeatureSetsGet">instanceFeatureSetsGet</a>
</li> </li>
<li data-group="Instance" data-name="instanceFeatures" class="">
<a href="#api-Instance-instanceFeatures">instanceFeatures</a>
</li>
<li data-group="Instance" data-name="instanceLimeRFEConfigGet" class=""> <li data-group="Instance" data-name="instanceLimeRFEConfigGet" class="">
<a href="#api-Instance-instanceLimeRFEConfigGet">instanceLimeRFEConfigGet</a> <a href="#api-Instance-instanceLimeRFEConfigGet">instanceLimeRFEConfigGet</a>
</li> </li>
@ -40680,6 +40725,341 @@ except ApiException as e:
</article> </article>
</div> </div>
<hr> <hr>
<div id="api-Instance-instanceFeatures">
<article id="api-Instance-instanceFeatures-0" data-group="User" data-name="instanceFeatures" data-version="0">
<div class="pull-left">
<h1>instanceFeatures</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">Get a list of feature plugins available in this instance</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/features</span></code></pre>
<p>
<h3>Usage and SDK Samples</h3>
</p>
<ul class="nav nav-tabs nav-tabs-examples">
<li class="active"><a href="#examples-Instance-instanceFeatures-0-curl">Curl</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-java">Java</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-android">Android</a></li>
<!--<li class=""><a href="#examples-Instance-instanceFeatures-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-Instance-instanceFeatures-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-Instance-instanceFeatures-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-Instance-instanceFeatures-0-csharp">C#</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-php">PHP</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-perl">Perl</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-Instance-instanceFeatures-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/features"</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.InstanceApi;
import java.io.File;
import java.util.*;
public class InstanceApiExample {
public static void main(String[] args) {
InstanceApi apiInstance = new InstanceApi();
try {
InstanceFeaturesResponse result = apiInstance.instanceFeatures();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceFeatures");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.InstanceApi;
public class InstanceApiExample {
public static void main(String[] args) {
InstanceApi apiInstance = new InstanceApi();
try {
InstanceFeaturesResponse result = apiInstance.instanceFeatures();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceFeatures");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-objc">
<pre class="prettyprint"><code class="language-cpp">
InstanceApi *apiInstance = [[InstanceApi alloc] init];
[apiInstance instanceFeaturesWithCompletionHandler:
^(InstanceFeaturesResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.InstanceApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.instanceFeatures(callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-Instance-instanceFeatures-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-csharp">
<pre class="prettyprint"><code class="language-cs">using System;
using System.Diagnostics;
using SWGSDRangel.Api;
using SWGSDRangel.Client;
using SWGSDRangel.Model;
namespace Example
{
public class instanceFeaturesExample
{
public void main()
{
var apiInstance = new InstanceApi();
try
{
InstanceFeaturesResponse result = apiInstance.instanceFeatures();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling InstanceApi.instanceFeatures: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\InstanceApi();
try {
$result = $api_instance->instanceFeatures();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling InstanceApi->instanceFeatures: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::InstanceApi;
my $api_instance = SWGSDRangel::InstanceApi->new();
eval {
my $result = $api_instance->instanceFeatures();
print Dumper($result);
};
if ($@) {
warn "Exception when calling InstanceApi->instanceFeatures: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-python">
<pre class="prettyprint"><code class="language-python">from __future__ import print_statement
import time
import swagger_sdrangel
from swagger_sdrangel.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_sdrangel.InstanceApi()
try:
api_response = api_instance.instance_features()
pprint(api_response)
except ApiException as e:
print("Exception when calling InstanceApi->instanceFeatures: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<h2>Responses</h2>
<h3> Status: 200 - Success </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceFeatures-200-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceFeatures-200-schema">
<div id='responses-instanceFeatures-200-schema-200' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "Success",
"schema" : {
"$ref" : "#/definitions/InstanceFeaturesResponse"
}
};
var schema = schemaWrapper.schema;
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
});
}
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-instanceFeatures-200-schema-data').val(stringify(schema));
var result = $('#responses-instanceFeatures-200-schema-200');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceFeatures-200-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 500 - Error </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceFeatures-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceFeatures-500-schema">
<div id='responses-instanceFeatures-500-schema-500' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "Error",
"schema" : {
"$ref" : "#/definitions/ErrorResponse"
}
};
var schema = schemaWrapper.schema;
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
});
}
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-instanceFeatures-500-schema-data').val(stringify(schema));
var result = $('#responses-instanceFeatures-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceFeatures-500-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 501 - Function not implemented </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceFeatures-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceFeatures-501-schema">
<div id='responses-instanceFeatures-501-schema-501' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "Function not implemented",
"schema" : {
"$ref" : "#/definitions/ErrorResponse"
}
};
var schema = schemaWrapper.schema;
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
});
}
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-instanceFeatures-501-schema-data').val(stringify(schema));
var result = $('#responses-instanceFeatures-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceFeatures-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-Instance-instanceLimeRFEConfigGet"> <div id="api-Instance-instanceLimeRFEConfigGet">
<article id="api-Instance-instanceLimeRFEConfigGet-0" data-group="User" data-name="instanceLimeRFEConfigGet" data-version="0"> <article id="api-Instance-instanceLimeRFEConfigGet-0" data-group="User" data-name="instanceLimeRFEConfigGet" data-version="0">
<div class="pull-left"> <div class="pull-left">
@ -47728,7 +48108,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2021-08-25T15:15:18.832+02:00 Generated 2021-08-28T23:40:46.879+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -185,6 +185,23 @@ paths:
"501": "501":
$ref: "#/responses/Response_501" $ref: "#/responses/Response_501"
/sdrangel/features:
x-swagger-router-controller: instance
get:
description: Get a list of feature plugins available in this instance
operationId: instanceFeatures
tags:
- Instance
responses:
"200":
description: Success
schema:
$ref: "#/definitions/InstanceFeaturesResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/logging: /sdrangel/logging:
x-swagger-router-controller: instance x-swagger-router-controller: instance
get: get:
@ -2398,6 +2415,19 @@ definitions:
items: items:
$ref: "#/definitions/ChannelListItem" $ref: "#/definitions/ChannelListItem"
InstanceFeaturesResponse:
description: "Summarized information about feature plugins available in this SDRangel instance"
required:
- featurecount
properties:
featurecount:
description: "Number of plugins available"
type: integer
features:
type: array
items:
$ref: "#/definitions/FeatureListItem"
ErrorResponse: ErrorResponse:
required: required:
- message - message
@ -2484,6 +2514,27 @@ definitions:
description: "Index of the channel in the list of registered channels" description: "Index of the channel in the list of registered channels"
type: integer type: integer
FeatureListItem:
description: "Summarized information about feature plugin"
required:
- id
properties:
name:
description: "Displayable name of the feature plugin"
type: string
idURI:
description: "Key to identify the feature plugin type in URI form"
type: string
id:
description: "Key to identify the feature plugin type as short object name"
type: string
version:
description: "Feature plugin version number"
type: string
index:
description: "Index of the feature in the list of registered channels"
type: integer
DeviceSet: DeviceSet:
description: "Sampling device and its associated channels" description: "Sampling device and its associated channels"
required: required:

View File

@ -45,6 +45,7 @@
#include "SWGInstanceConfigResponse.h" #include "SWGInstanceConfigResponse.h"
#include "SWGInstanceDevicesResponse.h" #include "SWGInstanceDevicesResponse.h"
#include "SWGInstanceChannelsResponse.h" #include "SWGInstanceChannelsResponse.h"
#include "SWGInstanceFeaturesResponse.h"
#include "SWGDeviceListItem.h" #include "SWGDeviceListItem.h"
#include "SWGAudioDevices.h" #include "SWGAudioDevices.h"
#include "SWGLocationInformation.h" #include "SWGLocationInformation.h"
@ -346,6 +347,37 @@ int WebAPIAdapter::instanceChannels(
return 200; return 200;
} }
int WebAPIAdapter::instanceFeatures(
SWGSDRangel::SWGInstanceFeaturesResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) error;
response.init();
PluginAPI::FeatureRegistrations *featureRegistrations;
int nbFeatureDevices;
featureRegistrations = m_mainCore->m_pluginManager->getFeatureRegistrations();
nbFeatureDevices = featureRegistrations->size();
response.setFeaturecount(nbFeatureDevices);
QList<SWGSDRangel::SWGFeatureListItem*> *features = response.getFeatures();
for (int i = 0; i < nbFeatureDevices; i++)
{
features->append(new SWGSDRangel::SWGFeatureListItem);
features->back()->init();
PluginInterface *featureInterface = featureRegistrations->at(i).m_plugin;
const PluginDescriptor& pluginDescriptor = featureInterface->getPluginDescriptor();
*features->back()->getVersion() = pluginDescriptor.version;
*features->back()->getName() = pluginDescriptor.displayedName;
*features->back()->getIdUri() = featureRegistrations->at(i).m_featureIdURI;
*features->back()->getId() = featureRegistrations->at(i).m_featureId;
features->back()->setIndex(i);
}
return 200;
}
int WebAPIAdapter::instanceLoggingGet( int WebAPIAdapter::instanceLoggingGet(
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)

View File

@ -64,6 +64,10 @@ public:
SWGSDRangel::SWGInstanceChannelsResponse& response, SWGSDRangel::SWGInstanceChannelsResponse& response,
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);
virtual int instanceFeatures(
SWGSDRangel::SWGInstanceFeaturesResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int instanceLoggingGet( virtual int instanceLoggingGet(
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);

View File

@ -23,6 +23,7 @@ QString WebAPIAdapterInterface::instanceSummaryURL = "/sdrangel";
QString WebAPIAdapterInterface::instanceConfigURL = "/sdrangel/config"; QString WebAPIAdapterInterface::instanceConfigURL = "/sdrangel/config";
QString WebAPIAdapterInterface::instanceDevicesURL = "/sdrangel/devices"; QString WebAPIAdapterInterface::instanceDevicesURL = "/sdrangel/devices";
QString WebAPIAdapterInterface::instanceChannelsURL = "/sdrangel/channels"; QString WebAPIAdapterInterface::instanceChannelsURL = "/sdrangel/channels";
QString WebAPIAdapterInterface::instanceFeaturesURL = "/sdrangel/features";
QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging"; QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging";
QString WebAPIAdapterInterface::instanceAudioURL = "/sdrangel/audio"; QString WebAPIAdapterInterface::instanceAudioURL = "/sdrangel/audio";
QString WebAPIAdapterInterface::instanceAudioInputParametersURL = "/sdrangel/audio/input/parameters"; QString WebAPIAdapterInterface::instanceAudioInputParametersURL = "/sdrangel/audio/input/parameters";

View File

@ -34,6 +34,7 @@ namespace SWGSDRangel
class SWGInstanceConfigResponse; class SWGInstanceConfigResponse;
class SWGInstanceDevicesResponse; class SWGInstanceDevicesResponse;
class SWGInstanceChannelsResponse; class SWGInstanceChannelsResponse;
class SWGInstanceFeaturesResponse;
class SWGPreferences; class SWGPreferences;
class SWGLoggingInfo; class SWGLoggingInfo;
class SWGAudioDevices; class SWGAudioDevices;
@ -214,6 +215,20 @@ public:
return 501; return 501;
} }
/**
* Handler of /sdrangel/features (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
*/
virtual int instanceFeatures(
SWGSDRangel::SWGInstanceFeaturesResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) response;
error.init();
*error.getMessage() = QString("Function not implemented");
return 501;
}
/** /**
* Handler of /sdrangel/logging (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels * Handler of /sdrangel/logging (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented) * returns the Http status code (default 501: not implemented)
@ -1357,6 +1372,7 @@ public:
static QString instanceConfigURL; static QString instanceConfigURL;
static QString instanceDevicesURL; static QString instanceDevicesURL;
static QString instanceChannelsURL; static QString instanceChannelsURL;
static QString instanceFeaturesURL;
static QString instanceLoggingURL; static QString instanceLoggingURL;
static QString instanceAudioURL; static QString instanceAudioURL;
static QString instanceAudioInputParametersURL; static QString instanceAudioInputParametersURL;

View File

@ -30,6 +30,7 @@
#include "SWGInstanceConfigResponse.h" #include "SWGInstanceConfigResponse.h"
#include "SWGInstanceDevicesResponse.h" #include "SWGInstanceDevicesResponse.h"
#include "SWGInstanceChannelsResponse.h" #include "SWGInstanceChannelsResponse.h"
#include "SWGInstanceFeaturesResponse.h"
#include "SWGAudioDevices.h" #include "SWGAudioDevices.h"
#include "SWGLocationInformation.h" #include "SWGLocationInformation.h"
#include "SWGDVSerialDevices.h" #include "SWGDVSerialDevices.h"
@ -115,6 +116,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
instanceDevicesService(request, response); instanceDevicesService(request, response);
} else if (path == WebAPIAdapterInterface::instanceChannelsURL) { } else if (path == WebAPIAdapterInterface::instanceChannelsURL) {
instanceChannelsService(request, response); instanceChannelsService(request, response);
} else if (path == WebAPIAdapterInterface::instanceFeaturesURL) {
instanceFeaturesService(request, response);
} else if (path == WebAPIAdapterInterface::instanceLoggingURL) { } else if (path == WebAPIAdapterInterface::instanceLoggingURL) {
instanceLoggingService(request, response); instanceLoggingService(request, response);
} else if (path == WebAPIAdapterInterface::instanceAudioURL) { } else if (path == WebAPIAdapterInterface::instanceAudioURL) {
@ -422,6 +425,33 @@ void WebAPIRequestMapper::instanceChannelsService(qtwebapp::HttpRequest& request
} }
} }
void WebAPIRequestMapper::instanceFeaturesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGInstanceFeaturesResponse normalResponse;
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
response.setHeader("Access-Control-Allow-Origin", "*");
if (request.getMethod() == "GET")
{
int status = m_adapter->instanceFeatures(normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
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::instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) void WebAPIRequestMapper::instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{ {
SWGSDRangel::SWGLoggingInfo query; SWGSDRangel::SWGLoggingInfo query;

View File

@ -58,6 +58,7 @@ private:
void instanceConfigService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceConfigService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceDevicesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceDevicesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceChannelsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceChannelsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceFeaturesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceAudioService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceAudioService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceAudioInputParametersService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceAudioInputParametersService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);

View File

@ -185,6 +185,23 @@ paths:
"501": "501":
$ref: "#/responses/Response_501" $ref: "#/responses/Response_501"
/sdrangel/features:
x-swagger-router-controller: instance
get:
description: Get a list of feature plugins available in this instance
operationId: instanceFeatures
tags:
- Instance
responses:
"200":
description: Success
schema:
$ref: "#/definitions/InstanceFeaturesResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/logging: /sdrangel/logging:
x-swagger-router-controller: instance x-swagger-router-controller: instance
get: get:
@ -2398,6 +2415,19 @@ definitions:
items: items:
$ref: "#/definitions/ChannelListItem" $ref: "#/definitions/ChannelListItem"
InstanceFeaturesResponse:
description: "Summarized information about feature plugins available in this SDRangel instance"
required:
- featurecount
properties:
featurecount:
description: "Number of plugins available"
type: integer
features:
type: array
items:
$ref: "#/definitions/FeatureListItem"
ErrorResponse: ErrorResponse:
required: required:
- message - message
@ -2484,6 +2514,27 @@ definitions:
description: "Index of the channel in the list of registered channels" description: "Index of the channel in the list of registered channels"
type: integer type: integer
FeatureListItem:
description: "Summarized information about feature plugin"
required:
- id
properties:
name:
description: "Displayable name of the feature plugin"
type: string
idURI:
description: "Key to identify the feature plugin type in URI form"
type: string
id:
description: "Key to identify the feature plugin type as short object name"
type: string
version:
description: "Feature plugin version number"
type: string
index:
description: "Index of the feature in the list of registered channels"
type: integer
DeviceSet: DeviceSet:
description: "Sampling device and its associated channels" description: "Sampling device and its associated channels"
required: required:

View File

@ -4808,6 +4808,32 @@ margin-bottom: 20px;
} }
}, },
"description" : "Represents a FeatureSetPreset::FeatureConfig object" "description" : "Represents a FeatureSetPreset::FeatureConfig object"
};
defs.FeatureListItem = {
"required" : [ "id" ],
"properties" : {
"name" : {
"type" : "string",
"description" : "Displayable name of the feature plugin"
},
"idURI" : {
"type" : "string",
"description" : "Key to identify the feature plugin type in URI form"
},
"id" : {
"type" : "string",
"description" : "Key to identify the feature plugin type as short object name"
},
"version" : {
"type" : "string",
"description" : "Feature plugin version number"
},
"index" : {
"type" : "integer",
"description" : "Index of the feature in the list of registered channels"
}
},
"description" : "Summarized information about feature plugin"
}; };
defs.FeatureReport = { defs.FeatureReport = {
"required" : [ "featureType" ], "required" : [ "featureType" ],
@ -6061,6 +6087,22 @@ margin-bottom: 20px;
} }
}, },
"description" : "Summarized information about logical devices from hardware devices attached to this SDRangel instance" "description" : "Summarized information about logical devices from hardware devices attached to this SDRangel instance"
};
defs.InstanceFeaturesResponse = {
"required" : [ "featurecount" ],
"properties" : {
"featurecount" : {
"type" : "integer",
"description" : "Number of plugins available"
},
"features" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/FeatureListItem"
}
}
},
"description" : "Summarized information about feature plugins available in this SDRangel instance"
}; };
defs.InstanceSummaryResponse = { defs.InstanceSummaryResponse = {
"required" : [ "appname", "architecture", "devicesetlist", "dspRxBits", "dspTxBits", "os", "pid", "qtVersion", "version" ], "required" : [ "appname", "architecture", "devicesetlist", "dspRxBits", "dspTxBits", "os", "pid", "qtVersion", "version" ],
@ -12593,6 +12635,9 @@ margin-bottom: 20px;
<li data-group="Instance" data-name="instanceFeatureSetsGet" class=""> <li data-group="Instance" data-name="instanceFeatureSetsGet" class="">
<a href="#api-Instance-instanceFeatureSetsGet">instanceFeatureSetsGet</a> <a href="#api-Instance-instanceFeatureSetsGet">instanceFeatureSetsGet</a>
</li> </li>
<li data-group="Instance" data-name="instanceFeatures" class="">
<a href="#api-Instance-instanceFeatures">instanceFeatures</a>
</li>
<li data-group="Instance" data-name="instanceLimeRFEConfigGet" class=""> <li data-group="Instance" data-name="instanceLimeRFEConfigGet" class="">
<a href="#api-Instance-instanceLimeRFEConfigGet">instanceLimeRFEConfigGet</a> <a href="#api-Instance-instanceLimeRFEConfigGet">instanceLimeRFEConfigGet</a>
</li> </li>
@ -40680,6 +40725,341 @@ except ApiException as e:
</article> </article>
</div> </div>
<hr> <hr>
<div id="api-Instance-instanceFeatures">
<article id="api-Instance-instanceFeatures-0" data-group="User" data-name="instanceFeatures" data-version="0">
<div class="pull-left">
<h1>instanceFeatures</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">Get a list of feature plugins available in this instance</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/features</span></code></pre>
<p>
<h3>Usage and SDK Samples</h3>
</p>
<ul class="nav nav-tabs nav-tabs-examples">
<li class="active"><a href="#examples-Instance-instanceFeatures-0-curl">Curl</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-java">Java</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-android">Android</a></li>
<!--<li class=""><a href="#examples-Instance-instanceFeatures-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-Instance-instanceFeatures-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-Instance-instanceFeatures-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-Instance-instanceFeatures-0-csharp">C#</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-php">PHP</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-perl">Perl</a></li>
<li class=""><a href="#examples-Instance-instanceFeatures-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-Instance-instanceFeatures-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/features"</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.InstanceApi;
import java.io.File;
import java.util.*;
public class InstanceApiExample {
public static void main(String[] args) {
InstanceApi apiInstance = new InstanceApi();
try {
InstanceFeaturesResponse result = apiInstance.instanceFeatures();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceFeatures");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.InstanceApi;
public class InstanceApiExample {
public static void main(String[] args) {
InstanceApi apiInstance = new InstanceApi();
try {
InstanceFeaturesResponse result = apiInstance.instanceFeatures();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceFeatures");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-objc">
<pre class="prettyprint"><code class="language-cpp">
InstanceApi *apiInstance = [[InstanceApi alloc] init];
[apiInstance instanceFeaturesWithCompletionHandler:
^(InstanceFeaturesResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.InstanceApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.instanceFeatures(callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-Instance-instanceFeatures-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-csharp">
<pre class="prettyprint"><code class="language-cs">using System;
using System.Diagnostics;
using SWGSDRangel.Api;
using SWGSDRangel.Client;
using SWGSDRangel.Model;
namespace Example
{
public class instanceFeaturesExample
{
public void main()
{
var apiInstance = new InstanceApi();
try
{
InstanceFeaturesResponse result = apiInstance.instanceFeatures();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling InstanceApi.instanceFeatures: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\InstanceApi();
try {
$result = $api_instance->instanceFeatures();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling InstanceApi->instanceFeatures: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::InstanceApi;
my $api_instance = SWGSDRangel::InstanceApi->new();
eval {
my $result = $api_instance->instanceFeatures();
print Dumper($result);
};
if ($@) {
warn "Exception when calling InstanceApi->instanceFeatures: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instanceFeatures-0-python">
<pre class="prettyprint"><code class="language-python">from __future__ import print_statement
import time
import swagger_sdrangel
from swagger_sdrangel.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_sdrangel.InstanceApi()
try:
api_response = api_instance.instance_features()
pprint(api_response)
except ApiException as e:
print("Exception when calling InstanceApi->instanceFeatures: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<h2>Responses</h2>
<h3> Status: 200 - Success </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceFeatures-200-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceFeatures-200-schema">
<div id='responses-instanceFeatures-200-schema-200' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "Success",
"schema" : {
"$ref" : "#/definitions/InstanceFeaturesResponse"
}
};
var schema = schemaWrapper.schema;
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
});
}
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-instanceFeatures-200-schema-data').val(stringify(schema));
var result = $('#responses-instanceFeatures-200-schema-200');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceFeatures-200-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 500 - Error </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceFeatures-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceFeatures-500-schema">
<div id='responses-instanceFeatures-500-schema-500' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "Error",
"schema" : {
"$ref" : "#/definitions/ErrorResponse"
}
};
var schema = schemaWrapper.schema;
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
});
}
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-instanceFeatures-500-schema-data').val(stringify(schema));
var result = $('#responses-instanceFeatures-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceFeatures-500-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 501 - Function not implemented </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceFeatures-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceFeatures-501-schema">
<div id='responses-instanceFeatures-501-schema-501' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "Function not implemented",
"schema" : {
"$ref" : "#/definitions/ErrorResponse"
}
};
var schema = schemaWrapper.schema;
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
});
}
//console.log(JSON.stringify(schema));
var view = new JSONSchemaView(schema, 3);
$('#responses-instanceFeatures-501-schema-data').val(stringify(schema));
var result = $('#responses-instanceFeatures-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceFeatures-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-Instance-instanceLimeRFEConfigGet"> <div id="api-Instance-instanceLimeRFEConfigGet">
<article id="api-Instance-instanceLimeRFEConfigGet-0" data-group="User" data-name="instanceLimeRFEConfigGet" data-version="0"> <article id="api-Instance-instanceLimeRFEConfigGet-0" data-group="User" data-name="instanceLimeRFEConfigGet" data-version="0">
<div class="pull-left"> <div class="pull-left">
@ -47728,7 +48108,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2021-08-25T15:15:18.832+02:00 Generated 2021-08-28T23:40:46.879+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,208 @@
/**
* 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 "SWGFeatureListItem.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGFeatureListItem::SWGFeatureListItem(QString* json) {
init();
this->fromJson(*json);
}
SWGFeatureListItem::SWGFeatureListItem() {
name = nullptr;
m_name_isSet = false;
id_uri = nullptr;
m_id_uri_isSet = false;
id = nullptr;
m_id_isSet = false;
version = nullptr;
m_version_isSet = false;
index = 0;
m_index_isSet = false;
}
SWGFeatureListItem::~SWGFeatureListItem() {
this->cleanup();
}
void
SWGFeatureListItem::init() {
name = new QString("");
m_name_isSet = false;
id_uri = new QString("");
m_id_uri_isSet = false;
id = new QString("");
m_id_isSet = false;
version = new QString("");
m_version_isSet = false;
index = 0;
m_index_isSet = false;
}
void
SWGFeatureListItem::cleanup() {
if(name != nullptr) {
delete name;
}
if(id_uri != nullptr) {
delete id_uri;
}
if(id != nullptr) {
delete id;
}
if(version != nullptr) {
delete version;
}
}
SWGFeatureListItem*
SWGFeatureListItem::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGFeatureListItem::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&id_uri, pJson["idURI"], "QString", "QString");
::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString");
::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString");
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
}
QString
SWGFeatureListItem::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGFeatureListItem::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(id_uri != nullptr && *id_uri != QString("")){
toJsonValue(QString("idURI"), id_uri, obj, QString("QString"));
}
if(id != nullptr && *id != QString("")){
toJsonValue(QString("id"), id, obj, QString("QString"));
}
if(version != nullptr && *version != QString("")){
toJsonValue(QString("version"), version, obj, QString("QString"));
}
if(m_index_isSet){
obj->insert("index", QJsonValue(index));
}
return obj;
}
QString*
SWGFeatureListItem::getName() {
return name;
}
void
SWGFeatureListItem::setName(QString* name) {
this->name = name;
this->m_name_isSet = true;
}
QString*
SWGFeatureListItem::getIdUri() {
return id_uri;
}
void
SWGFeatureListItem::setIdUri(QString* id_uri) {
this->id_uri = id_uri;
this->m_id_uri_isSet = true;
}
QString*
SWGFeatureListItem::getId() {
return id;
}
void
SWGFeatureListItem::setId(QString* id) {
this->id = id;
this->m_id_isSet = true;
}
QString*
SWGFeatureListItem::getVersion() {
return version;
}
void
SWGFeatureListItem::setVersion(QString* version) {
this->version = version;
this->m_version_isSet = true;
}
qint32
SWGFeatureListItem::getIndex() {
return index;
}
void
SWGFeatureListItem::setIndex(qint32 index) {
this->index = index;
this->m_index_isSet = true;
}
bool
SWGFeatureListItem::isSet(){
bool isObjectUpdated = false;
do{
if(name && *name != QString("")){
isObjectUpdated = true; break;
}
if(id_uri && *id_uri != QString("")){
isObjectUpdated = true; break;
}
if(id && *id != QString("")){
isObjectUpdated = true; break;
}
if(version && *version != QString("")){
isObjectUpdated = true; break;
}
if(m_index_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,83 @@
/**
* 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.
*/
/*
* SWGFeatureListItem.h
*
* Summarized information about feature plugin
*/
#ifndef SWGFeatureListItem_H_
#define SWGFeatureListItem_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGFeatureListItem: public SWGObject {
public:
SWGFeatureListItem();
SWGFeatureListItem(QString* json);
virtual ~SWGFeatureListItem();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGFeatureListItem* fromJson(QString &jsonString) override;
QString* getName();
void setName(QString* name);
QString* getIdUri();
void setIdUri(QString* id_uri);
QString* getId();
void setId(QString* id);
QString* getVersion();
void setVersion(QString* version);
qint32 getIndex();
void setIndex(qint32 index);
virtual bool isSet() override;
private:
QString* name;
bool m_name_isSet;
QString* id_uri;
bool m_id_uri_isSet;
QString* id;
bool m_id_isSet;
QString* version;
bool m_version_isSet;
qint32 index;
bool m_index_isSet;
};
}
#endif /* SWGFeatureListItem_H_ */

View File

@ -1108,6 +1108,58 @@ SWGInstanceApi::instanceFeatureSetsGetCallback(SWGHttpRequestWorker * worker) {
} }
} }
void
SWGInstanceApi::instanceFeatures() {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/features");
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::instanceFeaturesCallback);
worker->execute(&input);
}
void
SWGInstanceApi::instanceFeaturesCallback(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);
SWGInstanceFeaturesResponse* output = static_cast<SWGInstanceFeaturesResponse*>(create(json, QString("SWGInstanceFeaturesResponse")));
worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceFeaturesSignal(output);
} else {
emit instanceFeaturesSignalE(output, error_type, error_str);
emit instanceFeaturesSignalEFull(worker, error_type, error_str);
}
}
void void
SWGInstanceApi::instanceLimeRFEConfigGet(QString* serial) { SWGInstanceApi::instanceLimeRFEConfigGet(QString* serial) {
QString fullPath; QString fullPath;

View File

@ -27,6 +27,7 @@
#include "SWGInstanceChannelsResponse.h" #include "SWGInstanceChannelsResponse.h"
#include "SWGInstanceConfigResponse.h" #include "SWGInstanceConfigResponse.h"
#include "SWGInstanceDevicesResponse.h" #include "SWGInstanceDevicesResponse.h"
#include "SWGInstanceFeaturesResponse.h"
#include "SWGInstanceSummaryResponse.h" #include "SWGInstanceSummaryResponse.h"
#include "SWGLimeRFEDevices.h" #include "SWGLimeRFEDevices.h"
#include "SWGLimeRFEPower.h" #include "SWGLimeRFEPower.h"
@ -76,6 +77,7 @@ public:
void instanceDeviceSetsGet(); void instanceDeviceSetsGet();
void instanceDevices(qint32 direction); void instanceDevices(qint32 direction);
void instanceFeatureSetsGet(); void instanceFeatureSetsGet();
void instanceFeatures();
void instanceLimeRFEConfigGet(QString* serial); void instanceLimeRFEConfigGet(QString* serial);
void instanceLimeRFEConfigPut(SWGLimeRFESettings& body); void instanceLimeRFEConfigPut(SWGLimeRFESettings& body);
void instanceLimeRFEPowerGet(QString* serial); void instanceLimeRFEPowerGet(QString* serial);
@ -115,6 +117,7 @@ private:
void instanceDeviceSetsGetCallback (SWGHttpRequestWorker * worker); void instanceDeviceSetsGetCallback (SWGHttpRequestWorker * worker);
void instanceDevicesCallback (SWGHttpRequestWorker * worker); void instanceDevicesCallback (SWGHttpRequestWorker * worker);
void instanceFeatureSetsGetCallback (SWGHttpRequestWorker * worker); void instanceFeatureSetsGetCallback (SWGHttpRequestWorker * worker);
void instanceFeaturesCallback (SWGHttpRequestWorker * worker);
void instanceLimeRFEConfigGetCallback (SWGHttpRequestWorker * worker); void instanceLimeRFEConfigGetCallback (SWGHttpRequestWorker * worker);
void instanceLimeRFEConfigPutCallback (SWGHttpRequestWorker * worker); void instanceLimeRFEConfigPutCallback (SWGHttpRequestWorker * worker);
void instanceLimeRFEPowerGetCallback (SWGHttpRequestWorker * worker); void instanceLimeRFEPowerGetCallback (SWGHttpRequestWorker * worker);
@ -154,6 +157,7 @@ signals:
void instanceDeviceSetsGetSignal(SWGDeviceSetList* summary); void instanceDeviceSetsGetSignal(SWGDeviceSetList* summary);
void instanceDevicesSignal(SWGInstanceDevicesResponse* summary); void instanceDevicesSignal(SWGInstanceDevicesResponse* summary);
void instanceFeatureSetsGetSignal(SWGFeatureSetList* summary); void instanceFeatureSetsGetSignal(SWGFeatureSetList* summary);
void instanceFeaturesSignal(SWGInstanceFeaturesResponse* summary);
void instanceLimeRFEConfigGetSignal(SWGLimeRFESettings* summary); void instanceLimeRFEConfigGetSignal(SWGLimeRFESettings* summary);
void instanceLimeRFEConfigPutSignal(SWGSuccessResponse* summary); void instanceLimeRFEConfigPutSignal(SWGSuccessResponse* summary);
void instanceLimeRFEPowerGetSignal(SWGLimeRFEPower* summary); void instanceLimeRFEPowerGetSignal(SWGLimeRFEPower* summary);
@ -192,6 +196,7 @@ signals:
void instanceDeviceSetsGetSignalE(SWGDeviceSetList* 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); void instanceDevicesSignalE(SWGInstanceDevicesResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceFeatureSetsGetSignalE(SWGFeatureSetList* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceFeatureSetsGetSignalE(SWGFeatureSetList* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceFeaturesSignalE(SWGInstanceFeaturesResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLimeRFEConfigGetSignalE(SWGLimeRFESettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceLimeRFEConfigGetSignalE(SWGLimeRFESettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLimeRFEConfigPutSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceLimeRFEConfigPutSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLimeRFEPowerGetSignalE(SWGLimeRFEPower* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceLimeRFEPowerGetSignalE(SWGLimeRFEPower* summary, QNetworkReply::NetworkError error_type, QString& error_str);
@ -230,6 +235,7 @@ signals:
void instanceDeviceSetsGetSignalEFull(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); void instanceDevicesSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceFeatureSetsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceFeatureSetsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceFeaturesSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLimeRFEConfigGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceLimeRFEConfigGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLimeRFEConfigPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceLimeRFEConfigPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLimeRFEPowerGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceLimeRFEPowerGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);

View File

@ -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 "SWGInstanceFeaturesResponse.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGInstanceFeaturesResponse::SWGInstanceFeaturesResponse(QString* json) {
init();
this->fromJson(*json);
}
SWGInstanceFeaturesResponse::SWGInstanceFeaturesResponse() {
featurecount = 0;
m_featurecount_isSet = false;
features = nullptr;
m_features_isSet = false;
}
SWGInstanceFeaturesResponse::~SWGInstanceFeaturesResponse() {
this->cleanup();
}
void
SWGInstanceFeaturesResponse::init() {
featurecount = 0;
m_featurecount_isSet = false;
features = new QList<SWGFeatureListItem*>();
m_features_isSet = false;
}
void
SWGInstanceFeaturesResponse::cleanup() {
if(features != nullptr) {
auto arr = features;
for(auto o: *arr) {
delete o;
}
delete features;
}
}
SWGInstanceFeaturesResponse*
SWGInstanceFeaturesResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGInstanceFeaturesResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&featurecount, pJson["featurecount"], "qint32", "");
::SWGSDRangel::setValue(&features, pJson["features"], "QList", "SWGFeatureListItem");
}
QString
SWGInstanceFeaturesResponse::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGInstanceFeaturesResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_featurecount_isSet){
obj->insert("featurecount", QJsonValue(featurecount));
}
if(features && features->size() > 0){
toJsonArray((QList<void*>*)features, obj, "features", "SWGFeatureListItem");
}
return obj;
}
qint32
SWGInstanceFeaturesResponse::getFeaturecount() {
return featurecount;
}
void
SWGInstanceFeaturesResponse::setFeaturecount(qint32 featurecount) {
this->featurecount = featurecount;
this->m_featurecount_isSet = true;
}
QList<SWGFeatureListItem*>*
SWGInstanceFeaturesResponse::getFeatures() {
return features;
}
void
SWGInstanceFeaturesResponse::setFeatures(QList<SWGFeatureListItem*>* features) {
this->features = features;
this->m_features_isSet = true;
}
bool
SWGInstanceFeaturesResponse::isSet(){
bool isObjectUpdated = false;
do{
if(m_featurecount_isSet){
isObjectUpdated = true; break;
}
if(features && (features->size() > 0)){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -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.
*/
/*
* SWGInstanceFeaturesResponse.h
*
* Summarized information about feature plugins available in this SDRangel instance
*/
#ifndef SWGInstanceFeaturesResponse_H_
#define SWGInstanceFeaturesResponse_H_
#include <QJsonObject>
#include "SWGFeatureListItem.h"
#include <QList>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGInstanceFeaturesResponse: public SWGObject {
public:
SWGInstanceFeaturesResponse();
SWGInstanceFeaturesResponse(QString* json);
virtual ~SWGInstanceFeaturesResponse();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGInstanceFeaturesResponse* fromJson(QString &jsonString) override;
qint32 getFeaturecount();
void setFeaturecount(qint32 featurecount);
QList<SWGFeatureListItem*>* getFeatures();
void setFeatures(QList<SWGFeatureListItem*>* features);
virtual bool isSet() override;
private:
qint32 featurecount;
bool m_featurecount_isSet;
QList<SWGFeatureListItem*>* features;
bool m_features_isSet;
};
}
#endif /* SWGInstanceFeaturesResponse_H_ */

View File

@ -103,6 +103,7 @@
#include "SWGFeature.h" #include "SWGFeature.h"
#include "SWGFeatureActions.h" #include "SWGFeatureActions.h"
#include "SWGFeatureConfig.h" #include "SWGFeatureConfig.h"
#include "SWGFeatureListItem.h"
#include "SWGFeatureReport.h" #include "SWGFeatureReport.h"
#include "SWGFeatureSet.h" #include "SWGFeatureSet.h"
#include "SWGFeatureSetList.h" #include "SWGFeatureSetList.h"
@ -139,6 +140,7 @@
#include "SWGInstanceChannelsResponse.h" #include "SWGInstanceChannelsResponse.h"
#include "SWGInstanceConfigResponse.h" #include "SWGInstanceConfigResponse.h"
#include "SWGInstanceDevicesResponse.h" #include "SWGInstanceDevicesResponse.h"
#include "SWGInstanceFeaturesResponse.h"
#include "SWGInstanceSummaryResponse.h" #include "SWGInstanceSummaryResponse.h"
#include "SWGInterferometerSettings.h" #include "SWGInterferometerSettings.h"
#include "SWGKiwiSDRReport.h" #include "SWGKiwiSDRReport.h"
@ -727,6 +729,11 @@ namespace SWGSDRangel {
obj->init(); obj->init();
return obj; return obj;
} }
if(QString("SWGFeatureListItem").compare(type) == 0) {
SWGFeatureListItem *obj = new SWGFeatureListItem();
obj->init();
return obj;
}
if(QString("SWGFeatureReport").compare(type) == 0) { if(QString("SWGFeatureReport").compare(type) == 0) {
SWGFeatureReport *obj = new SWGFeatureReport(); SWGFeatureReport *obj = new SWGFeatureReport();
obj->init(); obj->init();
@ -907,6 +914,11 @@ namespace SWGSDRangel {
obj->init(); obj->init();
return obj; return obj;
} }
if(QString("SWGInstanceFeaturesResponse").compare(type) == 0) {
SWGInstanceFeaturesResponse *obj = new SWGInstanceFeaturesResponse();
obj->init();
return obj;
}
if(QString("SWGInstanceSummaryResponse").compare(type) == 0) { if(QString("SWGInstanceSummaryResponse").compare(type) == 0) {
SWGInstanceSummaryResponse *obj = new SWGInstanceSummaryResponse(); SWGInstanceSummaryResponse *obj = new SWGInstanceSummaryResponse();
obj->init(); obj->init();