1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-05 08:21:16 -05: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

View File

@ -17,9 +17,12 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <QDebug> #include <QDebug>
#include <QList>
#include "SWGDeviceSettings.h" #include "SWGDeviceSettings.h"
#include "SWGDeviceState.h" #include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGAirspyReport.h"
#include "airspygui.h" #include "airspygui.h"
#include "airspyinput.h" #include "airspyinput.h"
@ -699,6 +702,17 @@ int AirspyInput::webapiSettingsPutPatch(
return 200; return 200;
} }
int AirspyInput::webapiReportGet(
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage __attribute__((unused)))
{
response.setAirspyReport(new SWGSDRangel::SWGAirspyReport());
response.getAirspyReport()->init();
webapiFormatDeviceReport(response);
return 200;
}
void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings) void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings)
{ {
response.getAirspySettings()->setCenterFrequency(settings.m_centerFrequency); response.getAirspySettings()->setCenterFrequency(settings.m_centerFrequency);
@ -723,3 +737,15 @@ void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
response.getAirspySettings()->setFileRecordName(new QString(settings.m_fileRecordName)); response.getAirspySettings()->setFileRecordName(new QString(settings.m_fileRecordName));
} }
} }
void AirspyInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
response.setAirspyReport(new SWGSDRangel::SWGAirspyReport());
response.getAirspyReport()->setSampleRates(new QList<SWGSDRangel::SWGAirspyReport_sampleRates*>);
for (std::vector<uint32_t>::const_iterator it = getSampleRates().begin(); it != getSampleRates().end(); ++it)
{
response.getAirspyReport()->getSampleRates()->append(new SWGSDRangel::SWGAirspyReport_sampleRates);
response.getAirspyReport()->getSampleRates()->back()->setSampleRate(*it);
}
}

View File

@ -130,6 +130,10 @@ public:
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
QString& errorMessage); QString& errorMessage);
virtual int webapiReportGet(
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
static const qint64 loLowLimitFreq; static const qint64 loLowLimitFreq;
static const qint64 loHighLimitFreq; static const qint64 loHighLimitFreq;
@ -140,6 +144,7 @@ private:
struct airspy_device *open_airspy_from_sequence(int sequence); struct airspy_device *open_airspy_from_sequence(int sequence);
void setDeviceCenterFrequency(quint64 freq); void setDeviceCenterFrequency(quint64 freq);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings); void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
DeviceSourceAPI *m_deviceAPI; DeviceSourceAPI *m_deviceAPI;
QMutex m_mutex; QMutex m_mutex;

View File

@ -29,6 +29,7 @@ namespace SWGSDRangel
{ {
class SWGDeviceSettings; class SWGDeviceSettings;
class SWGDeviceState; class SWGDeviceState;
class SWGDeviceReport;
} }
class SDRBASE_API DeviceSampleSink : public QObject { class SDRBASE_API DeviceSampleSink : public QObject {
@ -74,6 +75,11 @@ public:
QString& errorMessage) QString& errorMessage)
{ errorMessage = "Not implemented"; return 501; } { errorMessage = "Not implemented"; return 501; }
virtual int webapiReportGet(
SWGSDRangel::SWGDeviceReport& response __attribute__((unused)),
QString& errorMessage)
{ errorMessage = "Not implemented"; return 501; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; } MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }

View File

@ -30,6 +30,7 @@ namespace SWGSDRangel
{ {
class SWGDeviceSettings; class SWGDeviceSettings;
class SWGDeviceState; class SWGDeviceState;
class SWGDeviceReport;
} }
class SDRBASE_API DeviceSampleSource : public QObject { class SDRBASE_API DeviceSampleSource : public QObject {
@ -81,6 +82,11 @@ public:
QString& errorMessage) QString& errorMessage)
{ errorMessage = "Not implemented"; return 501; } { errorMessage = "Not implemented"; return 501; }
virtual int webapiReportGet(
SWGSDRangel::SWGDeviceReport& response __attribute__((unused)),
QString& errorMessage)
{ errorMessage = "Not implemented"; return 501; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; } MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }

View File

