Web API: entry point to get all channel reports at once

This commit is contained in:
f4exb 2018-03-19 00:08:38 +01:00
parent d4e1521c90
commit 6fbbd14fd1
17 changed files with 1506 additions and 6 deletions

View File

@ -807,6 +807,9 @@ margin-bottom: 20px;
"deltaFrequency" : {
"type" : "integer",
"description" : "Channel shift frequency in Hz from the center of baseband"
},
"report" : {
"$ref" : "#/definitions/ChannelReport"
}
},
"description" : "Channel summarized information"
@ -882,6 +885,23 @@ margin-bottom: 20px;
}
},
"description" : "Base channel settings. The specific channel settings present depends on channelType."
};
defs.ChannelsDetail = {
"required" : [ "channelcount" ],
"properties" : {
"channelcount" : {
"type" : "integer",
"description" : "Number of channels in the set"
},
"channels" : {
"type" : "array",
"description" : "Channels list",
"items" : {
"$ref" : "#/definitions/Channel"
}
}
},
"description" : "All channels detailed information"
};
defs.DVSeralDevices = {
"required" : [ "nbDevices" ],
@ -1756,6 +1776,9 @@ margin-bottom: 20px;
<li data-group="DeviceSet" data-name="devicesetChannelSettingsPut" class="">
<a href="#api-DeviceSet-devicesetChannelSettingsPut">devicesetChannelSettingsPut</a>
</li>
<li data-group="DeviceSet" data-name="devicesetChannelsReportGet" class="">
<a href="#api-DeviceSet-devicesetChannelsReportGet">devicesetChannelsReportGet</a>
</li>
<li data-group="DeviceSet" data-name="devicesetDevicePut" class="">
<a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a>
</li>
@ -4971,6 +4994,467 @@ $(document).ready(function() {
</article>
</div>
<hr>
<div id="api-DeviceSet-devicesetChannelsReportGet">
<article id="api-DeviceSet-devicesetChannelsReportGet-0" data-group="User" data-name="devicesetChannelsReportGet" data-version="0">
<div class="pull-left">
<h1>devicesetChannelsReportGet</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">get channels report</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/deviceset/{deviceSetIndex}/channels/report</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-DeviceSet-devicesetChannelsReportGet-0-curl">Curl</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-java">Java</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-android">Android</a></li>
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-csharp">C#</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-php">PHP</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-perl">Perl</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelsReportGet-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channels/report"</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.DeviceSetApi;
import java.io.File;
import java.util.*;
public class DeviceSetApiExample {
public static void main(String[] args) {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
ChannelsDetail result = apiInstance.devicesetChannelsReportGet(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetChannelsReportGet");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.DeviceSetApi;
public class DeviceSetApiExample {
public static void main(String[] args) {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
ChannelsDetail result = apiInstance.devicesetChannelsReportGet(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetChannelsReportGet");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-objc">
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
[apiInstance devicesetChannelsReportGetWith:deviceSetIndex
completionHandler: ^(ChannelsDetail output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.DeviceSetApi()
var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.devicesetChannelsReportGet(deviceSetIndex, callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-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 devicesetChannelsReportGetExample
{
public void main()
{
var apiInstance = new DeviceSetApi();
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
try
{
ChannelsDetail result = apiInstance.devicesetChannelsReportGet(deviceSetIndex);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DeviceSetApi.devicesetChannelsReportGet: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\DeviceSetApi();
$deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
$result = $api_instance->devicesetChannelsReportGet($deviceSetIndex);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DeviceSetApi->devicesetChannelsReportGet: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::DeviceSetApi;
my $api_instance = SWGSDRangel::DeviceSetApi->new();
my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
eval {
my $result = $api_instance->devicesetChannelsReportGet(deviceSetIndex => $deviceSetIndex);
print Dumper($result);
};
if ($@) {
warn "Exception when calling DeviceSetApi->devicesetChannelsReportGet: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-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.DeviceSetApi()
deviceSetIndex = 56 # Integer | Index of device set in the device set list
try:
api_response = api_instance.deviceset_channels_report_get(deviceSetIndex)
pprint(api_response)
except ApiException as e:
print("Exception when calling DeviceSetApi->devicesetChannelsReportGet: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<div class="methodsubtabletitle">Path parameters</div>
<table id="methodsubtable">
<tr>
<th width="150px">Name</th>
<th>Description</th>
</tr>
<tr><td style="width:150px;">deviceSetIndex*</td>
<td>
<div id="d2e199_devicesetChannelsReportGet_deviceSetIndex">
<div class="json-schema-view">
<div class="primitive">
<span class="type">
Integer
</span>
<div class="inner description">
Index of device set in the device set list
</div>
</div>
<div class="inner required">
Required
</div>
</div>
</div>
</td>
</tr>
</table>
<h2>Responses</h2>
<h3> Status: 200 - On success return channels report information </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetChannelsReportGet-200-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-200-schema">
<div id='responses-devicesetChannelsReportGet-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" : "On success return channels report information",
"schema" : {
"$ref" : "#/definitions/ChannelsDetail"
}
};
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-devicesetChannelsReportGet-200-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-200-schema-200');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-200-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 400 - Invalid device set index </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetChannelsReportGet-400-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-400-schema">
<div id='responses-devicesetChannelsReportGet-400-schema-400' 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" : "Invalid device set index",
"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-devicesetChannelsReportGet-400-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-400-schema-400');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-400-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 404 - Device not found </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetChannelsReportGet-404-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-404-schema">
<div id='responses-devicesetChannelsReportGet-404-schema-404' 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" : "Device not found",
"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-devicesetChannelsReportGet-404-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-404-schema-404');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-404-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-devicesetChannelsReportGet-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-500-schema">
<div id='responses-devicesetChannelsReportGet-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-devicesetChannelsReportGet-500-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-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-devicesetChannelsReportGet-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-501-schema">
<div id='responses-devicesetChannelsReportGet-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-devicesetChannelsReportGet-501-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-DeviceSet-devicesetDevicePut">
<article id="api-DeviceSet-devicesetDevicePut-0" data-group="User" data-name="devicesetDevicePut" data-version="0">
<div class="pull-left">
@ -17472,7 +17956,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-03-18T11:03:22.829+01:00
Generated 2018-03-18T22:42:33.187+01:00
</div>
</div>
</div>

View File

@ -810,6 +810,38 @@ paths:
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset/{deviceSetIndex}/channels/report:
x-swagger-router-controller: deviceset
get:
description: get channels report
operationId: devicesetChannelsReportGet
tags:
- DeviceSet
parameters:
- in: path
name: deviceSetIndex
type: integer
required: true
description: Index of device set in the device set list
responses:
"200":
description: On success return channels report information
schema:
$ref: "#/definitions/ChannelsDetail"
"400":
description: Invalid device set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Device not found
schema:
$ref: "#/definitions/ErrorResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset/{deviceSetIndex}/channel:
x-swagger-router-controller: deviceset
@ -1302,6 +1334,23 @@ definitions:
deltaFrequency:
description: "Channel shift frequency in Hz from the center of baseband"
type: integer
report:
$ref: "#/definitions/ChannelReport"
ChannelsDetail:
description: "All channels detailed information"
required:
- channelcount
properties:
channelcount:
description: "Number of channels in the set"
type: integer
channels:
description: "Channels list"
type: array
items:
$ref: "#/definitions/Channel"
AudioDevices:
description: "List of audio devices available in the system"

View File

@ -36,6 +36,7 @@ std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0
std::regex WebAPIAdapterInterface::devicesetDeviceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device$");
std::regex WebAPIAdapterInterface::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$");
std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run");
std::regex WebAPIAdapterInterface::devicesetChannelsReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channels/report$");
std::regex WebAPIAdapterInterface::devicesetChannelURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel$");
std::regex WebAPIAdapterInterface::devicesetChannelIndexURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::devicesetChannelSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/settings$");

View File

@ -46,6 +46,7 @@ namespace SWGSDRangel
class SWGDeviceListItem;
class SWGDeviceSettings;
class SWGDeviceState;
class SWGChannelsDetail;
class SWGChannelSettings;
class SWGChannelReport;
class SWGSuccessResponse;
@ -454,6 +455,20 @@ public:
return 501;
}
/**
* Handler of /sdrangel/deviceset/{devicesetIndex}/channels/report (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
*/
virtual int devicesetChannelsReportGet(
int deviceSetIndex __attribute__((unused)),
SWGSDRangel::SWGChannelsDetail& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
*error.getMessage() = QString("Function not implemented");
return 501;
}
/**
* Handler of /sdrangel/deviceset/{deviceSetIndex}/channel (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
@ -553,6 +568,7 @@ public:
static std::regex devicesetChannelIndexURLRe;
static std::regex devicesetChannelSettingsURLRe;
static std::regex devicesetChannelReportURLRe;
static std::regex devicesetChannelsReportURLRe;
};

View File

@ -38,6 +38,7 @@
#include "SWGPresetExport.h"
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
#include "SWGSuccessResponse.h"
@ -113,6 +114,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
devicesetDeviceSettingsService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceRunURLRe)) {
devicesetDeviceRunService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelsReportURLRe)) {
devicesetChannelsReportService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelURLRe)) {
devicesetChannelService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelIndexURLRe)) {
@ -1065,6 +1068,43 @@ void WebAPIRequestMapper::devicesetDeviceRunService(const std::string& indexStr,
}
}
void WebAPIRequestMapper::devicesetChannelsReportService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
if (request.getMethod() == "GET")
{
try
{
SWGSDRangel::SWGChannelsDetail normalResponse;
int deviceSetIndex = boost::lexical_cast<int>(indexStr);
int status = m_adapter->devicesetChannelsReportGet(deviceSetIndex, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
catch (const boost::bad_lexical_cast &e)
{
errorResponse.init();
*errorResponse.getMessage() = "Wrong integer conversion on device set index";
response.setStatus(400,"Invalid data");
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::devicesetChannelService(
const std::string& deviceSetIndexStr,
qtwebapp::HttpRequest& request,

View File

@ -65,6 +65,7 @@ private:
void devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetDeviceSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetDeviceRunService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetChannelsReportService(const std::string& deviceSetIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetChannelService(const std::string& deviceSetIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetChannelIndexService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetChannelSettingsService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);

View File

@ -53,6 +53,7 @@
#include "SWGPresetIdentifier.h"
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
#include "SWGSuccessResponse.h"
@ -983,6 +984,27 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
}
}
int WebAPIAdapterGUI::devicesetChannelsReportGet(
int deviceSetIndex,
SWGSDRangel::SWGChannelsDetail& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
const DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
getChannelsDetail(&response, deviceSet);
return 200;
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapterGUI::devicesetChannelPost(
int deviceSetIndex,
SWGSDRangel::SWGChannelSettings& query,
@ -1435,6 +1457,65 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const
}
}
void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceUISet* deviceUISet)
{
channelsDetail->init();
SWGSDRangel::SWGChannelReport *channelReport;
QString channelReportError;
if (deviceUISet->m_deviceSinkEngine) // Tx data
{
channelsDetail->setChannelcount(deviceUISet->m_deviceSinkAPI->getNbChannels());
QList<SWGSDRangel::SWGChannel*> *channels = channelsDetail->getChannels();
for (int i = 0; i < channelsDetail->getChannelcount(); i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelSourceAPI *channel = deviceUISet->m_deviceSinkAPI->getChanelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
}
if (deviceUISet->m_deviceSourceEngine) // Rx data
{
channelsDetail->setChannelcount(deviceUISet->m_deviceSourceAPI->getNbChannels());
QList<SWGSDRangel::SWGChannel*> *channels = channelsDetail->getChannels();
for (int i = 0; i < channelsDetail->getChannelcount(); i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelSinkAPI *channel = deviceUISet->m_deviceSourceAPI->getChanelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
}
}
QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString)
{
if (msgTypeString == "debug") {

View File

@ -159,6 +159,11 @@ public:
SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetChannelsReportGet(
int deviceSetIndex,
SWGSDRangel::SWGChannelsDetail& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetChannelPost(
int deviceSetIndex,
SWGSDRangel::SWGChannelSettings& query,
@ -196,6 +201,7 @@ private:
void getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList);
void getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const DeviceUISet* deviceUISet, int deviceUISetIndex);
void getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceUISet* deviceUISet);
static QtMsgType getMsgTypeFromString(const QString& msgTypeString);
static void getMsgTypeString(const QtMsgType& msgType, QString& level);
};

View File

@ -810,6 +810,38 @@ paths:
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset/{deviceSetIndex}/channels/report:
x-swagger-router-controller: deviceset
get:
description: get channels report
operationId: devicesetChannelsReportGet
tags:
- DeviceSet
parameters:
- in: path
name: deviceSetIndex
type: integer
required: true
description: Index of device set in the device set list
responses:
"200":
description: On success return channels report information
schema:
$ref: "#/definitions/ChannelsDetail"
"400":
description: Invalid device set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Device not found
schema:
$ref: "#/definitions/ErrorResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset/{deviceSetIndex}/channel:
x-swagger-router-controller: deviceset
@ -1302,6 +1334,23 @@ definitions:
deltaFrequency:
description: "Channel shift frequency in Hz from the center of baseband"
type: integer
report:
$ref: "#/definitions/ChannelReport"
ChannelsDetail:
description: "All channels detailed information"
required:
- channelcount
properties:
channelcount:
description: "Number of channels in the set"
type: integer
channels:
description: "Channels list"
type: array
items:
$ref: "#/definitions/Channel"
AudioDevices:
description: "List of audio devices available in the system"
@ -1551,11 +1600,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModSettings"
ChannelReport:
description: Base channel report. The specific channel report present depends on channelType.
description: Base channel report. The specific channel report present depends on channelType or paremt context.
discriminator: channelType
required:
- channelType
- tx
properties:
channelType:
description: Channel type code

View File

@ -807,6 +807,9 @@ margin-bottom: 20px;
"deltaFrequency" : {
"type" : "integer",
"description" : "Channel shift frequency in Hz from the center of baseband"
},
"report" : {
"$ref" : "#/definitions/ChannelReport"
}
},
"description" : "Channel summarized information"
@ -882,6 +885,23 @@ margin-bottom: 20px;
}
},
"description" : "Base channel settings. The specific channel settings present depends on channelType."
};
defs.ChannelsDetail = {
"required" : [ "channelcount" ],
"properties" : {
"channelcount" : {
"type" : "integer",
"description" : "Number of channels in the set"
},
"channels" : {
"type" : "array",
"description" : "Channels list",
"items" : {
"$ref" : "#/definitions/Channel"
}
}
},
"description" : "All channels detailed information"
};
defs.DVSeralDevices = {
"required" : [ "nbDevices" ],
@ -1756,6 +1776,9 @@ margin-bottom: 20px;
<li data-group="DeviceSet" data-name="devicesetChannelSettingsPut" class="">
<a href="#api-DeviceSet-devicesetChannelSettingsPut">devicesetChannelSettingsPut</a>
</li>
<li data-group="DeviceSet" data-name="devicesetChannelsReportGet" class="">
<a href="#api-DeviceSet-devicesetChannelsReportGet">devicesetChannelsReportGet</a>
</li>
<li data-group="DeviceSet" data-name="devicesetDevicePut" class="">
<a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a>
</li>
@ -4971,6 +4994,467 @@ $(document).ready(function() {
</article>
</div>
<hr>
<div id="api-DeviceSet-devicesetChannelsReportGet">
<article id="api-DeviceSet-devicesetChannelsReportGet-0" data-group="User" data-name="devicesetChannelsReportGet" data-version="0">
<div class="pull-left">
<h1>devicesetChannelsReportGet</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">get channels report</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/deviceset/{deviceSetIndex}/channels/report</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-DeviceSet-devicesetChannelsReportGet-0-curl">Curl</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-java">Java</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-android">Android</a></li>
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-csharp">C#</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-php">PHP</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-perl">Perl</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetChannelsReportGet-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelsReportGet-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channels/report"</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.DeviceSetApi;
import java.io.File;
import java.util.*;
public class DeviceSetApiExample {
public static void main(String[] args) {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
ChannelsDetail result = apiInstance.devicesetChannelsReportGet(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetChannelsReportGet");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.DeviceSetApi;
public class DeviceSetApiExample {
public static void main(String[] args) {
DeviceSetApi apiInstance = new DeviceSetApi();
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
ChannelsDetail result = apiInstance.devicesetChannelsReportGet(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetChannelsReportGet");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-objc">
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
[apiInstance devicesetChannelsReportGetWith:deviceSetIndex
completionHandler: ^(ChannelsDetail output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.DeviceSetApi()
var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.devicesetChannelsReportGet(deviceSetIndex, callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-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 devicesetChannelsReportGetExample
{
public void main()
{
var apiInstance = new DeviceSetApi();
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
try
{
ChannelsDetail result = apiInstance.devicesetChannelsReportGet(deviceSetIndex);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DeviceSetApi.devicesetChannelsReportGet: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\DeviceSetApi();
$deviceSetIndex = 56; // Integer | Index of device set in the device set list
try {
$result = $api_instance->devicesetChannelsReportGet($deviceSetIndex);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DeviceSetApi->devicesetChannelsReportGet: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::DeviceSetApi;
my $api_instance = SWGSDRangel::DeviceSetApi->new();
my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
eval {
my $result = $api_instance->devicesetChannelsReportGet(deviceSetIndex => $deviceSetIndex);
print Dumper($result);
};
if ($@) {
warn "Exception when calling DeviceSetApi->devicesetChannelsReportGet: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelsReportGet-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.DeviceSetApi()
deviceSetIndex = 56 # Integer | Index of device set in the device set list
try:
api_response = api_instance.deviceset_channels_report_get(deviceSetIndex)
pprint(api_response)
except ApiException as e:
print("Exception when calling DeviceSetApi->devicesetChannelsReportGet: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<div class="methodsubtabletitle">Path parameters</div>
<table id="methodsubtable">
<tr>
<th width="150px">Name</th>
<th>Description</th>
</tr>
<tr><td style="width:150px;">deviceSetIndex*</td>
<td>
<div id="d2e199_devicesetChannelsReportGet_deviceSetIndex">
<div class="json-schema-view">
<div class="primitive">
<span class="type">
Integer
</span>
<div class="inner description">
Index of device set in the device set list
</div>
</div>
<div class="inner required">
Required
</div>
</div>
</div>
</td>
</tr>
</table>
<h2>Responses</h2>
<h3> Status: 200 - On success return channels report information </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetChannelsReportGet-200-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-200-schema">
<div id='responses-devicesetChannelsReportGet-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" : "On success return channels report information",
"schema" : {
"$ref" : "#/definitions/ChannelsDetail"
}
};
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-devicesetChannelsReportGet-200-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-200-schema-200');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-200-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 400 - Invalid device set index </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetChannelsReportGet-400-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-400-schema">
<div id='responses-devicesetChannelsReportGet-400-schema-400' 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" : "Invalid device set index",
"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-devicesetChannelsReportGet-400-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-400-schema-400');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-400-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 404 - Device not found </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetChannelsReportGet-404-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-404-schema">
<div id='responses-devicesetChannelsReportGet-404-schema-404' 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" : "Device not found",
"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-devicesetChannelsReportGet-404-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-404-schema-404');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-404-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-devicesetChannelsReportGet-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-500-schema">
<div id='responses-devicesetChannelsReportGet-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-devicesetChannelsReportGet-500-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-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-devicesetChannelsReportGet-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetChannelsReportGet-501-schema">
<div id='responses-devicesetChannelsReportGet-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-devicesetChannelsReportGet-501-schema-data').val(stringify(schema));
var result = $('#responses-devicesetChannelsReportGet-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetChannelsReportGet-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-DeviceSet-devicesetDevicePut">
<article id="api-DeviceSet-devicesetDevicePut-0" data-group="User" data-name="devicesetDevicePut" data-version="0">
<div class="pull-left">
@ -17472,7 +17956,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-03-18T11:03:22.829+01:00
Generated 2018-03-18T22:42:33.187+01:00
</div>
</div>
</div>

View File

@ -38,6 +38,8 @@ SWGChannel::SWGChannel() {
m_title_isSet = false;
delta_frequency = 0;
m_delta_frequency_isSet = false;
report = nullptr;
m_report_isSet = false;
}
SWGChannel::~SWGChannel() {
@ -56,6 +58,8 @@ SWGChannel::init() {
m_title_isSet = false;
delta_frequency = 0;
m_delta_frequency_isSet = false;
report = new SWGChannelReport();
m_report_isSet = false;
}
void
@ -69,6 +73,9 @@ SWGChannel::cleanup() {
delete title;
}
if(report != nullptr) {
delete report;
}
}
SWGChannel*
@ -92,6 +99,8 @@ SWGChannel::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&delta_frequency, pJson["deltaFrequency"], "qint32", "");
::SWGSDRangel::setValue(&report, pJson["report"], "SWGChannelReport", "SWGChannelReport");
}
QString
@ -123,6 +132,9 @@ SWGChannel::asJsonObject() {
if(m_delta_frequency_isSet){
obj->insert("deltaFrequency", QJsonValue(delta_frequency));
}
if((report != nullptr) && (report->isSet())){
toJsonValue(QString("report"), report, obj, QString("SWGChannelReport"));
}
return obj;
}
@ -177,6 +189,16 @@ SWGChannel::setDeltaFrequency(qint32 delta_frequency) {
this->m_delta_frequency_isSet = true;
}
SWGChannelReport*
SWGChannel::getReport() {
return report;
}
void
SWGChannel::setReport(SWGChannelReport* report) {
this->report = report;
this->m_report_isSet = true;
}
bool
SWGChannel::isSet(){
@ -187,6 +209,7 @@ SWGChannel::isSet(){
if(m_uid_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(m_delta_frequency_isSet){ isObjectUpdated = true; break;}
if(report != nullptr && report->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}

View File

@ -22,6 +22,7 @@
#include <QJsonObject>
#include "SWGChannelReport.h"
#include <QString>
#include "SWGObject.h"
@ -56,6 +57,9 @@ public:
qint32 getDeltaFrequency();
void setDeltaFrequency(qint32 delta_frequency);
SWGChannelReport* getReport();
void setReport(SWGChannelReport* report);
virtual bool isSet() override;
@ -75,6 +79,9 @@ private:
qint32 delta_frequency;
bool m_delta_frequency_isSet;
SWGChannelReport* report;
bool m_report_isSet;
};
}

View File

@ -0,0 +1,133 @@
/**
* 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGChannelsDetail.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGChannelsDetail::SWGChannelsDetail(QString* json) {
init();
this->fromJson(*json);
}
SWGChannelsDetail::SWGChannelsDetail() {
channelcount = 0;
m_channelcount_isSet = false;
channels = nullptr;
m_channels_isSet = false;
}
SWGChannelsDetail::~SWGChannelsDetail() {
this->cleanup();
}
void
SWGChannelsDetail::init() {
channelcount = 0;
m_channelcount_isSet = false;
channels = new QList<SWGChannel*>();
m_channels_isSet = false;
}
void
SWGChannelsDetail::cleanup() {
if(channels != nullptr) {
auto arr = channels;
for(auto o: *arr) {
delete o;
}
delete channels;
}
}
SWGChannelsDetail*
SWGChannelsDetail::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGChannelsDetail::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannel");
}
QString
SWGChannelsDetail::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGChannelsDetail::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_channelcount_isSet){
obj->insert("channelcount", QJsonValue(channelcount));
}
if(channels->size() > 0){
toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannel");
}
return obj;
}
qint32
SWGChannelsDetail::getChannelcount() {
return channelcount;
}
void
SWGChannelsDetail::setChannelcount(qint32 channelcount) {
this->channelcount = channelcount;
this->m_channelcount_isSet = true;
}
QList<SWGChannel*>*
SWGChannelsDetail::getChannels() {
return channels;
}
void
SWGChannelsDetail::setChannels(QList<SWGChannel*>* channels) {
this->channels = channels;
this->m_channels_isSet = true;
}
bool
SWGChannelsDetail::isSet(){
bool isObjectUpdated = false;
do{
if(m_channelcount_isSet){ isObjectUpdated = true; break;}
if(channels->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGChannelsDetail.h
*
* All channels detailed information
*/
#ifndef SWGChannelsDetail_H_
#define SWGChannelsDetail_H_
#include <QJsonObject>
#include "SWGChannel.h"
#include <QList>
#include "SWGObject.h"
namespace SWGSDRangel {
class SWGChannelsDetail: public SWGObject {
public:
SWGChannelsDetail();
SWGChannelsDetail(QString* json);
virtual ~SWGChannelsDetail();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGChannelsDetail* fromJson(QString &jsonString) override;
qint32 getChannelcount();
void setChannelcount(qint32 channelcount);
QList<SWGChannel*>* getChannels();
void setChannels(QList<SWGChannel*>* channels);
virtual bool isSet() override;
private:
qint32 channelcount;
bool m_channelcount_isSet;
QList<SWGChannel*>* channels;
bool m_channels_isSet;
};
}
#endif /* SWGChannelsDetail_H_ */

View File

@ -371,6 +371,60 @@ SWGDeviceSetApi::devicesetChannelSettingsPutCallback(SWGHttpRequestWorker * work
}
}
void
SWGDeviceSetApi::devicesetChannelsReportGet(qint32 device_set_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channels/report");
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
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,
&SWGDeviceSetApi::devicesetChannelsReportGetCallback);
worker->execute(&input);
}
void
SWGDeviceSetApi::devicesetChannelsReportGetCallback(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);
SWGChannelsDetail* output = static_cast<SWGChannelsDetail*>(create(json, QString("SWGChannelsDetail")));
worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelsReportGetSignal(output);
} else {
emit devicesetChannelsReportGetSignalE(output, error_type, error_str);
emit devicesetChannelsReportGetSignalEFull(worker, error_type, error_str);
}
}
void
SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body) {
QString fullPath;

View File

@ -17,6 +17,7 @@
#include "SWGChannelReport.h"
#include "SWGChannelSettings.h"
#include "SWGChannelsDetail.h"
#include "SWGDeviceListItem.h"
#include "SWGDeviceSet.h"
#include "SWGDeviceSettings.h"
@ -46,6 +47,7 @@ public:
void devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index);
void devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body);
void devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body);
void devicesetChannelsReportGet(qint32 device_set_index);
void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body);
void devicesetDeviceRunDelete(qint32 device_set_index);
void devicesetDeviceRunGet(qint32 device_set_index);
@ -65,6 +67,7 @@ private:
void devicesetChannelSettingsGetCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsPatchCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsPutCallback (SWGHttpRequestWorker * worker);
void devicesetChannelsReportGetCallback (SWGHttpRequestWorker * worker);
void devicesetDevicePutCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunDeleteCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunGetCallback (SWGHttpRequestWorker * worker);
@ -84,6 +87,7 @@ signals:
void devicesetChannelSettingsGetSignal(SWGChannelSettings* summary);
void devicesetChannelSettingsPatchSignal(SWGChannelSettings* summary);
void devicesetChannelSettingsPutSignal(SWGChannelSettings* summary);
void devicesetChannelsReportGetSignal(SWGChannelsDetail* summary);
void devicesetDevicePutSignal(SWGDeviceListItem* summary);
void devicesetDeviceRunDeleteSignal(SWGDeviceState* summary);
void devicesetDeviceRunGetSignal(SWGDeviceState* summary);
@ -102,6 +106,7 @@ signals:
void devicesetChannelSettingsGetSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPatchSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPutSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelsReportGetSignalE(SWGChannelsDetail* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDevicePutSignalE(SWGDeviceListItem* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunDeleteSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunGetSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str);
@ -120,6 +125,7 @@ signals:
void devicesetChannelSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelsReportGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDevicePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);

View File

@ -22,6 +22,7 @@
#include "SWGChannelListItem.h"
#include "SWGChannelReport.h"
#include "SWGChannelSettings.h"
#include "SWGChannelsDetail.h"
#include "SWGDVSeralDevices.h"
#include "SWGDVSerialDevice.h"
#include "SWGDeviceListItem.h"
@ -82,6 +83,9 @@ namespace SWGSDRangel {
if(QString("SWGChannelSettings").compare(type) == 0) {
return new SWGChannelSettings();
}
if(QString("SWGChannelsDetail").compare(type) == 0) {
return new SWGChannelsDetail();
}
if(QString("SWGDVSeralDevices").compare(type) == 0) {
return new SWGDVSeralDevices();
}