1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 22:14:45 -04:00

Web API: implemented device report interface. Applied to Airspy

This commit is contained in:
f4exb
2018-05-26 01:43:28 +02:00
parent ae07298387
commit f8f976fd50
26 changed files with 1905 additions and 2 deletions
+502 -1
View File
@@ -942,6 +942,25 @@ margin-bottom: 20px;
}
},
"description" : "AirspyHF"
};
defs.AirspyReport = {
"properties" : {
"sampleRates" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/AirspyReport_sampleRates"
}
}
},
"description" : "Airspy"
};
defs.AirspyReport_sampleRates = {
"properties" : {
"sampleRate" : {
"type" : "integer",
"description" : "sample rate in S/s"
}
}
};
defs.AirspySettings = {
"properties" : {
@@ -1663,6 +1682,24 @@ margin-bottom: 20px;
}
},
"description" : "Summarized information about attached hardware device"
};
defs.DeviceReport = {
"required" : [ "deviceHwType", "tx" ],
"discriminator" : "deviceHwType",
"properties" : {
"deviceHwType" : {
"type" : "string",
"description" : "Device hardware type code"
},
"tx" : {
"type" : "integer",
"description" : "Not zero if it is a tx device else it is a rx device"
},
"airspyReport" : {
"$ref" : "#/definitions/AirspyReport"
}
},
"description" : "Base device report. The specific device report present depeds on deviceHwType"
};
defs.DeviceSet = {
"required" : [ "channelcount", "samplingDevice" ],
@@ -2988,6 +3025,9 @@ margin-bottom: 20px;
<li data-group="DeviceSet" data-name="devicesetDevicePut" class="">
<a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a>
</li>
<li data-group="DeviceSet" data-name="devicesetDeviceReportGet" class="">
<a href="#api-DeviceSet-devicesetDeviceReportGet">devicesetDeviceReportGet</a>
</li>
<li data-group="DeviceSet" data-name="devicesetDeviceRunDelete" class="">
<a href="#api-DeviceSet-devicesetDeviceRunDelete">devicesetDeviceRunDelete</a>
</li>
@@ -7189,6 +7229,467 @@ $(document).ready(function() {
</article>
</div>
<hr>
<div id="api-DeviceSet-devicesetDeviceReportGet">
<article id="api-DeviceSet-devicesetDeviceReportGet-0" data-group="User" data-name="devicesetDeviceReportGet" data-version="0">
<div class="pull-left">
<h1>devicesetDeviceReportGet</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">get the device report</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/deviceset/{deviceSetIndex}/device/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-devicesetDeviceReportGet-0-curl">Curl</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-java">Java</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-android">Android</a></li>
<!--<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-csharp">C#</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-php">PHP</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-perl">Perl</a></li>
<li class=""><a href="#examples-DeviceSet-devicesetDeviceReportGet-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceReportGet-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/report"</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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 {
DeviceReport result = apiInstance.devicesetDeviceReportGet(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceReportGet");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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 {
DeviceReport result = apiInstance.devicesetDeviceReportGet(deviceSetIndex);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceReportGet");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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 devicesetDeviceReportGetWith:deviceSetIndex
completionHandler: ^(DeviceReport output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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.devicesetDeviceReportGet(deviceSetIndex, callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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 devicesetDeviceReportGetExample
{
public void main()
{
var apiInstance = new DeviceSetApi();
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
try
{
DeviceReport result = apiInstance.devicesetDeviceReportGet(deviceSetIndex);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceReportGet: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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->devicesetDeviceReportGet($deviceSetIndex);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DeviceSetApi->devicesetDeviceReportGet: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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->devicesetDeviceReportGet(deviceSetIndex => $deviceSetIndex);
print Dumper($result);
};
if ($@) {
warn "Exception when calling DeviceSetApi->devicesetDeviceReportGet: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceReportGet-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_device_report_get(deviceSetIndex)
pprint(api_response)
except ApiException as e:
print("Exception when calling DeviceSetApi->devicesetDeviceReportGet: %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_devicesetDeviceReportGet_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 device report </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetDeviceReportGet-200-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetDeviceReportGet-200-schema">
<div id='responses-devicesetDeviceReportGet-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 device report",
"schema" : {
"$ref" : "#/definitions/DeviceReport"
}
};
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-devicesetDeviceReportGet-200-schema-data').val(stringify(schema));
var result = $('#responses-devicesetDeviceReportGet-200-schema-200');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetDeviceReportGet-200-schema-data' type='hidden' value=''></input>
</div>
</div>
<h3> Status: 400 - Invalid device set </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-devicesetDeviceReportGet-400-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetDeviceReportGet-400-schema">
<div id='responses-devicesetDeviceReportGet-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",
"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-devicesetDeviceReportGet-400-schema-data').val(stringify(schema));
var result = $('#responses-devicesetDeviceReportGet-400-schema-400');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetDeviceReportGet-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-devicesetDeviceReportGet-404-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetDeviceReportGet-404-schema">
<div id='responses-devicesetDeviceReportGet-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-devicesetDeviceReportGet-404-schema-data').val(stringify(schema));
var result = $('#responses-devicesetDeviceReportGet-404-schema-404');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetDeviceReportGet-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-devicesetDeviceReportGet-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetDeviceReportGet-500-schema">
<div id='responses-devicesetDeviceReportGet-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-devicesetDeviceReportGet-500-schema-data').val(stringify(schema));
var result = $('#responses-devicesetDeviceReportGet-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetDeviceReportGet-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-devicesetDeviceReportGet-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-devicesetDeviceReportGet-501-schema">
<div id='responses-devicesetDeviceReportGet-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-devicesetDeviceReportGet-501-schema-data').val(stringify(schema));
var result = $('#responses-devicesetDeviceReportGet-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-devicesetDeviceReportGet-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-DeviceSet-devicesetDeviceRunDelete">
<article id="api-DeviceSet-devicesetDeviceRunDelete-0" data-group="User" data-name="devicesetDeviceRunDelete" data-version="0">
<div class="pull-left">
@@ -21180,7 +21681,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-25T18:55:39.036+02:00
Generated 2018-05-26T00:44:20.967+02:00
</div>
</div>
</div>