@ -3,6 +3,7 @@
<file>webapi/doc/html2/index.html</file> <file>webapi/doc/html2/index.html</file>
<file>webapi/doc/swagger/swagger.yaml</file> <file>webapi/doc/swagger/swagger.yaml</file>
<file>webapi/doc/swagger/include/CWKeyer.yaml</file> <file>webapi/doc/swagger/include/CWKeyer.yaml</file>
<file>webapi/doc/swagger/include/Airspy.yaml</file>
<file>webapi/doc/swagger/include/AirspyHF.yaml</file> <file>webapi/doc/swagger/include/AirspyHF.yaml</file>
<file>webapi/doc/swagger/include/BladeRF.yaml</file> <file>webapi/doc/swagger/include/BladeRF.yaml</file>
<file>webapi/doc/swagger/include/FileSource.yaml</file> <file>webapi/doc/swagger/include/FileSource.yaml</file>
@ -17,6 +18,8 @@
<file>webapi/doc/swagger/include/NFMMod.yaml</file> <file>webapi/doc/swagger/include/NFMMod.yaml</file>
<file>webapi/doc/swagger/include/SSBMod.yaml</file> <file>webapi/doc/swagger/include/SSBMod.yaml</file>
<file>webapi/doc/swagger/include/UDPSink.yaml</file> <file>webapi/doc/swagger/include/UDPSink.yaml</file>
<file>webapi/doc/swagger/include/UDPSrc.yaml</file>
<file>webapi/doc/swagger/include/WFMDemod.yaml</file>
<file>webapi/doc/swagger/include/WFMMod.yaml</file> <file>webapi/doc/swagger/include/WFMMod.yaml</file>
<file>webapi/doc/swagger/include/RtlSdr.yaml</file> <file>webapi/doc/swagger/include/RtlSdr.yaml</file>
<file>webapi/doc/swagger-ui/swagger-ui.js.map</file> <file>webapi/doc/swagger-ui/swagger-ui.js.map</file>

View File

@ -942,6 +942,25 @@ margin-bottom: 20px;
} }
}, },
"description" : "AirspyHF" "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 = { defs.AirspySettings = {
"properties" : { "properties" : {
@ -1663,6 +1682,24 @@ margin-bottom: 20px;
} }
}, },
"description" : "Summarized information about attached hardware device" "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 = { defs.DeviceSet = {
"required" : [ "channelcount", "samplingDevice" ], "required" : [ "channelcount", "samplingDevice" ],
@ -2988,6 +3025,9 @@ margin-bottom: 20px;
<li data-group="DeviceSet" data-name="devicesetDevicePut" class=""> <li data-group="DeviceSet" data-name="devicesetDevicePut" class="">
<a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a> <a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a>
</li> </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=""> <li data-group="DeviceSet" data-name="devicesetDeviceRunDelete" class="">
<a href="#api-DeviceSet-devicesetDeviceRunDelete">devicesetDeviceRunDelete</a> <a href="#api-DeviceSet-devicesetDeviceRunDelete">devicesetDeviceRunDelete</a>
</li> </li>
@ -7189,6 +7229,467 @@ $(document).ready(function() {
</article> </article>
</div> </div>
<hr> <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"> <div id="api-DeviceSet-devicesetDeviceRunDelete">
<article id="api-DeviceSet-devicesetDeviceRunDelete-0" data-group="User" data-name="devicesetDeviceRunDelete" data-version="0"> <article id="api-DeviceSet-devicesetDeviceRunDelete-0" data-group="User" data-name="devicesetDeviceRunDelete" data-version="0">
<div class="pull-left"> <div class="pull-left">
@ -21180,7 +21681,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-05-25T18:55:39.036+02:00 Generated 2018-05-26T00:44:20.967+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -40,3 +40,15 @@ AirspySettings:
fileRecordName: fileRecordName:
type: string type: string
AirspyReport:
description: Airspy
properties:
sampleRates:
type: array
items:
properties:
sampleRate:
description: sample rate in S/s
type: integer

View File

@ -937,6 +937,38 @@ paths:
"501": "501":
$ref: "#/responses/Response_501" $ref: "#/responses/Response_501"
/sdrangel/deviceset/{deviceSetIndex}/device/report:
x-swagger-router-controller: deviceset
get:
description: get the device report
operationId: devicesetDeviceReportGet
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 device report
schema:
$ref: "#/definitions/DeviceReport"
"400":
description: Invalid device set
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}/channels/report: /sdrangel/deviceset/{deviceSetIndex}/channels/report:
x-swagger-router-controller: deviceset x-swagger-router-controller: deviceset
get: get:
@ -1734,6 +1766,22 @@ definitions:
rtlSdrSettings: rtlSdrSettings:
$ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrSettings" $ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
DeviceReport:
description: Base device report. The specific device report present depeds on deviceHwType
discriminator: deviceHwType
required:
- deviceHwType
- tx
properties:
deviceHwType:
description: Device hardware type code
type: string
tx:
description: Not zero if it is a tx device else it is a rx device
type: integer
airspyReport:
$ref: "/doc/swagger/include/Airspy.yaml#/AirspyReport"
ChannelSettings: ChannelSettings:
description: Base channel settings. The specific channel settings present depends on channelType. description: Base channel settings. The specific channel settings present depends on channelType.
discriminator: channelType discriminator: channelType

View File

@ -40,6 +40,7 @@ std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0
std::regex WebAPIAdapterInterface::devicesetDeviceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device$"); 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::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$");
std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run"); std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run");
std::regex WebAPIAdapterInterface::devicesetDeviceReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/report$");
std::regex WebAPIAdapterInterface::devicesetChannelsReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channels/report$"); 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::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::devicesetChannelIndexURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})$");

