mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Web API: new entry point to get a channel report. Applied to NFM mod and demod
This commit is contained in:
parent
733c213bf2
commit
d4e1521c90
@ -22,9 +22,12 @@
|
||||
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGNFMDemodSettings.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGNFMDemodReport.h"
|
||||
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "util/stepfunctions.h"
|
||||
#include "util/db.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
@ -643,6 +646,16 @@ int NFMDemod::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int NFMDemod::webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setNfmDemodReport(new SWGSDRangel::SWGNFMDemodReport());
|
||||
response.getNfmDemodReport()->init();
|
||||
webapiFormatChannelReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void NFMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const NFMDemodSettings& settings)
|
||||
{
|
||||
response.getNfmDemodSettings()->setAfBandwidth(settings.m_afBandwidth);
|
||||
@ -675,3 +688,13 @@ void NFMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp
|
||||
}
|
||||
}
|
||||
|
||||
void NFMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
double magsqAvg, magsqPeak;
|
||||
int nbMagsqSamples;
|
||||
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
||||
|
||||
response.getNfmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
|
||||
response.getNfmDemodReport()->setCtcssTone(m_settings.m_ctcssOn ? (m_ctcssIndex ? 0 : m_ctcssDetector.getToneSet()[m_ctcssIndex-1]) : 0);
|
||||
response.getNfmDemodReport()->setSquelch(m_squelchOpen ? 1 : 0);
|
||||
}
|
||||
|
@ -136,6 +136,10 @@ public:
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
const Real *getCtcssToneSet(int& nbTones) const {
|
||||
nbTones = m_ctcssDetector.getNTones();
|
||||
return m_ctcssDetector.getToneSet();
|
||||
@ -220,6 +224,7 @@ private:
|
||||
void applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force = false);
|
||||
void applySettings(const NFMDemodSettings& settings, bool force = false);
|
||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const NFMDemodSettings& settings);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_NFMDEMOD_H
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGCWKeyerSettings.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGNFMModReport.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <complex.h>
|
||||
@ -30,6 +32,7 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "dsp/threadedbasebandsamplesource.h"
|
||||
#include "util/db.h"
|
||||
|
||||
#include "nfmmod.h"
|
||||
|
||||
@ -625,6 +628,16 @@ int NFMMod::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int NFMMod::webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setNfmModReport(new SWGSDRangel::SWGNFMModReport());
|
||||
response.getNfmModReport()->init();
|
||||
webapiFormatChannelReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const NFMModSettings& settings)
|
||||
{
|
||||
response.getNfmModSettings()->setAfBandwidth(settings.m_afBandwidth);
|
||||
@ -666,3 +679,8 @@ void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
|
||||
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
|
||||
}
|
||||
|
||||
void NFMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
response.getNfmModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
||||
}
|
||||
|
@ -227,6 +227,10 @@ public:
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
double getMagSq() const { return m_magsq; }
|
||||
|
||||
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||
@ -302,6 +306,7 @@ private:
|
||||
void openFileStream();
|
||||
void seekFileStream(int seekPercentage);
|
||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const NFMModSettings& settings);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
};
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGChannelSettings;
|
||||
class SWGChannelReport;
|
||||
}
|
||||
|
||||
class SDRBASE_API ChannelSinkAPI {
|
||||
@ -57,6 +58,11 @@ public:
|
||||
QString& errorMessage)
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response __attribute__((unused)),
|
||||
QString& errorMessage)
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
int getIndexInDeviceSet() const { return m_indexInDeviceSet; }
|
||||
void setIndexInDeviceSet(int indexInDeviceSet) { m_indexInDeviceSet = indexInDeviceSet; }
|
||||
uint64_t getUID() const { return m_uid; }
|
||||
|
@ -27,6 +27,7 @@
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGChannelSettings;
|
||||
class SWGChannelReport;
|
||||
}
|
||||
|
||||
class SDRBASE_API ChannelSourceAPI {
|
||||
@ -56,6 +57,11 @@ public:
|
||||
QString& errorMessage)
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response __attribute__((unused)),
|
||||
QString& errorMessage)
|
||||
{ errorMessage = "Not implemented"; return 501; }
|
||||
|
||||
int getIndexInDeviceSet() const { return m_indexInDeviceSet; }
|
||||
void setIndexInDeviceSet(int indexInDeviceSet) { m_indexInDeviceSet = indexInDeviceSet; }
|
||||
uint64_t getUID() const { return m_uid; }
|
||||
|
@ -840,6 +840,27 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Summarized information about channel plugin"
|
||||
};
|
||||
defs.ChannelReport = {
|
||||
"required" : [ "channelType", "tx" ],
|
||||
"discriminator" : "channelType",
|
||||
"properties" : {
|
||||
"channelType" : {
|
||||
"type" : "string",
|
||||
"description" : "Channel type code"
|
||||
},
|
||||
"tx" : {
|
||||
"type" : "integer",
|
||||
"description" : "Not zero if it is a tx channel else it is a rx channel"
|
||||
},
|
||||
"NFMDemodReport" : {
|
||||
"$ref" : "#/definitions/NFMDemodReport"
|
||||
},
|
||||
"NFMModReport" : {
|
||||
"$ref" : "#/definitions/NFMModReport"
|
||||
}
|
||||
},
|
||||
"description" : "Base channel report. The specific channel report present depends on channelType."
|
||||
};
|
||||
defs.ChannelSettings = {
|
||||
"required" : [ "channelType", "tx" ],
|
||||
@ -860,7 +881,7 @@ margin-bottom: 20px;
|
||||
"$ref" : "#/definitions/NFMModSettings"
|
||||
}
|
||||
},
|
||||
"description" : "Base channel settings"
|
||||
"description" : "Base channel settings. The specific channel settings present depends on channelType."
|
||||
};
|
||||
defs.DVSeralDevices = {
|
||||
"required" : [ "nbDevices" ],
|
||||
@ -1000,7 +1021,7 @@ margin-bottom: 20px;
|
||||
"$ref" : "#/definitions/RtlSdrSettings"
|
||||
}
|
||||
},
|
||||
"description" : "Base device settings"
|
||||
"description" : "Base device settings. The specific device settings present depends on deviceHwType."
|
||||
};
|
||||
defs.DeviceState = {
|
||||
"required" : [ "state" ],
|
||||
@ -1325,6 +1346,25 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Logging parameters setting"
|
||||
};
|
||||
defs.NFMDemodReport = {
|
||||
"properties" : {
|
||||
"channelPowerDB" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "power received in channel (dB)"
|
||||
},
|
||||
"ctcssTone" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "CTCSS tone frequency if detected else 0"
|
||||
},
|
||||
"squelch" : {
|
||||
"type" : "integer",
|
||||
"description" : "squelch status (1 if open else 0)"
|
||||
}
|
||||
},
|
||||
"description" : "NFMDemod"
|
||||
};
|
||||
defs.NFMDemodSettings = {
|
||||
"properties" : {
|
||||
@ -1389,6 +1429,16 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "NFMDemod"
|
||||
};
|
||||
defs.NFMModReport = {
|
||||
"properties" : {
|
||||
"channelPowerDB" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "power transmitted in channel (dB)"
|
||||
}
|
||||
},
|
||||
"description" : "NFMMod"
|
||||
};
|
||||
defs.NFMModSettings = {
|
||||
"properties" : {
|
||||
@ -1694,6 +1744,9 @@ margin-bottom: 20px;
|
||||
<li data-group="DeviceSet" data-name="devicesetChannelPost" class="">
|
||||
<a href="#api-DeviceSet-devicesetChannelPost">devicesetChannelPost</a>
|
||||
</li>
|
||||
<li data-group="DeviceSet" data-name="devicesetChannelReportGet" class="">
|
||||
<a href="#api-DeviceSet-devicesetChannelReportGet">devicesetChannelReportGet</a>
|
||||
</li>
|
||||
<li data-group="DeviceSet" data-name="devicesetChannelSettingsGet" class="">
|
||||
<a href="#api-DeviceSet-devicesetChannelSettingsGet">devicesetChannelSettingsGet</a>
|
||||
</li>
|
||||
@ -2838,6 +2891,500 @@ $(document).ready(function() {
|
||||
</article>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="api-DeviceSet-devicesetChannelReportGet">
|
||||
<article id="api-DeviceSet-devicesetChannelReportGet-0" data-group="User" data-name="devicesetChannelReportGet" data-version="0">
|
||||
<div class="pull-left">
|
||||
<h1>devicesetChannelReportGet</h1>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="pull-right"></div>
|
||||
<div class="clearfix"></div>
|
||||
<p></p>
|
||||
<p class="marked">get a channel report</p>
|
||||
<p></p>
|
||||
<br />
|
||||
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/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-devicesetChannelReportGet-0-curl">Curl</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-java">Java</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-android">Android</a></li>
|
||||
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-groovy">Groovy</a></li>-->
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-objc">Obj-C</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-javascript">JavaScript</a></li>
|
||||
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-angular">Angular</a></li>-->
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-csharp">C#</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-php">PHP</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-perl">Perl</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-python">Python</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelReportGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/report"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
try {
|
||||
ChannelReport result = apiInstance.devicesetChannelReportGet(deviceSetIndex, channelIndex);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetChannelReportGet");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
try {
|
||||
ChannelReport result = apiInstance.devicesetChannelReportGet(deviceSetIndex, channelIndex);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetChannelReportGet");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
<!--
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-groovy">
|
||||
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
|
||||
</div> -->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-objc">
|
||||
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
|
||||
Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
|
||||
|
||||
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
|
||||
|
||||
[apiInstance devicesetChannelReportGetWith:deviceSetIndex
|
||||
channelIndex:channelIndex
|
||||
completionHandler: ^(ChannelReport output, NSError* error) {
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
}];
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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 channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.devicesetChannelReportGet(deviceSetIndex, channelIndex, callback);
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<!--<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-angular">
|
||||
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
|
||||
</div>-->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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 devicesetChannelReportGetExample
|
||||
{
|
||||
public void main()
|
||||
{
|
||||
|
||||
var apiInstance = new DeviceSetApi();
|
||||
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
var channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
try
|
||||
{
|
||||
ChannelReport result = apiInstance.devicesetChannelReportGet(deviceSetIndex, channelIndex);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print("Exception when calling DeviceSetApi.devicesetChannelReportGet: " + e.Message );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-php">
|
||||
<pre class="prettyprint"><code class="language-php"><?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
|
||||
$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
try {
|
||||
$result = $api_instance->devicesetChannelReportGet($deviceSetIndex, $channelIndex);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling DeviceSetApi->devicesetChannelReportGet: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?></code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
eval {
|
||||
my $result = $api_instance->devicesetChannelReportGet(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
|
||||
print Dumper($result);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling DeviceSetApi->devicesetChannelReportGet: $@\n";
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
try:
|
||||
api_response = api_instance.deviceset_channel_report_get(deviceSetIndex, channelIndex)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling DeviceSetApi->devicesetChannelReportGet: %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_devicesetChannelReportGet_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>
|
||||
|
||||
<tr><td style="width:150px;">channelIndex*</td>
|
||||
<td>
|
||||
|
||||
|
||||
<div id="d2e199_devicesetChannelReportGet_channelIndex">
|
||||
<div class="json-schema-view">
|
||||
<div class="primitive">
|
||||
<span class="type">
|
||||
Integer
|
||||
</span>
|
||||
|
||||
<div class="inner description">
|
||||
Index of the channel in the channels list for this device set
|
||||
</div>
|
||||
</div>
|
||||
<div class="inner required">
|
||||
Required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Responses</h2>
|
||||
<h3> Status: 200 - On success return channel report </h3>
|
||||
|
||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#responses-devicesetChannelReportGet-200-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-200-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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 channel report",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/ChannelReport"
|
||||
}
|
||||
};
|
||||
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-devicesetChannelReportGet-200-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-200-schema-200');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-200-schema-data' type='hidden' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3> Status: 400 - Invalid device set or channel index </h3>
|
||||
|
||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#responses-devicesetChannelReportGet-400-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-400-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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 or channel index",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/ErrorResponse"
|
||||
}
|
||||
};
|
||||
var schema = schemaWrapper.schema;
|
||||
if (schema.$ref != null) {
|
||||
schema = defsParser.$refs.get(schema.$ref);
|
||||
} else {
|
||||
schemaWrapper.definitions = Object.assign({}, defs);
|
||||
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
//console.log(JSON.stringify(schema));
|
||||
var view = new JSONSchemaView(schema, 3);
|
||||
$('#responses-devicesetChannelReportGet-400-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-400-schema-400');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-400-schema-data' type='hidden' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3> Status: 404 - Device or channel not found </h3>
|
||||
|
||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#responses-devicesetChannelReportGet-404-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-404-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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 or channel 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-devicesetChannelReportGet-404-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-404-schema-404');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-500-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-500-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-500-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-500-schema-500');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-501-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-501-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-501-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-501-schema-501');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-501-schema-data' type='hidden' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="api-DeviceSet-devicesetChannelSettingsGet">
|
||||
<article id="api-DeviceSet-devicesetChannelSettingsGet-0" data-group="User" data-name="devicesetChannelSettingsGet" data-version="0">
|
||||
<div class="pull-left">
|
||||
@ -16925,7 +17472,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-03-03T23:35:13.013+01:00
|
||||
Generated 2018-03-18T11:03:22.829+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -42,4 +42,18 @@ NFMDemodSettings:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
|
||||
|
||||
NFMDemodReport:
|
||||
description: NFMDemod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power received in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
ctcssTone:
|
||||
description: CTCSS tone frequency if detected else 0
|
||||
type: number
|
||||
format: float
|
||||
squelch:
|
||||
description: squelch status (1 if open else 0)
|
||||
type: integer
|
||||
|
@ -37,4 +37,12 @@ NFMModSettings:
|
||||
type: integer
|
||||
cwKeyer:
|
||||
$ref: "/doc/swagger/include/CWKeyer.yaml#/CWKeyerSettings"
|
||||
|
||||
NFMModReport:
|
||||
description: NFMMod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power transmitted in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
|
@ -997,6 +997,43 @@ paths:
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/report:
|
||||
x-swagger-router-controller: deviceset
|
||||
get:
|
||||
description: get a channel report
|
||||
operationId: devicesetChannelReportGet
|
||||
tags:
|
||||
- DeviceSet
|
||||
parameters:
|
||||
- in: path
|
||||
name: deviceSetIndex
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of device set in the device set list
|
||||
- in: path
|
||||
name: channelIndex
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of the channel in the channels list for this device set
|
||||
responses:
|
||||
"200":
|
||||
description: On success return channel report
|
||||
schema:
|
||||
$ref: "#/definitions/ChannelReport"
|
||||
"400":
|
||||
description: Invalid device set or channel index
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Device or channel not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
|
||||
/swagger:
|
||||
x-swagger-pipe: swagger_raw
|
||||
|
||||
@ -1470,7 +1507,7 @@ definitions:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
|
||||
DeviceSettings:
|
||||
description: Base device settings
|
||||
description: Base device settings. The specific device settings present depends on deviceHwType.
|
||||
discriminator: deviceHwType
|
||||
required:
|
||||
- deviceHwType
|
||||
@ -1496,7 +1533,7 @@ definitions:
|
||||
$ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
|
||||
|
||||
ChannelSettings:
|
||||
description: Base channel settings
|
||||
description: Base channel settings. The specific channel settings present depends on channelType.
|
||||
discriminator: channelType
|
||||
required:
|
||||
- channelType
|
||||
@ -1513,6 +1550,24 @@ definitions:
|
||||
NFMModSettings:
|
||||
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModSettings"
|
||||
|
||||
ChannelReport:
|
||||
description: Base channel report. The specific channel report present depends on channelType.
|
||||
discriminator: channelType
|
||||
required:
|
||||
- channelType
|
||||
- tx
|
||||
properties:
|
||||
channelType:
|
||||
description: Channel type code
|
||||
type: string
|
||||
tx:
|
||||
description: Not zero if it is a tx channel else it is a rx channel
|
||||
type: integer
|
||||
NFMDemodReport:
|
||||
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodReport"
|
||||
NFMModReport:
|
||||
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModReport"
|
||||
|
||||
responses:
|
||||
|
||||
Response_500:
|
||||
|
@ -39,3 +39,4 @@ std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset
|
||||
std::regex WebAPIAdapterInterface::devicesetChannelURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel$");
|
||||
std::regex WebAPIAdapterInterface::devicesetChannelIndexURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})$");
|
||||
std::regex WebAPIAdapterInterface::devicesetChannelSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/settings$");
|
||||
std::regex WebAPIAdapterInterface::devicesetChannelReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/report");
|
||||
|
@ -47,6 +47,7 @@ namespace SWGSDRangel
|
||||
class SWGDeviceSettings;
|
||||
class SWGDeviceState;
|
||||
class SWGChannelSettings;
|
||||
class SWGChannelReport;
|
||||
class SWGSuccessResponse;
|
||||
}
|
||||
|
||||
@ -515,6 +516,22 @@ public:
|
||||
return 501;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int devicesetChannelReportGet(
|
||||
int deviceSetIndex __attribute__((unused)),
|
||||
int channelIndex __attribute__((unused)),
|
||||
SWGSDRangel::SWGChannelReport& response __attribute__((unused)),
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
static QString instanceSummaryURL;
|
||||
static QString instanceDevicesURL;
|
||||
static QString instanceChannelsURL;
|
||||
@ -535,6 +552,7 @@ public:
|
||||
static std::regex devicesetChannelURLRe;
|
||||
static std::regex devicesetChannelIndexURLRe;
|
||||
static std::regex devicesetChannelSettingsURLRe;
|
||||
static std::regex devicesetChannelReportURLRe;
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGSuccessResponse.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
@ -118,6 +119,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
||||
devicesetChannelIndexService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
|
||||
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelSettingsURLRe)) {
|
||||
devicesetChannelSettingsService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
|
||||
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelReportURLRe)) {
|
||||
devicesetChannelReportService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
|
||||
}
|
||||
else // serve static documentation pages
|
||||
{
|
||||
@ -1270,6 +1273,43 @@ void WebAPIRequestMapper::devicesetChannelSettingsService(
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::devicesetChannelReportService(
|
||||
const std::string& deviceSetIndexStr,
|
||||
const std::string& channelIndexStr,
|
||||
qtwebapp::HttpRequest& request,
|
||||
qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
|
||||
try
|
||||
{
|
||||
int deviceSetIndex = boost::lexical_cast<int>(deviceSetIndexStr);
|
||||
int channelIndex = boost::lexical_cast<int>(channelIndexStr);
|
||||
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
SWGSDRangel::SWGChannelReport normalResponse;
|
||||
resetChannelReport(normalResponse);
|
||||
int status = m_adapter->devicesetChannelReportGet(deviceSetIndex, channelIndex, 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 index";
|
||||
response.setStatus(400,"Invalid data");
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
bool WebAPIRequestMapper::parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
@ -1569,6 +1609,59 @@ bool WebAPIRequestMapper::validateChannelSettings(
|
||||
}
|
||||
}
|
||||
|
||||
bool WebAPIRequestMapper::validateChannelReport(
|
||||
SWGSDRangel::SWGChannelReport& channelReport,
|
||||
QJsonObject& jsonObject,
|
||||
QStringList& channelReportKeys)
|
||||
{
|
||||
if (jsonObject.contains("tx")) {
|
||||
channelReport.setTx(jsonObject["tx"].toInt());
|
||||
} else {
|
||||
channelReport.setTx(0); // assume Rx
|
||||
}
|
||||
|
||||
if (jsonObject.contains("channelType") && jsonObject["channelType"].isString()) {
|
||||
channelReport.setChannelType(new QString(jsonObject["channelType"].toString()));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
QString *channelType = channelReport.getChannelType();
|
||||
|
||||
if (*channelType == "NFMDemod")
|
||||
{
|
||||
if (channelReport.getTx() == 0)
|
||||
{
|
||||
QJsonObject nfmDemodReportJsonObject = jsonObject["NFMDemodReport"].toObject();
|
||||
channelReportKeys = nfmDemodReportJsonObject.keys();
|
||||
channelReport.setNfmDemodReport(new SWGSDRangel::SWGNFMDemodReport());
|
||||
channelReport.getNfmDemodReport()->fromJsonObject(nfmDemodReportJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "NFMMod")
|
||||
{
|
||||
if (channelReport.getTx() != 0)
|
||||
{
|
||||
QJsonObject nfmModReportJsonObject = jsonObject["NFMModReport"].toObject();
|
||||
channelReportKeys = nfmModReportJsonObject.keys();
|
||||
channelReport.setNfmModReport(new SWGSDRangel::SWGNFMModReport());
|
||||
channelReport.getNfmModReport()->fromJsonObject(nfmModReportJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::appendSettingsSubKeys(
|
||||
const QJsonObject& parentSettingsJsonObject,
|
||||
QJsonObject& childSettingsJsonObject,
|
||||
@ -1603,3 +1696,10 @@ void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings&
|
||||
channelSettings.setNfmModSettings(0);
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::resetChannelReport(SWGSDRangel::SWGChannelReport& channelReport)
|
||||
{
|
||||
channelReport.cleanup();
|
||||
channelReport.setChannelType(0);
|
||||
channelReport.setNfmDemodReport(0);
|
||||
channelReport.setNfmModReport(0);
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
void devicesetChannelService(const std::string& deviceSetIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void devicesetChannelIndexService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void devicesetChannelSettingsService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void devicesetChannelReportService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
|
||||
bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer);
|
||||
bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier);
|
||||
@ -75,6 +76,7 @@ private:
|
||||
bool validateDeviceListItem(SWGSDRangel::SWGDeviceListItem& deviceListItem, QJsonObject& jsonObject);
|
||||
bool validateDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings, QJsonObject& jsonObject, QStringList& deviceSettingsKeys);
|
||||
bool validateChannelSettings(SWGSDRangel::SWGChannelSettings& deviceSettings, QJsonObject& jsonObject, QStringList& channelSettingsKeys);
|
||||
bool validateChannelReport(SWGSDRangel::SWGChannelReport& deviceReport, QJsonObject& jsonObject, QStringList& channelReportKeys);
|
||||
|
||||
void appendSettingsSubKeys(
|
||||
const QJsonObject& parentSettingsJsonObject,
|
||||
@ -86,6 +88,7 @@ private:
|
||||
|
||||
void resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings);
|
||||
void resetChannelSettings(SWGSDRangel::SWGChannelSettings& deviceSettings);
|
||||
void resetChannelReport(SWGSDRangel::SWGChannelReport& deviceSettings);
|
||||
};
|
||||
|
||||
#endif /* SDRBASE_WEBAPI_WEBAPIREQUESTMAPPER_H_ */
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGSuccessResponse.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
#include "SWGDeviceState.h"
|
||||
@ -1199,6 +1200,66 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int WebAPIAdapterGUI::devicesetChannelReportGet(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
SWGSDRangel::SWGChannelReport& 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
|
||||
{
|
||||
ChannelSinkAPI *channelAPI = deviceSet->m_deviceSourceAPI->getChanelAPIAt(channelIndex);
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setChannelType(new QString());
|
||||
channelAPI->getIdentifier(*response.getChannelType());
|
||||
response.setTx(0);
|
||||
return channelAPI->webapiReportGet(response, *error.getMessage());
|
||||
}
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkEngine) // Tx
|
||||
{
|
||||
ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(channelIndex);
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setChannelType(new QString());
|
||||
channelAPI->getIdentifier(*response.getChannelType());
|
||||
response.setTx(1);
|
||||
return channelAPI->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::devicesetChannelSettingsPutPatch(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
|
@ -185,6 +185,12 @@ public:
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int devicesetChannelReportGet(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
private:
|
||||
MainWindow& m_mainWindow;
|
||||
|
||||
|
@ -42,4 +42,18 @@ NFMDemodSettings:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
|
||||
|
||||
NFMDemodReport:
|
||||
description: NFMDemod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power received in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
ctcssTone:
|
||||
description: CTCSS tone frequency if detected else 0
|
||||
type: number
|
||||
format: float
|
||||
squelch:
|
||||
description: squelch status (1 if open else 0)
|
||||
type: integer
|
||||
|
@ -37,4 +37,12 @@ NFMModSettings:
|
||||
type: integer
|
||||
cwKeyer:
|
||||
$ref: "http://localhost:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings"
|
||||
|
||||
NFMModReport:
|
||||
description: NFMMod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power transmitted in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
|
@ -997,6 +997,43 @@ paths:
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/report:
|
||||
x-swagger-router-controller: deviceset
|
||||
get:
|
||||
description: get a channel report
|
||||
operationId: devicesetChannelReportGet
|
||||
tags:
|
||||
- DeviceSet
|
||||
parameters:
|
||||
- in: path
|
||||
name: deviceSetIndex
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of device set in the device set list
|
||||
- in: path
|
||||
name: channelIndex
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of the channel in the channels list for this device set
|
||||
responses:
|
||||
"200":
|
||||
description: On success return channel report
|
||||
schema:
|
||||
$ref: "#/definitions/ChannelReport"
|
||||
"400":
|
||||
description: Invalid device set or channel index
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"404":
|
||||
description: Device or channel not found
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
|
||||
/swagger:
|
||||
x-swagger-pipe: swagger_raw
|
||||
|
||||
@ -1470,7 +1507,7 @@ definitions:
|
||||
$ref: "#/definitions/PresetIdentifier"
|
||||
|
||||
DeviceSettings:
|
||||
description: Base device settings
|
||||
description: Base device settings. The specific device settings present depends on deviceHwType.
|
||||
discriminator: deviceHwType
|
||||
required:
|
||||
- deviceHwType
|
||||
@ -1496,7 +1533,7 @@ definitions:
|
||||
$ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrSettings"
|
||||
|
||||
ChannelSettings:
|
||||
description: Base channel settings
|
||||
description: Base channel settings. The specific channel settings present depends on channelType.
|
||||
discriminator: channelType
|
||||
required:
|
||||
- channelType
|
||||
@ -1513,6 +1550,24 @@ definitions:
|
||||
NFMModSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModSettings"
|
||||
|
||||
ChannelReport:
|
||||
description: Base channel report. The specific channel report present depends on channelType.
|
||||
discriminator: channelType
|
||||
required:
|
||||
- channelType
|
||||
- tx
|
||||
properties:
|
||||
channelType:
|
||||
description: Channel type code
|
||||
type: string
|
||||
tx:
|
||||
description: Not zero if it is a tx channel else it is a rx channel
|
||||
type: integer
|
||||
NFMDemodReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodReport"
|
||||
NFMModReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModReport"
|
||||
|
||||
responses:
|
||||
|
||||
Response_500:
|
||||
|
@ -840,6 +840,27 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Summarized information about channel plugin"
|
||||
};
|
||||
defs.ChannelReport = {
|
||||
"required" : [ "channelType", "tx" ],
|
||||
"discriminator" : "channelType",
|
||||
"properties" : {
|
||||
"channelType" : {
|
||||
"type" : "string",
|
||||
"description" : "Channel type code"
|
||||
},
|
||||
"tx" : {
|
||||
"type" : "integer",
|
||||
"description" : "Not zero if it is a tx channel else it is a rx channel"
|
||||
},
|
||||
"NFMDemodReport" : {
|
||||
"$ref" : "#/definitions/NFMDemodReport"
|
||||
},
|
||||
"NFMModReport" : {
|
||||
"$ref" : "#/definitions/NFMModReport"
|
||||
}
|
||||
},
|
||||
"description" : "Base channel report. The specific channel report present depends on channelType."
|
||||
};
|
||||
defs.ChannelSettings = {
|
||||
"required" : [ "channelType", "tx" ],
|
||||
@ -860,7 +881,7 @@ margin-bottom: 20px;
|
||||
"$ref" : "#/definitions/NFMModSettings"
|
||||
}
|
||||
},
|
||||
"description" : "Base channel settings"
|
||||
"description" : "Base channel settings. The specific channel settings present depends on channelType."
|
||||
};
|
||||
defs.DVSeralDevices = {
|
||||
"required" : [ "nbDevices" ],
|
||||
@ -1000,7 +1021,7 @@ margin-bottom: 20px;
|
||||
"$ref" : "#/definitions/RtlSdrSettings"
|
||||
}
|
||||
},
|
||||
"description" : "Base device settings"
|
||||
"description" : "Base device settings. The specific device settings present depends on deviceHwType."
|
||||
};
|
||||
defs.DeviceState = {
|
||||
"required" : [ "state" ],
|
||||
@ -1325,6 +1346,25 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Logging parameters setting"
|
||||
};
|
||||
defs.NFMDemodReport = {
|
||||
"properties" : {
|
||||
"channelPowerDB" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "power received in channel (dB)"
|
||||
},
|
||||
"ctcssTone" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "CTCSS tone frequency if detected else 0"
|
||||
},
|
||||
"squelch" : {
|
||||
"type" : "integer",
|
||||
"description" : "squelch status (1 if open else 0)"
|
||||
}
|
||||
},
|
||||
"description" : "NFMDemod"
|
||||
};
|
||||
defs.NFMDemodSettings = {
|
||||
"properties" : {
|
||||
@ -1389,6 +1429,16 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "NFMDemod"
|
||||
};
|
||||
defs.NFMModReport = {
|
||||
"properties" : {
|
||||
"channelPowerDB" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "power transmitted in channel (dB)"
|
||||
}
|
||||
},
|
||||
"description" : "NFMMod"
|
||||
};
|
||||
defs.NFMModSettings = {
|
||||
"properties" : {
|
||||
@ -1694,6 +1744,9 @@ margin-bottom: 20px;
|
||||
<li data-group="DeviceSet" data-name="devicesetChannelPost" class="">
|
||||
<a href="#api-DeviceSet-devicesetChannelPost">devicesetChannelPost</a>
|
||||
</li>
|
||||
<li data-group="DeviceSet" data-name="devicesetChannelReportGet" class="">
|
||||
<a href="#api-DeviceSet-devicesetChannelReportGet">devicesetChannelReportGet</a>
|
||||
</li>
|
||||
<li data-group="DeviceSet" data-name="devicesetChannelSettingsGet" class="">
|
||||
<a href="#api-DeviceSet-devicesetChannelSettingsGet">devicesetChannelSettingsGet</a>
|
||||
</li>
|
||||
@ -2838,6 +2891,500 @@ $(document).ready(function() {
|
||||
</article>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="api-DeviceSet-devicesetChannelReportGet">
|
||||
<article id="api-DeviceSet-devicesetChannelReportGet-0" data-group="User" data-name="devicesetChannelReportGet" data-version="0">
|
||||
<div class="pull-left">
|
||||
<h1>devicesetChannelReportGet</h1>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="pull-right"></div>
|
||||
<div class="clearfix"></div>
|
||||
<p></p>
|
||||
<p class="marked">get a channel report</p>
|
||||
<p></p>
|
||||
<br />
|
||||
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/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-devicesetChannelReportGet-0-curl">Curl</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-java">Java</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-android">Android</a></li>
|
||||
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-groovy">Groovy</a></li>-->
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-objc">Obj-C</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-javascript">JavaScript</a></li>
|
||||
<!--<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-angular">Angular</a></li>-->
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-csharp">C#</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-php">PHP</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-perl">Perl</a></li>
|
||||
<li class=""><a href="#examples-DeviceSet-devicesetChannelReportGet-0-python">Python</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelReportGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/report"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
try {
|
||||
ChannelReport result = apiInstance.devicesetChannelReportGet(deviceSetIndex, channelIndex);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetChannelReportGet");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
try {
|
||||
ChannelReport result = apiInstance.devicesetChannelReportGet(deviceSetIndex, channelIndex);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetChannelReportGet");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
<!--
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-groovy">
|
||||
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
|
||||
</div> -->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-objc">
|
||||
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
|
||||
Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
|
||||
|
||||
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
|
||||
|
||||
[apiInstance devicesetChannelReportGetWith:deviceSetIndex
|
||||
channelIndex:channelIndex
|
||||
completionHandler: ^(ChannelReport output, NSError* error) {
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
}];
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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 channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.devicesetChannelReportGet(deviceSetIndex, channelIndex, callback);
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<!--<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-angular">
|
||||
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
|
||||
</div>-->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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 devicesetChannelReportGetExample
|
||||
{
|
||||
public void main()
|
||||
{
|
||||
|
||||
var apiInstance = new DeviceSetApi();
|
||||
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
var channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
try
|
||||
{
|
||||
ChannelReport result = apiInstance.devicesetChannelReportGet(deviceSetIndex, channelIndex);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print("Exception when calling DeviceSetApi.devicesetChannelReportGet: " + e.Message );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-0-php">
|
||||
<pre class="prettyprint"><code class="language-php"><?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
|
||||
$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
try {
|
||||
$result = $api_instance->devicesetChannelReportGet($deviceSetIndex, $channelIndex);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling DeviceSetApi->devicesetChannelReportGet: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?></code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
eval {
|
||||
my $result = $api_instance->devicesetChannelReportGet(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
|
||||
print Dumper($result);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling DeviceSetApi->devicesetChannelReportGet: $@\n";
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelReportGet-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
|
||||
channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
|
||||
|
||||
try:
|
||||
api_response = api_instance.deviceset_channel_report_get(deviceSetIndex, channelIndex)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling DeviceSetApi->devicesetChannelReportGet: %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_devicesetChannelReportGet_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>
|
||||
|
||||
<tr><td style="width:150px;">channelIndex*</td>
|
||||
<td>
|
||||
|
||||
|
||||
<div id="d2e199_devicesetChannelReportGet_channelIndex">
|
||||
<div class="json-schema-view">
|
||||
<div class="primitive">
|
||||
<span class="type">
|
||||
Integer
|
||||
</span>
|
||||
|
||||
<div class="inner description">
|
||||
Index of the channel in the channels list for this device set
|
||||
</div>
|
||||
</div>
|
||||
<div class="inner required">
|
||||
Required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Responses</h2>
|
||||
<h3> Status: 200 - On success return channel report </h3>
|
||||
|
||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#responses-devicesetChannelReportGet-200-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-200-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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 channel report",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/ChannelReport"
|
||||
}
|
||||
};
|
||||
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-devicesetChannelReportGet-200-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-200-schema-200');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-200-schema-data' type='hidden' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3> Status: 400 - Invalid device set or channel index </h3>
|
||||
|
||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#responses-devicesetChannelReportGet-400-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-400-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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 or channel index",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/ErrorResponse"
|
||||
}
|
||||
};
|
||||
var schema = schemaWrapper.schema;
|
||||
if (schema.$ref != null) {
|
||||
schema = defsParser.$refs.get(schema.$ref);
|
||||
} else {
|
||||
schemaWrapper.definitions = Object.assign({}, defs);
|
||||
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
//console.log(JSON.stringify(schema));
|
||||
var view = new JSONSchemaView(schema, 3);
|
||||
$('#responses-devicesetChannelReportGet-400-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-400-schema-400');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-400-schema-data' type='hidden' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3> Status: 404 - Device or channel not found </h3>
|
||||
|
||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#responses-devicesetChannelReportGet-404-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-404-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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 or channel 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-devicesetChannelReportGet-404-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-404-schema-404');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-500-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-500-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-500-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-500-schema-500');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-501-schema">Schema</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||
<div class="tab-pane active" id="responses-devicesetChannelReportGet-501-schema">
|
||||
<div id='responses-devicesetChannelReportGet-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-devicesetChannelReportGet-501-schema-data').val(stringify(schema));
|
||||
var result = $('#responses-devicesetChannelReportGet-501-schema-501');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<input id='responses-devicesetChannelReportGet-501-schema-data' type='hidden' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="api-DeviceSet-devicesetChannelSettingsGet">
|
||||
<article id="api-DeviceSet-devicesetChannelSettingsGet-0" data-group="User" data-name="devicesetChannelSettingsGet" data-version="0">
|
||||
<div class="pull-left">
|
||||
@ -16925,7 +17472,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-03-03T23:35:13.013+01:00
|
||||
Generated 2018-03-18T11:03:22.829+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
175
swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp
Normal file
175
swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp
Normal file
@ -0,0 +1,175 @@
|
||||
/**
|
||||
* 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 "SWGChannelReport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGChannelReport::SWGChannelReport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGChannelReport::SWGChannelReport() {
|
||||
channel_type = nullptr;
|
||||
m_channel_type_isSet = false;
|
||||
tx = 0;
|
||||
m_tx_isSet = false;
|
||||
nfm_demod_report = nullptr;
|
||||
m_nfm_demod_report_isSet = false;
|
||||
nfm_mod_report = nullptr;
|
||||
m_nfm_mod_report_isSet = false;
|
||||
}
|
||||
|
||||
SWGChannelReport::~SWGChannelReport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGChannelReport::init() {
|
||||
channel_type = new QString("");
|
||||
m_channel_type_isSet = false;
|
||||
tx = 0;
|
||||
m_tx_isSet = false;
|
||||
nfm_demod_report = new SWGNFMDemodReport();
|
||||
m_nfm_demod_report_isSet = false;
|
||||
nfm_mod_report = new SWGNFMModReport();
|
||||
m_nfm_mod_report_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGChannelReport::cleanup() {
|
||||
if(channel_type != nullptr) {
|
||||
delete channel_type;
|
||||
}
|
||||
|
||||
if(nfm_demod_report != nullptr) {
|
||||
delete nfm_demod_report;
|
||||
}
|
||||
if(nfm_mod_report != nullptr) {
|
||||
delete nfm_mod_report;
|
||||
}
|
||||
}
|
||||
|
||||
SWGChannelReport*
|
||||
SWGChannelReport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGChannelReport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_demod_report, pJson["NFMDemodReport"], "SWGNFMDemodReport", "SWGNFMDemodReport");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_mod_report, pJson["NFMModReport"], "SWGNFMModReport", "SWGNFMModReport");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGChannelReport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGChannelReport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(channel_type != nullptr && *channel_type != QString("")){
|
||||
toJsonValue(QString("channelType"), channel_type, obj, QString("QString"));
|
||||
}
|
||||
if(m_tx_isSet){
|
||||
obj->insert("tx", QJsonValue(tx));
|
||||
}
|
||||
if((nfm_demod_report != nullptr) && (nfm_demod_report->isSet())){
|
||||
toJsonValue(QString("NFMDemodReport"), nfm_demod_report, obj, QString("SWGNFMDemodReport"));
|
||||
}
|
||||
if((nfm_mod_report != nullptr) && (nfm_mod_report->isSet())){
|
||||
toJsonValue(QString("NFMModReport"), nfm_mod_report, obj, QString("SWGNFMModReport"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGChannelReport::getChannelType() {
|
||||
return channel_type;
|
||||
}
|
||||
void
|
||||
SWGChannelReport::setChannelType(QString* channel_type) {
|
||||
this->channel_type = channel_type;
|
||||
this->m_channel_type_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGChannelReport::getTx() {
|
||||
return tx;
|
||||
}
|
||||
void
|
||||
SWGChannelReport::setTx(qint32 tx) {
|
||||
this->tx = tx;
|
||||
this->m_tx_isSet = true;
|
||||
}
|
||||
|
||||
SWGNFMDemodReport*
|
||||
SWGChannelReport::getNfmDemodReport() {
|
||||
return nfm_demod_report;
|
||||
}
|
||||
void
|
||||
SWGChannelReport::setNfmDemodReport(SWGNFMDemodReport* nfm_demod_report) {
|
||||
this->nfm_demod_report = nfm_demod_report;
|
||||
this->m_nfm_demod_report_isSet = true;
|
||||
}
|
||||
|
||||
SWGNFMModReport*
|
||||
SWGChannelReport::getNfmModReport() {
|
||||
return nfm_mod_report;
|
||||
}
|
||||
void
|
||||
SWGChannelReport::setNfmModReport(SWGNFMModReport* nfm_mod_report) {
|
||||
this->nfm_mod_report = nfm_mod_report;
|
||||
this->m_nfm_mod_report_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGChannelReport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(channel_type != nullptr && *channel_type != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_tx_isSet){ isObjectUpdated = true; break;}
|
||||
if(nfm_demod_report != nullptr && nfm_demod_report->isSet()){ isObjectUpdated = true; break;}
|
||||
if(nfm_mod_report != nullptr && nfm_mod_report->isSet()){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
78
swagger/sdrangel/code/qt5/client/SWGChannelReport.h
Normal file
78
swagger/sdrangel/code/qt5/client/SWGChannelReport.h
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGChannelReport.h
|
||||
*
|
||||
* Base channel report. The specific channel report present depends on channelType.
|
||||
*/
|
||||
|
||||
#ifndef SWGChannelReport_H_
|
||||
#define SWGChannelReport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGNFMDemodReport.h"
|
||||
#include "SWGNFMModReport.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWGChannelReport: public SWGObject {
|
||||
public:
|
||||
SWGChannelReport();
|
||||
SWGChannelReport(QString* json);
|
||||
virtual ~SWGChannelReport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGChannelReport* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getChannelType();
|
||||
void setChannelType(QString* channel_type);
|
||||
|
||||
qint32 getTx();
|
||||
void setTx(qint32 tx);
|
||||
|
||||
SWGNFMDemodReport* getNfmDemodReport();
|
||||
void setNfmDemodReport(SWGNFMDemodReport* nfm_demod_report);
|
||||
|
||||
SWGNFMModReport* getNfmModReport();
|
||||
void setNfmModReport(SWGNFMModReport* nfm_mod_report);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* channel_type;
|
||||
bool m_channel_type_isSet;
|
||||
|
||||
qint32 tx;
|
||||
bool m_tx_isSet;
|
||||
|
||||
SWGNFMDemodReport* nfm_demod_report;
|
||||
bool m_nfm_demod_report_isSet;
|
||||
|
||||
SWGNFMModReport* nfm_mod_report;
|
||||
bool m_nfm_mod_report_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGChannelReport_H_ */
|
@ -13,7 +13,7 @@
|
||||
/*
|
||||
* SWGChannelSettings.h
|
||||
*
|
||||
* Base channel settings
|
||||
* Base channel settings. The specific channel settings present depends on channelType.
|
||||
*/
|
||||
|
||||
#ifndef SWGChannelSettings_H_
|
||||
|
@ -141,6 +141,62 @@ SWGDeviceSetApi::devicesetChannelPostCallback(SWGHttpRequestWorker * worker) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSetApi::devicesetChannelReportGet(qint32 device_set_index, qint32 channel_index) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/report");
|
||||
|
||||
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
||||
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
||||
QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}");
|
||||
fullPath.replace(channel_indexPathParam, stringValue(channel_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::devicesetChannelReportGetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSetApi::devicesetChannelReportGetCallback(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);
|
||||
SWGChannelReport* output = static_cast<SWGChannelReport*>(create(json, QString("SWGChannelReport")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit devicesetChannelReportGetSignal(output);
|
||||
} else {
|
||||
emit devicesetChannelReportGetSignalE(output, error_type, error_str);
|
||||
emit devicesetChannelReportGetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index) {
|
||||
QString fullPath;
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "SWGHttpRequest.h"
|
||||
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGDeviceListItem.h"
|
||||
#include "SWGDeviceSet.h"
|
||||
@ -41,6 +42,7 @@ public:
|
||||
|
||||
void devicesetChannelDelete(qint32 device_set_index, qint32 channel_index);
|
||||
void devicesetChannelPost(qint32 device_set_index, SWGChannelSettings& body);
|
||||
void devicesetChannelReportGet(qint32 device_set_index, qint32 channel_index);
|
||||
void devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index);
|
||||
void devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body);
|
||||
void devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body);
|
||||
@ -59,6 +61,7 @@ public:
|
||||
private:
|
||||
void devicesetChannelDeleteCallback (SWGHttpRequestWorker * worker);
|
||||
void devicesetChannelPostCallback (SWGHttpRequestWorker * worker);
|
||||
void devicesetChannelReportGetCallback (SWGHttpRequestWorker * worker);
|
||||
void devicesetChannelSettingsGetCallback (SWGHttpRequestWorker * worker);
|
||||
void devicesetChannelSettingsPatchCallback (SWGHttpRequestWorker * worker);
|
||||
void devicesetChannelSettingsPutCallback (SWGHttpRequestWorker * worker);
|
||||
@ -77,6 +80,7 @@ private:
|
||||
signals:
|
||||
void devicesetChannelDeleteSignal(SWGChannelSettings* summary);
|
||||
void devicesetChannelPostSignal(SWGSuccessResponse* summary);
|
||||
void devicesetChannelReportGetSignal(SWGChannelReport* summary);
|
||||
void devicesetChannelSettingsGetSignal(SWGChannelSettings* summary);
|
||||
void devicesetChannelSettingsPatchSignal(SWGChannelSettings* summary);
|
||||
void devicesetChannelSettingsPutSignal(SWGChannelSettings* summary);
|
||||
@ -94,6 +98,7 @@ signals:
|
||||
|
||||
void devicesetChannelDeleteSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelReportGetSignalE(SWGChannelReport* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelSettingsGetSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelSettingsPatchSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelSettingsPutSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
@ -111,6 +116,7 @@ signals:
|
||||
|
||||
void devicesetChannelDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelReportGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void devicesetChannelSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
@ -13,7 +13,7 @@
|
||||
/*
|
||||
* SWGDeviceSettings.h
|
||||
*
|
||||
* Base device settings
|
||||
* Base device settings. The specific device settings present depends on deviceHwType.
|
||||
*/
|
||||
|
||||
#ifndef SWGDeviceSettings_H_
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "SWGCWKeyerSettings.h"
|
||||
#include "SWGChannel.h"
|
||||
#include "SWGChannelListItem.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGDVSeralDevices.h"
|
||||
#include "SWGDVSerialDevice.h"
|
||||
@ -39,7 +40,9 @@
|
||||
#include "SWGLimeSdrOutputSettings.h"
|
||||
#include "SWGLocationInformation.h"
|
||||
#include "SWGLoggingInfo.h"
|
||||
#include "SWGNFMDemodReport.h"
|
||||
#include "SWGNFMDemodSettings.h"
|
||||
#include "SWGNFMModReport.h"
|
||||
#include "SWGNFMModSettings.h"
|
||||
#include "SWGPresetExport.h"
|
||||
#include "SWGPresetGroup.h"
|
||||
@ -73,6 +76,9 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGChannelListItem").compare(type) == 0) {
|
||||
return new SWGChannelListItem();
|
||||
}
|
||||
if(QString("SWGChannelReport").compare(type) == 0) {
|
||||
return new SWGChannelReport();
|
||||
}
|
||||
if(QString("SWGChannelSettings").compare(type) == 0) {
|
||||
return new SWGChannelSettings();
|
||||
}
|
||||
@ -130,9 +136,15 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGLoggingInfo").compare(type) == 0) {
|
||||
return new SWGLoggingInfo();
|
||||
}
|
||||
if(QString("SWGNFMDemodReport").compare(type) == 0) {
|
||||
return new SWGNFMDemodReport();
|
||||
}
|
||||
if(QString("SWGNFMDemodSettings").compare(type) == 0) {
|
||||
return new SWGNFMDemodSettings();
|
||||
}
|
||||
if(QString("SWGNFMModReport").compare(type) == 0) {
|
||||
return new SWGNFMModReport();
|
||||
}
|
||||
if(QString("SWGNFMModSettings").compare(type) == 0) {
|
||||
return new SWGNFMModSettings();
|
||||
}
|
||||
|
148
swagger/sdrangel/code/qt5/client/SWGNFMDemodReport.cpp
Normal file
148
swagger/sdrangel/code/qt5/client/SWGNFMDemodReport.cpp
Normal file
@ -0,0 +1,148 @@
|
||||
/**
|
||||
* 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 "SWGNFMDemodReport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGNFMDemodReport::SWGNFMDemodReport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGNFMDemodReport::SWGNFMDemodReport() {
|
||||
channel_power_db = 0.0f;
|
||||
m_channel_power_db_isSet = false;
|
||||
ctcss_tone = 0.0f;
|
||||
m_ctcss_tone_isSet = false;
|
||||
squelch = 0;
|
||||
m_squelch_isSet = false;
|
||||
}
|
||||
|
||||
SWGNFMDemodReport::~SWGNFMDemodReport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGNFMDemodReport::init() {
|
||||
channel_power_db = 0.0f;
|
||||
m_channel_power_db_isSet = false;
|
||||
ctcss_tone = 0.0f;
|
||||
m_ctcss_tone_isSet = false;
|
||||
squelch = 0;
|
||||
m_squelch_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGNFMDemodReport::cleanup() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGNFMDemodReport*
|
||||
SWGNFMDemodReport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGNFMDemodReport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&ctcss_tone, pJson["ctcssTone"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&squelch, pJson["squelch"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGNFMDemodReport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGNFMDemodReport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_channel_power_db_isSet){
|
||||
obj->insert("channelPowerDB", QJsonValue(channel_power_db));
|
||||
}
|
||||
if(m_ctcss_tone_isSet){
|
||||
obj->insert("ctcssTone", QJsonValue(ctcss_tone));
|
||||
}
|
||||
if(m_squelch_isSet){
|
||||
obj->insert("squelch", QJsonValue(squelch));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
float
|
||||
SWGNFMDemodReport::getChannelPowerDb() {
|
||||
return channel_power_db;
|
||||
}
|
||||
void
|
||||
SWGNFMDemodReport::setChannelPowerDb(float channel_power_db) {
|
||||
this->channel_power_db = channel_power_db;
|
||||
this->m_channel_power_db_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGNFMDemodReport::getCtcssTone() {
|
||||
return ctcss_tone;
|
||||
}
|
||||
void
|
||||
SWGNFMDemodReport::setCtcssTone(float ctcss_tone) {
|
||||
this->ctcss_tone = ctcss_tone;
|
||||
this->m_ctcss_tone_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGNFMDemodReport::getSquelch() {
|
||||
return squelch;
|
||||
}
|
||||
void
|
||||
SWGNFMDemodReport::setSquelch(qint32 squelch) {
|
||||
this->squelch = squelch;
|
||||
this->m_squelch_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGNFMDemodReport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_ctcss_tone_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_squelch_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
69
swagger/sdrangel/code/qt5/client/SWGNFMDemodReport.h
Normal file
69
swagger/sdrangel/code/qt5/client/SWGNFMDemodReport.h
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGNFMDemodReport.h
|
||||
*
|
||||
* NFMDemod
|
||||
*/
|
||||
|
||||
#ifndef SWGNFMDemodReport_H_
|
||||
#define SWGNFMDemodReport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
|
||||
#include "SWGObject.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWGNFMDemodReport: public SWGObject {
|
||||
public:
|
||||
SWGNFMDemodReport();
|
||||
SWGNFMDemodReport(QString* json);
|
||||
virtual ~SWGNFMDemodReport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGNFMDemodReport* fromJson(QString &jsonString) override;
|
||||
|
||||
float getChannelPowerDb();
|
||||
void setChannelPowerDb(float channel_power_db);
|
||||
|
||||
float getCtcssTone();
|
||||
void setCtcssTone(float ctcss_tone);
|
||||
|
||||
qint32 getSquelch();
|
||||
void setSquelch(qint32 squelch);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
float channel_power_db;
|
||||
bool m_channel_power_db_isSet;
|
||||
|
||||
float ctcss_tone;
|
||||
bool m_ctcss_tone_isSet;
|
||||
|
||||
qint32 squelch;
|
||||
bool m_squelch_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGNFMDemodReport_H_ */
|
106
swagger/sdrangel/code/qt5/client/SWGNFMModReport.cpp
Normal file
106
swagger/sdrangel/code/qt5/client/SWGNFMModReport.cpp
Normal 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 "SWGNFMModReport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGNFMModReport::SWGNFMModReport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGNFMModReport::SWGNFMModReport() {
|
||||
channel_power_db = 0.0f;
|
||||
m_channel_power_db_isSet = false;
|
||||
}
|
||||
|
||||
SWGNFMModReport::~SWGNFMModReport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGNFMModReport::init() {
|
||||
channel_power_db = 0.0f;
|
||||
m_channel_power_db_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGNFMModReport::cleanup() {
|
||||
|
||||
}
|
||||
|
||||
SWGNFMModReport*
|
||||
SWGNFMModReport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGNFMModReport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGNFMModReport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGNFMModReport::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_channel_power_db_isSet){
|
||||
obj->insert("channelPowerDB", QJsonValue(channel_power_db));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
float
|
||||
SWGNFMModReport::getChannelPowerDb() {
|
||||
return channel_power_db;
|
||||
}
|
||||
void
|
||||
SWGNFMModReport::setChannelPowerDb(float channel_power_db) {
|
||||
this->channel_power_db = channel_power_db;
|
||||
this->m_channel_power_db_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGNFMModReport::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
57
swagger/sdrangel/code/qt5/client/SWGNFMModReport.h
Normal file
57
swagger/sdrangel/code/qt5/client/SWGNFMModReport.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGNFMModReport.h
|
||||
*
|
||||
* NFMMod
|
||||
*/
|
||||
|
||||
#ifndef SWGNFMModReport_H_
|
||||
#define SWGNFMModReport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
|
||||
#include "SWGObject.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWGNFMModReport: public SWGObject {
|
||||
public:
|
||||
SWGNFMModReport();
|
||||
SWGNFMModReport(QString* json);
|
||||
virtual ~SWGNFMModReport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGNFMModReport* fromJson(QString &jsonString) override;
|
||||
|
||||
float getChannelPowerDb();
|
||||
void setChannelPowerDb(float channel_power_db);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
float channel_power_db;
|
||||
bool m_channel_power_db_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGNFMModReport_H_ */
|
Loading…
Reference in New Issue
Block a user