View File

@ -47,6 +47,7 @@ namespace SWGSDRangel
class SWGDeviceListItem; class SWGDeviceListItem;
class SWGDeviceSettings; class SWGDeviceSettings;
class SWGDeviceState; class SWGDeviceState;
class SWGDeviceReport;
class SWGChannelsDetail; class SWGChannelsDetail;
class SWGChannelSettings; class SWGChannelSettings;
class SWGChannelReport; class SWGChannelReport;
@ -523,6 +524,20 @@ public:
return 501; return 501;
} }
/**
* Handler of /sdrangel/deviceset/{devicesetIndex}/device/report (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
*/
virtual int devicesetDeviceReportGet(
int deviceSetIndex __attribute__((unused)),
SWGSDRangel::SWGDeviceReport& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
*error.getMessage() = QString("Function not implemented");
return 501;
}
/** /**
* Handler of /sdrangel/deviceset/{devicesetIndex}/channels/report (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels * 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) * returns the Http status code (default 501: not implemented)
@ -636,6 +651,7 @@ public:
static std::regex devicesetDeviceURLRe; static std::regex devicesetDeviceURLRe;
static std::regex devicesetDeviceSettingsURLRe; static std::regex devicesetDeviceSettingsURLRe;
static std::regex devicesetDeviceRunURLRe; static std::regex devicesetDeviceRunURLRe;
static std::regex devicesetDeviceReportURLRe;
static std::regex devicesetChannelURLRe; static std::regex devicesetChannelURLRe;
static std::regex devicesetChannelIndexURLRe; static std::regex devicesetChannelIndexURLRe;
static std::regex devicesetChannelSettingsURLRe; static std::regex devicesetChannelSettingsURLRe;

View File

@ -38,6 +38,7 @@
#include "SWGPresetExport.h" #include "SWGPresetExport.h"
#include "SWGDeviceSettings.h" #include "SWGDeviceSettings.h"
#include "SWGDeviceState.h" #include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGChannelsDetail.h" #include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h" #include "SWGChannelSettings.h"
#include "SWGChannelReport.h" #include "SWGChannelReport.h"
@ -122,6 +123,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
devicesetDeviceSettingsService(std::string(desc_match[1]), request, response); devicesetDeviceSettingsService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceRunURLRe)) { } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceRunURLRe)) {
devicesetDeviceRunService(std::string(desc_match[1]), request, response); devicesetDeviceRunService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceReportURLRe)) {
devicesetDeviceReportService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelsReportURLRe)) { } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelsReportURLRe)) {
devicesetChannelsReportService(std::string(desc_match[1]), request, response); devicesetChannelsReportService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelURLRe)) { } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelURLRe)) {
@ -1241,6 +1244,43 @@ void WebAPIRequestMapper::devicesetDeviceRunService(const std::string& indexStr,
} }
} }
void WebAPIRequestMapper::devicesetDeviceReportService(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::SWGDeviceReport normalResponse;
int deviceSetIndex = boost::lexical_cast<int>(indexStr);
int status = m_adapter->devicesetDeviceReportGet(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::devicesetChannelsReportService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) void WebAPIRequestMapper::devicesetChannelsReportService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{ {
SWGSDRangel::SWGErrorResponse errorResponse; SWGSDRangel::SWGErrorResponse errorResponse;

View File

@ -69,6 +69,7 @@ private:
void devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); 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 devicesetDeviceSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetDeviceRunService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetDeviceRunService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetDeviceReportService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetChannelsReportService(const std::string& deviceSetIndexStr, 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 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 devicesetChannelIndexService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);

View File

@ -53,6 +53,7 @@
#include "SWGPresetIdentifier.h" #include "SWGPresetIdentifier.h"
#include "SWGDeviceSettings.h" #include "SWGDeviceSettings.h"
#include "SWGDeviceState.h" #include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGChannelsDetail.h" #include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h" #include "SWGChannelSettings.h"
#include "SWGChannelReport.h" #include "SWGChannelReport.h"
@ -1169,6 +1170,45 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
} }
} }
int WebAPIAdapterGUI::devicesetDeviceReportGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceReport& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
if (deviceSet->m_deviceSourceEngine) // Rx
{
response.setDeviceHwType(new QString(deviceSet->m_deviceSourceAPI->getHardwareId()));
response.setTx(0);
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
return source->webapiReportGet(response, *error.getMessage());
}
else if (deviceSet->m_deviceSinkEngine) // Tx
{
response.setDeviceHwType(new QString(deviceSet->m_deviceSinkAPI->getHardwareId()));
response.setTx(1);
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
return sink->webapiReportGet(response, *error.getMessage());
}
else
{
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
else
{
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapterGUI::devicesetChannelsReportGet( int WebAPIAdapterGUI::devicesetChannelsReportGet(
int deviceSetIndex, int deviceSetIndex,
SWGSDRangel::SWGChannelsDetail& response, SWGSDRangel::SWGChannelsDetail& response,

View File

@ -181,6 +181,11 @@ public:
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetDeviceReportGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceReport& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetChannelsReportGet( virtual int devicesetChannelsReportGet(
int deviceSetIndex, int deviceSetIndex,
SWGSDRangel::SWGChannelsDetail& response, SWGSDRangel::SWGChannelsDetail& response,

View File

@ -40,3 +40,15 @@ AirspySettings:
fileRecordName: fileRecordName:
type: string type: string
AirspyReport:
description: Airspy
properties:
sampleRates:
type: array
items:
properties:
sampleRate:
description: sample rate in S/s
type: integer

View File

@ -937,6 +937,38 @@ paths:
"501": "501":
$ref: "#/responses/Response_501" $ref: "#/responses/Response_501"
/sdrangel/deviceset/{deviceSetIndex}/device/report:
x-swagger-router-controller: deviceset
get:
description: get the device report
operationId: devicesetDeviceReportGet
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 device report
schema:
$ref: "#/definitions/DeviceReport"
"400":
description: Invalid device set
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}/channels/report: /sdrangel/deviceset/{deviceSetIndex}/channels/report:
x-swagger-router-controller: deviceset x-swagger-router-controller: deviceset
get: get:
@ -1734,6 +1766,22 @@ definitions:
rtlSdrSettings: rtlSdrSettings:
$ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrSettings" $ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
DeviceReport:
description: Base device report. The specific device report present depeds on deviceHwType
discriminator: deviceHwType
required:
- deviceHwType
- tx
properties:
deviceHwType:
description: Device hardware type code
type: string
tx:
description: Not zero if it is a tx device else it is a rx device
type: integer
airspyReport:
$ref: "http://localhost:8081/api/swagger/include/Airspy.yaml#/AirspyReport"
ChannelSettings: ChannelSettings:
description: Base channel settings. The specific channel settings present depends on channelType. description: Base channel settings. The specific channel settings present depends on channelType.
discriminator: channelType discriminator: channelType

View File

@ -942,6 +942,25 @@ margin-bottom: 20px;
} }
}, },
"description" : "AirspyHF" "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 = { defs.AirspySettings = {
"properties" : { "properties" : {
@ -1663,6 +1682,24 @@ margin-bottom: 20px;
} }
}, },
"description" : "Summarized information about attached hardware device" "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 = { defs.DeviceSet = {
"required" : [ "channelcount", "samplingDevice" ], "required" : [ "channelcount", "samplingDevice" ],
@ -2988,6 +3025,9 @@ margin-bottom: 20px;
<li data-group="DeviceSet" data-name="devicesetDevicePut" class=""> <li data-group="DeviceSet" data-name="devicesetDevicePut" class="">
<a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a> <a href="#api-DeviceSet-devicesetDevicePut">devicesetDevicePut</a>
</li> </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=""> <li data-group="DeviceSet" data-name="devicesetDeviceRunDelete" class="">
<a href="#api-DeviceSet-devicesetDeviceRunDelete">devicesetDeviceRunDelete</a> <a href="#api-DeviceSet-devicesetDeviceRunDelete">devicesetDeviceRunDelete</a>
</li> </li>
@ -7189,6 +7229,467 @@ $(document).ready(function() {
</article> </article>
</div> </div>
<hr> <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"> <div id="api-DeviceSet-devicesetDeviceRunDelete">
<article id="api-DeviceSet-devicesetDeviceRunDelete-0" data-group="User" data-name="devicesetDeviceRunDelete" data-version="0"> <article id="api-DeviceSet-devicesetDeviceRunDelete-0" data-group="User" data-name="devicesetDeviceRunDelete" data-version="0">
<div class="pull-left"> <div class="pull-left">
@ -21180,7 +21681,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-05-25T18:55:39.036+02:00 Generated 2018-05-26T00:44:20.967+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,112 @@
/**
* 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 "SWGAirspyReport.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGAirspyReport::SWGAirspyReport(QString* json) {
init();
this->fromJson(*json);
}
SWGAirspyReport::SWGAirspyReport() {
sample_rates = nullptr;
m_sample_rates_isSet = false;
}
SWGAirspyReport::~SWGAirspyReport() {
this->cleanup();
}
void
SWGAirspyReport::init() {
sample_rates = new QList<SWGAirspyReport_sampleRates*>();
m_sample_rates_isSet = false;
}
void
SWGAirspyReport::cleanup() {
if(sample_rates != nullptr) {
auto arr = sample_rates;
for(auto o: *arr) {
delete o;
}
delete sample_rates;
}
}
SWGAirspyReport*
SWGAirspyReport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGAirspyReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_rates, pJson["sampleRates"], "QList", "SWGAirspyReport_sampleRates");
}
QString
SWGAirspyReport::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGAirspyReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(sample_rates->size() > 0){
toJsonArray((QList<void*>*)sample_rates, obj, "sampleRates", "SWGAirspyReport_sampleRates");
}
return obj;
}
QList<SWGAirspyReport_sampleRates*>*
SWGAirspyReport::getSampleRates() {
return sample_rates;
}
void
SWGAirspyReport::setSampleRates(QList<SWGAirspyReport_sampleRates*>* sample_rates) {
this->sample_rates = sample_rates;
this->m_sample_rates_isSet = true;
}
bool
SWGAirspyReport::isSet(){
bool isObjectUpdated = false;
do{
if(sample_rates->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,60 @@
/**
* 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.
*/
/*
* SWGAirspyReport.h
*
* Airspy
*/
#ifndef SWGAirspyReport_H_
#define SWGAirspyReport_H_
#include <QJsonObject>
#include "SWGAirspyReport_sampleRates.h"
#include <QList>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGAirspyReport: public SWGObject {
public:
SWGAirspyReport();
SWGAirspyReport(QString* json);
virtual ~SWGAirspyReport();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAirspyReport* fromJson(QString &jsonString) override;
QList<SWGAirspyReport_sampleRates*>* getSampleRates();
void setSampleRates(QList<SWGAirspyReport_sampleRates*>* sample_rates);
virtual bool isSet() override;
private:
QList<SWGAirspyReport_sampleRates*>* sample_rates;
bool m_sample_rates_isSet;
};
}
#endif /* SWGAirspyReport_H_ */

View File

@ -0,0 +1,106 @@
/**
* 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 "SWGAirspyReport_sampleRates.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGAirspyReport_sampleRates::SWGAirspyReport_sampleRates(QString* json) {
init();
this->fromJson(*json);
}
SWGAirspyReport_sampleRates::SWGAirspyReport_sampleRates() {
sample_rate = 0;
m_sample_rate_isSet = false;
}
SWGAirspyReport_sampleRates::~SWGAirspyReport_sampleRates() {
this->cleanup();
}
void
SWGAirspyReport_sampleRates::init() {
sample_rate = 0;
m_sample_rate_isSet = false;
}
void
SWGAirspyReport_sampleRates::cleanup() {
}
SWGAirspyReport_sampleRates*
SWGAirspyReport_sampleRates::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGAirspyReport_sampleRates::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
}
QString
SWGAirspyReport_sampleRates::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGAirspyReport_sampleRates::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate));
}
return obj;
}
qint32
SWGAirspyReport_sampleRates::getSampleRate() {
return sample_rate;
}
void
SWGAirspyReport_sampleRates::setSampleRate(qint32 sample_rate) {
this->sample_rate = sample_rate;
this->m_sample_rate_isSet = true;
}
bool
SWGAirspyReport_sampleRates::isSet(){
bool isObjectUpdated = false;
do{
if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,58 @@
/**
* 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.
*/
/*
* SWGAirspyReport_sampleRates.h
*
*
*/
#ifndef SWGAirspyReport_sampleRates_H_
#define SWGAirspyReport_sampleRates_H_
#include <QJsonObject>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGAirspyReport_sampleRates: public SWGObject {
public:
SWGAirspyReport_sampleRates();
SWGAirspyReport_sampleRates(QString* json);
virtual ~SWGAirspyReport_sampleRates();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAirspyReport_sampleRates* fromJson(QString &jsonString) override;
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
virtual bool isSet() override;
private:
qint32 sample_rate;
bool m_sample_rate_isSet;
};
}
#endif /* SWGAirspyReport_sampleRates_H_ */

View File

@ -0,0 +1,152 @@
/**
* 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 "SWGDeviceReport.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGDeviceReport::SWGDeviceReport(QString* json) {
init();
this->fromJson(*json);
}
SWGDeviceReport::SWGDeviceReport() {
device_hw_type = nullptr;
m_device_hw_type_isSet = false;
tx = 0;
m_tx_isSet = false;
airspy_report = nullptr;
m_airspy_report_isSet = false;
}
SWGDeviceReport::~SWGDeviceReport() {
this->cleanup();
}
void
SWGDeviceReport::init() {
device_hw_type = new QString("");
m_device_hw_type_isSet = false;
tx = 0;
m_tx_isSet = false;
airspy_report = new SWGAirspyReport();
m_airspy_report_isSet = false;
}
void
SWGDeviceReport::cleanup() {
if(device_hw_type != nullptr) {
delete device_hw_type;
}
if(airspy_report != nullptr) {
delete airspy_report;
}
}
SWGDeviceReport*
SWGDeviceReport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGDeviceReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&device_hw_type, pJson["deviceHwType"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&airspy_report, pJson["airspyReport"], "SWGAirspyReport", "SWGAirspyReport");
}
QString
SWGDeviceReport::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGDeviceReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(device_hw_type != nullptr && *device_hw_type != QString("")){
toJsonValue(QString("deviceHwType"), device_hw_type, obj, QString("QString"));
}
if(m_tx_isSet){
obj->insert("tx", QJsonValue(tx));
}
if((airspy_report != nullptr) && (airspy_report->isSet())){
toJsonValue(QString("airspyReport"), airspy_report, obj, QString("SWGAirspyReport"));
}
return obj;
}
QString*
SWGDeviceReport::getDeviceHwType() {
return device_hw_type;
}
void
SWGDeviceReport::setDeviceHwType(QString* device_hw_type) {
this->device_hw_type = device_hw_type;
this->m_device_hw_type_isSet = true;
}
qint32
SWGDeviceReport::getTx() {
return tx;
}
void
SWGDeviceReport::setTx(qint32 tx) {
this->tx = tx;
this->m_tx_isSet = true;
}
SWGAirspyReport*
SWGDeviceReport::getAirspyReport() {
return airspy_report;
}
void
SWGDeviceReport::setAirspyReport(SWGAirspyReport* airspy_report) {
this->airspy_report = airspy_report;
this->m_airspy_report_isSet = true;
}
bool
SWGDeviceReport::isSet(){
bool isObjectUpdated = false;
do{
if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(airspy_report != nullptr && airspy_report->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,72 @@
/**
* 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.
*/
/*
* SWGDeviceReport.h
*
* Base device report. The specific device report present depeds on deviceHwType
*/
#ifndef SWGDeviceReport_H_
#define SWGDeviceReport_H_
#include <QJsonObject>
#include "SWGAirspyReport.h"
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGDeviceReport: public SWGObject {
public:
SWGDeviceReport();
SWGDeviceReport(QString* json);
virtual ~SWGDeviceReport();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGDeviceReport* fromJson(QString &jsonString) override;
QString* getDeviceHwType();
void setDeviceHwType(QString* device_hw_type);
qint32 getTx();
void setTx(qint32 tx);
SWGAirspyReport* getAirspyReport();
void setAirspyReport(SWGAirspyReport* airspy_report);
virtual bool isSet() override;
private:
QString* device_hw_type;
bool m_device_hw_type_isSet;
qint32 tx;
bool m_tx_isSet;
SWGAirspyReport* airspy_report;
bool m_airspy_report_isSet;
};
}
#endif /* SWGDeviceReport_H_ */

View File

@ -482,6 +482,60 @@ SWGDeviceSetApi::devicesetDevicePutCallback(SWGHttpRequestWorker * worker) {
} }
} }
void
SWGDeviceSetApi::devicesetDeviceReportGet(qint32 device_set_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/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::devicesetDeviceReportGetCallback);
worker->execute(&input);
}
void
SWGDeviceSetApi::devicesetDeviceReportGetCallback(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);
SWGDeviceReport* output = static_cast<SWGDeviceReport*>(create(json, QString("SWGDeviceReport")));
worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceReportGetSignal(output);
} else {
emit devicesetDeviceReportGetSignalE(output, error_type, error_str);
emit devicesetDeviceReportGetSignalEFull(worker, error_type, error_str);
}
}
void void
SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) { SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
QString fullPath; QString fullPath;

View File

@ -19,6 +19,7 @@
#include "SWGChannelSettings.h" #include "SWGChannelSettings.h"
#include "SWGChannelsDetail.h" #include "SWGChannelsDetail.h"
#include "SWGDeviceListItem.h" #include "SWGDeviceListItem.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceSet.h" #include "SWGDeviceSet.h"
#include "SWGDeviceSettings.h" #include "SWGDeviceSettings.h"
#include "SWGDeviceState.h" #include "SWGDeviceState.h"
@ -49,6 +50,7 @@ public:
void devicesetChannelSettingsPut(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 devicesetChannelsReportGet(qint32 device_set_index);
void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body); void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body);
void devicesetDeviceReportGet(qint32 device_set_index);
void devicesetDeviceRunDelete(qint32 device_set_index); void devicesetDeviceRunDelete(qint32 device_set_index);
void devicesetDeviceRunGet(qint32 device_set_index); void devicesetDeviceRunGet(qint32 device_set_index);
void devicesetDeviceRunPost(qint32 device_set_index); void devicesetDeviceRunPost(qint32 device_set_index);
@ -69,6 +71,7 @@ private:
void devicesetChannelSettingsPutCallback (SWGHttpRequestWorker * worker); void devicesetChannelSettingsPutCallback (SWGHttpRequestWorker * worker);
void devicesetChannelsReportGetCallback (SWGHttpRequestWorker * worker); void devicesetChannelsReportGetCallback (SWGHttpRequestWorker * worker);
void devicesetDevicePutCallback (SWGHttpRequestWorker * worker); void devicesetDevicePutCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceReportGetCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunDeleteCallback (SWGHttpRequestWorker * worker); void devicesetDeviceRunDeleteCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunGetCallback (SWGHttpRequestWorker * worker); void devicesetDeviceRunGetCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunPostCallback (SWGHttpRequestWorker * worker); void devicesetDeviceRunPostCallback (SWGHttpRequestWorker * worker);
@ -89,6 +92,7 @@ signals:
void devicesetChannelSettingsPutSignal(SWGChannelSettings* summary); void devicesetChannelSettingsPutSignal(SWGChannelSettings* summary);
void devicesetChannelsReportGetSignal(SWGChannelsDetail* summary); void devicesetChannelsReportGetSignal(SWGChannelsDetail* summary);
void devicesetDevicePutSignal(SWGDeviceListItem* summary); void devicesetDevicePutSignal(SWGDeviceListItem* summary);
void devicesetDeviceReportGetSignal(SWGDeviceReport* summary);
void devicesetDeviceRunDeleteSignal(SWGDeviceState* summary); void devicesetDeviceRunDeleteSignal(SWGDeviceState* summary);
void devicesetDeviceRunGetSignal(SWGDeviceState* summary); void devicesetDeviceRunGetSignal(SWGDeviceState* summary);
void devicesetDeviceRunPostSignal(SWGDeviceState* summary); void devicesetDeviceRunPostSignal(SWGDeviceState* summary);
@ -108,6 +112,7 @@ signals:
void devicesetChannelSettingsPutSignalE(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 devicesetChannelsReportGetSignalE(SWGChannelsDetail* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDevicePutSignalE(SWGDeviceListItem* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDevicePutSignalE(SWGDeviceListItem* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceReportGetSignalE(SWGDeviceReport* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunDeleteSignalE(SWGDeviceState* 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); void devicesetDeviceRunGetSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunPostSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceRunPostSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str);
@ -127,6 +132,7 @@ signals:
void devicesetChannelSettingsPutSignalEFull(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 devicesetChannelsReportGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDevicePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDevicePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceReportGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunDeleteSignalEFull(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); void devicesetDeviceRunGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceRunPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);

View File

@ -21,6 +21,8 @@
#include "SWGATVModReport.h" #include "SWGATVModReport.h"
#include "SWGATVModSettings.h" #include "SWGATVModSettings.h"
#include "SWGAirspyHFSettings.h" #include "SWGAirspyHFSettings.h"
#include "SWGAirspyReport.h"
#include "SWGAirspyReport_sampleRates.h"
#include "SWGAirspySettings.h" #include "SWGAirspySettings.h"
#include "SWGAudioDevices.h" #include "SWGAudioDevices.h"
#include "SWGAudioInputDevice.h" #include "SWGAudioInputDevice.h"
@ -40,6 +42,7 @@
#include "SWGDVSeralDevices.h" #include "SWGDVSeralDevices.h"
#include "SWGDVSerialDevice.h" #include "SWGDVSerialDevice.h"
#include "SWGDeviceListItem.h" #include "SWGDeviceListItem.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceSet.h" #include "SWGDeviceSet.h"
#include "SWGDeviceSetList.h" #include "SWGDeviceSetList.h"
#include "SWGDeviceSettings.h" #include "SWGDeviceSettings.h"
@ -106,6 +109,12 @@ namespace SWGSDRangel {
if(QString("SWGAirspyHFSettings").compare(type) == 0) { if(QString("SWGAirspyHFSettings").compare(type) == 0) {
return new SWGAirspyHFSettings(); return new SWGAirspyHFSettings();
} }
if(QString("SWGAirspyReport").compare(type) == 0) {
return new SWGAirspyReport();
}
if(QString("SWGAirspyReport_sampleRates").compare(type) == 0) {
return new SWGAirspyReport_sampleRates();
}
if(QString("SWGAirspySettings").compare(type) == 0) { if(QString("SWGAirspySettings").compare(type) == 0) {
return new SWGAirspySettings(); return new SWGAirspySettings();
} }
@ -163,6 +172,9 @@ namespace SWGSDRangel {
if(QString("SWGDeviceListItem").compare(type) == 0) { if(QString("SWGDeviceListItem").compare(type) == 0) {
return new SWGDeviceListItem(); return new SWGDeviceListItem();
} }
if(QString("SWGDeviceReport").compare(type) == 0) {
return new SWGDeviceReport();
}
if(QString("SWGDeviceSet").compare(type) == 0) { if(QString("SWGDeviceSet").compare(type) == 0) {
return new SWGDeviceSet(); return new SWGDeviceSet();
} }