1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

v7: created API to manage workspaces. Implements #1240

This commit is contained in:
f4exb 2022-05-09 21:31:14 +02:00
parent 1bcecec103
commit f545eea5ed
15 changed files with 1764 additions and 2 deletions

View File

@ -38,6 +38,8 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgDeletePreset, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadConfiguration, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgSaveConfiguration, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteConfiguration, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgAddWorkspace, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteEmptyWorkspaces, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadFeatureSetPreset, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgSaveFeatureSetPreset, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteFeatureSetPreset, Message)

View File

@ -230,6 +230,36 @@ public:
{ }
};
class SDRBASE_API MsgAddWorkspace : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgAddWorkspace* create()
{
return new MsgAddWorkspace();
}
private:
MsgAddWorkspace() :
Message()
{ }
};
class SDRBASE_API MsgDeleteEmptyWorkspaces : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgDeleteEmptyWorkspaces* create()
{
return new MsgDeleteEmptyWorkspaces();
}
private:
MsgDeleteEmptyWorkspaces() :
Message()
{ }
};
class SDRBASE_API MsgLoadFeatureSetPreset : public Message {
MESSAGE_CLASS_DECLARATION

View File

@ -14754,6 +14754,13 @@ margin-bottom: 20px;
<li data-group="Instance" data-name="instanceSummary" class="">
<a href="#api-Instance-instanceSummary">instanceSummary</a>
</li>
<li class="nav-header" data-group="Workspace"><a href="#api-Workspace">API Methods - Workspace</a></li>
<li data-group="Workspace" data-name="instanceWorkspaceAdd" class="">
<a href="#api-Workspace-instanceWorkspaceAdd">instanceWorkspaceAdd</a>
</li>
<li data-group="Workspace" data-name="instanceWorkspacesDeleteEmpty" class="">
<a href="#api-Workspace-instanceWorkspacesDeleteEmpty">instanceWorkspacesDeleteEmpty</a>
</li>
</ul>
</nav>
</div>
@ -55812,6 +55819,677 @@ except ApiException as e:
</div>
<hr>
</section>
<section id="api-Workspace">
<h1>Workspace</h1>
<div id="api-Workspace-instanceWorkspaceAdd">
<article id="api-Workspace-instanceWorkspaceAdd-0" data-group="User" data-name="instanceWorkspaceAdd" data-version="0">
<div class="pull-left">
<h1>instanceWorkspaceAdd</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">Add new workspace</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="post"><code><span class="pln">/sdrangel/workspace</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-Workspace-instanceWorkspaceAdd-0-curl">Curl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-java">Java</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-android">Android</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-csharp">C#</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-php">PHP</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-perl">Perl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-Workspace-instanceWorkspaceAdd-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/workspace"</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.WorkspaceApi;
import java.io.File;
import java.util.*;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspaceAdd();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspaceAdd");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.WorkspaceApi;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspaceAdd();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspaceAdd");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-objc">
<pre class="prettyprint"><code class="language-cpp">
WorkspaceApi *apiInstance = [[WorkspaceApi alloc] init];
[apiInstance instanceWorkspaceAddWithCompletionHandler:
^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.WorkspaceApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.instanceWorkspaceAdd(callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-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 instanceWorkspaceAddExample
{
public void main()
{
var apiInstance = new WorkspaceApi();
try
{
SuccessResponse result = apiInstance.instanceWorkspaceAdd();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling WorkspaceApi.instanceWorkspaceAdd: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\WorkspaceApi();
try {
$result = $api_instance->instanceWorkspaceAdd();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling WorkspaceApi->instanceWorkspaceAdd: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::WorkspaceApi;
my $api_instance = SWGSDRangel::WorkspaceApi->new();
eval {
my $result = $api_instance->instanceWorkspaceAdd();
print Dumper($result);
};
if ($@) {
warn "Exception when calling WorkspaceApi->instanceWorkspaceAdd: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-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.WorkspaceApi()
try:
api_response = api_instance.instance_workspace_add()
pprint(api_response)
except ApiException as e:
print("Exception when calling WorkspaceApi->instanceWorkspaceAdd: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<h2>Responses</h2>
<h3> Status: 202 - </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceWorkspaceAdd-202-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspaceAdd-202-schema">
<div id='responses-instanceWorkspaceAdd-202-schema-202' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"schema" : {
"$ref" : "#/definitions/SuccessResponse"
}
};
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-instanceWorkspaceAdd-202-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspaceAdd-202-schema-202');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspaceAdd-202-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-instanceWorkspaceAdd-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspaceAdd-500-schema">
<div id='responses-instanceWorkspaceAdd-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-instanceWorkspaceAdd-500-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspaceAdd-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspaceAdd-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-instanceWorkspaceAdd-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspaceAdd-501-schema">
<div id='responses-instanceWorkspaceAdd-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-instanceWorkspaceAdd-501-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspaceAdd-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspaceAdd-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-Workspace-instanceWorkspacesDeleteEmpty">
<article id="api-Workspace-instanceWorkspacesDeleteEmpty-0" data-group="User" data-name="instanceWorkspacesDeleteEmpty" data-version="0">
<div class="pull-left">
<h1>instanceWorkspacesDeleteEmpty</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">Delete empty workspaces</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="delete"><code><span class="pln">/sdrangel/workspace</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-Workspace-instanceWorkspacesDeleteEmpty-0-curl">Curl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-java">Java</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-android">Android</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-csharp">C#</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-php">PHP</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-perl">Perl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel/workspace"</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.WorkspaceApi;
import java.io.File;
import java.util.*;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspacesDeleteEmpty();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspacesDeleteEmpty");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.WorkspaceApi;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspacesDeleteEmpty();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspacesDeleteEmpty");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-objc">
<pre class="prettyprint"><code class="language-cpp">
WorkspaceApi *apiInstance = [[WorkspaceApi alloc] init];
[apiInstance instanceWorkspacesDeleteEmptyWithCompletionHandler:
^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.WorkspaceApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.instanceWorkspacesDeleteEmpty(callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-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 instanceWorkspacesDeleteEmptyExample
{
public void main()
{
var apiInstance = new WorkspaceApi();
try
{
SuccessResponse result = apiInstance.instanceWorkspacesDeleteEmpty();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling WorkspaceApi.instanceWorkspacesDeleteEmpty: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\WorkspaceApi();
try {
$result = $api_instance->instanceWorkspacesDeleteEmpty();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling WorkspaceApi->instanceWorkspacesDeleteEmpty: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::WorkspaceApi;
my $api_instance = SWGSDRangel::WorkspaceApi->new();
eval {
my $result = $api_instance->instanceWorkspacesDeleteEmpty();
print Dumper($result);
};
if ($@) {
warn "Exception when calling WorkspaceApi->instanceWorkspacesDeleteEmpty: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-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.WorkspaceApi()
try:
api_response = api_instance.instance_workspaces_delete_empty()
pprint(api_response)
except ApiException as e:
print("Exception when calling WorkspaceApi->instanceWorkspacesDeleteEmpty: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<h2>Responses</h2>
<h3> Status: 202 - </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceWorkspacesDeleteEmpty-202-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspacesDeleteEmpty-202-schema">
<div id='responses-instanceWorkspacesDeleteEmpty-202-schema-202' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"schema" : {
"$ref" : "#/definitions/SuccessResponse"
}
};
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-instanceWorkspacesDeleteEmpty-202-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspacesDeleteEmpty-202-schema-202');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspacesDeleteEmpty-202-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-instanceWorkspacesDeleteEmpty-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspacesDeleteEmpty-500-schema">
<div id='responses-instanceWorkspacesDeleteEmpty-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-instanceWorkspacesDeleteEmpty-500-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspacesDeleteEmpty-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspacesDeleteEmpty-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-instanceWorkspacesDeleteEmpty-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspacesDeleteEmpty-501-schema">
<div id='responses-instanceWorkspacesDeleteEmpty-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-instanceWorkspacesDeleteEmpty-501-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspacesDeleteEmpty-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspacesDeleteEmpty-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
</section>
</div>
<div id="footer">
<div id="api-_footer">
@ -55825,7 +56503,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-05-08T19:09:57.985+02:00
Generated 2022-05-09T01:10:06.823+02:00
</div>
</div>
</div>

View File

@ -1282,6 +1282,37 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/workspace:
x-swagger-router-controller: instance
post:
description: Add new workspace
operationId: InstanceWorkspaceAdd
tags:
- Workspace
responses:
"202":
descriptions: Successful sending of the message
schema:
$ref: "#/definitions/SuccessResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
delete:
description: Delete empty workspaces
operationId: InstanceWorkspacesDeleteEmpty
tags:
- Workspace
responses:
"202":
descriptions: Successful sending of the message
schema:
$ref: "#/definitions/SuccessResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset:
x-swagger-router-controller: instance
post:

View File

@ -2077,6 +2077,34 @@ int WebAPIAdapter::instanceDeviceSetDelete(
}
}
int WebAPIAdapter::instanceWorkspacePost(
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) error;
MainCore::MsgAddWorkspace *msg = MainCore::MsgAddWorkspace::create();
m_mainCore->m_mainMessageQueue->push(msg);
response.init();
*response.getMessage() = QString("Message to add a new workspace (MsgAddWorkspace) was submitted successfully");
return 202;
}
int WebAPIAdapter::instanceWorkspaceDelete(
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) error;
MainCore::MsgDeleteEmptyWorkspaces *msg = MainCore::MsgDeleteEmptyWorkspaces::create();
m_mainCore->m_mainMessageQueue->push(msg);
response.init();
*response.getMessage() = QString("Message to delete empty workspaces (MsgDeleteEmptyWorkspaces) was submitted successfully");
return 202;
}
int WebAPIAdapter::devicesetGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceSet& response,

View File

@ -276,6 +276,14 @@ public:
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int instanceWorkspacePost(
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int instanceWorkspaceDelete(
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceSet& response,

View File

@ -49,6 +49,7 @@ QString WebAPIAdapterInterface::instanceFeaturePresetsURL = "/sdrangel/featurepr
QString WebAPIAdapterInterface::instanceFeaturePresetURL = "/sdrangel/featurepreset";
QString WebAPIAdapterInterface::instanceDeviceSetsURL = "/sdrangel/devicesets";
QString WebAPIAdapterInterface::instanceDeviceSetURL = "/sdrangel/deviceset";
QString WebAPIAdapterInterface::instanceWorkspaceURL = "/sdrangel/workspace";
QString WebAPIAdapterInterface::featuresetURL("/sdrangel/featureset");
QString WebAPIAdapterInterface::featuresetFeatureURL("/sdrangel/featureset/feature");
QString WebAPIAdapterInterface::featuresetPresetURL("/sdrangel/featureset/preset");

View File

@ -868,6 +868,34 @@ public:
return 501;
}
/**
* Handler of /sdrangel/workspace (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
*/
virtual int instanceWorkspacePost(
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) response;
error.init();
*error.getMessage() = QString("Function not implemented");
return 501;
}
/**
* Handler of /sdrangel/workspace (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
*/
virtual int instanceWorkspaceDelete(
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) response;
error.init();
*error.getMessage() = QString("Function not implemented");
return 501;
}
/**
* Handler of /sdrangel/deviceset (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
@ -1651,6 +1679,7 @@ public:
static QString instanceFeaturePresetURL;
static QString instanceDeviceSetsURL;
static QString instanceDeviceSetURL;
static QString instanceWorkspaceURL;
static QString featuresetURL;
static QString featuresetFeatureURL;
static QString featuresetPresetURL;

View File

@ -174,6 +174,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
instanceDeviceSetsService(request, response);
} else if (path == WebAPIAdapterInterface::instanceDeviceSetURL) {
instanceDeviceSetService(request, response);
} else if (path == WebAPIAdapterInterface::instanceWorkspaceURL) {
instanceWorkspaceService(request, response);
} else if (path == WebAPIAdapterInterface::featuresetURL) {
featuresetService(request, response);
} else if (path == WebAPIAdapterInterface::featuresetFeatureURL) {
@ -1991,6 +1993,45 @@ void WebAPIRequestMapper::instanceDeviceSetService(qtwebapp::HttpRequest& reques
}
}
void WebAPIRequestMapper::instanceWorkspaceService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
response.setHeader("Access-Control-Allow-Origin", "*");
if (request.getMethod() == "POST")
{
SWGSDRangel::SWGSuccessResponse normalResponse;
int status = m_adapter->instanceWorkspacePost(normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else if (request.getMethod() == "DELETE")
{
SWGSDRangel::SWGSuccessResponse normalResponse;
int status = m_adapter->instanceWorkspaceDelete(normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(405,"Invalid HTTP method");
errorResponse.init();
*errorResponse.getMessage() = "Invalid HTTP method";
response.write(errorResponse.asJson().toUtf8());
}
}
void WebAPIRequestMapper::devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;

View File

@ -85,6 +85,7 @@ private:
void instanceFeaturePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceDeviceSetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceDeviceSetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceWorkspaceService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetFocusService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
@ -112,6 +113,7 @@ private:
void featuresetFeatureReportService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureActionsService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer);
bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier);
bool validatePresetExport(SWGSDRangel::SWGPresetExport& presetExport);

View File

@ -1621,6 +1621,16 @@ bool MainWindow::handleMessage(const Message& cmd)
m_mainCore->m_settings.deleteConfiguration(configurationToDelete);
return true;
}
else if (MainCore::MsgDeleteEmptyWorkspaces::match(cmd))
{
removeEmptyWorkspaces();
return true;
}
else if (MainCore::MsgAddWorkspace::match(cmd))
{
addWorkspace();
return true;
}
else if (MainCore::MsgDeleteFeatureSetPreset::match(cmd))
{
MainCore::MsgDeleteFeatureSetPreset& notif = (MainCore::MsgDeleteFeatureSetPreset&) cmd;

View File

@ -1282,6 +1282,37 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/workspace:
x-swagger-router-controller: instance
post:
description: Add new workspace
operationId: InstanceWorkspaceAdd
tags:
- Workspace
responses:
"202":
descriptions: Successful sending of the message
schema:
$ref: "#/definitions/SuccessResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
delete:
description: Delete empty workspaces
operationId: InstanceWorkspacesDeleteEmpty
tags:
- Workspace
responses:
"202":
descriptions: Successful sending of the message
schema:
$ref: "#/definitions/SuccessResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/deviceset:
x-swagger-router-controller: instance
post:

View File

@ -14754,6 +14754,13 @@ margin-bottom: 20px;
<li data-group="Instance" data-name="instanceSummary" class="">
<a href="#api-Instance-instanceSummary">instanceSummary</a>
</li>
<li class="nav-header" data-group="Workspace"><a href="#api-Workspace">API Methods - Workspace</a></li>
<li data-group="Workspace" data-name="instanceWorkspaceAdd" class="">
<a href="#api-Workspace-instanceWorkspaceAdd">instanceWorkspaceAdd</a>
</li>
<li data-group="Workspace" data-name="instanceWorkspacesDeleteEmpty" class="">
<a href="#api-Workspace-instanceWorkspacesDeleteEmpty">instanceWorkspacesDeleteEmpty</a>
</li>
</ul>
</nav>
</div>
@ -55812,6 +55819,677 @@ except ApiException as e:
</div>
<hr>
</section>
<section id="api-Workspace">
<h1>Workspace</h1>
<div id="api-Workspace-instanceWorkspaceAdd">
<article id="api-Workspace-instanceWorkspaceAdd-0" data-group="User" data-name="instanceWorkspaceAdd" data-version="0">
<div class="pull-left">
<h1>instanceWorkspaceAdd</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">Add new workspace</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="post"><code><span class="pln">/sdrangel/workspace</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-Workspace-instanceWorkspaceAdd-0-curl">Curl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-java">Java</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-android">Android</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-csharp">C#</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-php">PHP</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-perl">Perl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspaceAdd-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-Workspace-instanceWorkspaceAdd-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/workspace"</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.WorkspaceApi;
import java.io.File;
import java.util.*;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspaceAdd();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspaceAdd");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.WorkspaceApi;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspaceAdd();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspaceAdd");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-objc">
<pre class="prettyprint"><code class="language-cpp">
WorkspaceApi *apiInstance = [[WorkspaceApi alloc] init];
[apiInstance instanceWorkspaceAddWithCompletionHandler:
^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.WorkspaceApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.instanceWorkspaceAdd(callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-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 instanceWorkspaceAddExample
{
public void main()
{
var apiInstance = new WorkspaceApi();
try
{
SuccessResponse result = apiInstance.instanceWorkspaceAdd();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling WorkspaceApi.instanceWorkspaceAdd: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\WorkspaceApi();
try {
$result = $api_instance->instanceWorkspaceAdd();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling WorkspaceApi->instanceWorkspaceAdd: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::WorkspaceApi;
my $api_instance = SWGSDRangel::WorkspaceApi->new();
eval {
my $result = $api_instance->instanceWorkspaceAdd();
print Dumper($result);
};
if ($@) {
warn "Exception when calling WorkspaceApi->instanceWorkspaceAdd: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspaceAdd-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.WorkspaceApi()
try:
api_response = api_instance.instance_workspace_add()
pprint(api_response)
except ApiException as e:
print("Exception when calling WorkspaceApi->instanceWorkspaceAdd: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<h2>Responses</h2>
<h3> Status: 202 - </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceWorkspaceAdd-202-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspaceAdd-202-schema">
<div id='responses-instanceWorkspaceAdd-202-schema-202' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"schema" : {
"$ref" : "#/definitions/SuccessResponse"
}
};
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-instanceWorkspaceAdd-202-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspaceAdd-202-schema-202');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspaceAdd-202-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-instanceWorkspaceAdd-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspaceAdd-500-schema">
<div id='responses-instanceWorkspaceAdd-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-instanceWorkspaceAdd-500-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspaceAdd-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspaceAdd-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-instanceWorkspaceAdd-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspaceAdd-501-schema">
<div id='responses-instanceWorkspaceAdd-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-instanceWorkspaceAdd-501-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspaceAdd-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspaceAdd-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
<div id="api-Workspace-instanceWorkspacesDeleteEmpty">
<article id="api-Workspace-instanceWorkspacesDeleteEmpty-0" data-group="User" data-name="instanceWorkspacesDeleteEmpty" data-version="0">
<div class="pull-left">
<h1>instanceWorkspacesDeleteEmpty</h1>
<p></p>
</div>
<div class="pull-right"></div>
<div class="clearfix"></div>
<p></p>
<p class="marked">Delete empty workspaces</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="delete"><code><span class="pln">/sdrangel/workspace</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-Workspace-instanceWorkspacesDeleteEmpty-0-curl">Curl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-java">Java</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-android">Android</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-groovy">Groovy</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-objc">Obj-C</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-javascript">JavaScript</a></li>
<!--<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-angular">Angular</a></li>-->
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-csharp">C#</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-php">PHP</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-perl">Perl</a></li>
<li class=""><a href="#examples-Workspace-instanceWorkspacesDeleteEmpty-0-python">Python</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel/workspace"</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
import SWGSDRangel.auth.*;
import SWGSDRangel.model.*;
import SWGSDRangel.api.WorkspaceApi;
import java.io.File;
import java.util.*;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspacesDeleteEmpty();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspacesDeleteEmpty");
e.printStackTrace();
}
}
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-android">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.api.WorkspaceApi;
public class WorkspaceApiExample {
public static void main(String[] args) {
WorkspaceApi apiInstance = new WorkspaceApi();
try {
SuccessResponse result = apiInstance.instanceWorkspacesDeleteEmpty();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkspaceApi#instanceWorkspacesDeleteEmpty");
e.printStackTrace();
}
}
}</code></pre>
</div>
<!--
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-groovy">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div> -->
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-objc">
<pre class="prettyprint"><code class="language-cpp">
WorkspaceApi *apiInstance = [[WorkspaceApi alloc] init];
[apiInstance instanceWorkspacesDeleteEmptyWithCompletionHandler:
^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-javascript">
<pre class="prettyprint"><code class="language-js">var SdRangel = require('sd_rangel');
var api = new SdRangel.WorkspaceApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.instanceWorkspacesDeleteEmpty(callback);
</code></pre>
</div>
<!--<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-angular">
<pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre>
</div>-->
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-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 instanceWorkspacesDeleteEmptyExample
{
public void main()
{
var apiInstance = new WorkspaceApi();
try
{
SuccessResponse result = apiInstance.instanceWorkspacesDeleteEmpty();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling WorkspaceApi.instanceWorkspacesDeleteEmpty: " + e.Message );
}
}
}
}
</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-php">
<pre class="prettyprint"><code class="language-php"><&#63;php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\WorkspaceApi();
try {
$result = $api_instance->instanceWorkspacesDeleteEmpty();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling WorkspaceApi->instanceWorkspacesDeleteEmpty: ', $e->getMessage(), PHP_EOL;
}
?></code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-0-perl">
<pre class="prettyprint"><code class="language-perl">use Data::Dumper;
use SWGSDRangel::Configuration;
use SWGSDRangel::WorkspaceApi;
my $api_instance = SWGSDRangel::WorkspaceApi->new();
eval {
my $result = $api_instance->instanceWorkspacesDeleteEmpty();
print Dumper($result);
};
if ($@) {
warn "Exception when calling WorkspaceApi->instanceWorkspacesDeleteEmpty: $@\n";
}</code></pre>
</div>
<div class="tab-pane" id="examples-Workspace-instanceWorkspacesDeleteEmpty-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.WorkspaceApi()
try:
api_response = api_instance.instance_workspaces_delete_empty()
pprint(api_response)
except ApiException as e:
print("Exception when calling WorkspaceApi->instanceWorkspacesDeleteEmpty: %s\n" % e)</code></pre>
</div>
</div>
<h2>Parameters</h2>
<h2>Responses</h2>
<h3> Status: 202 - </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
<a data-toggle="tab" href="#responses-instanceWorkspacesDeleteEmpty-202-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspacesDeleteEmpty-202-schema">
<div id='responses-instanceWorkspacesDeleteEmpty-202-schema-202' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
<script>
$(document).ready(function() {
var schemaWrapper = {
"schema" : {
"$ref" : "#/definitions/SuccessResponse"
}
};
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-instanceWorkspacesDeleteEmpty-202-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspacesDeleteEmpty-202-schema-202');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspacesDeleteEmpty-202-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-instanceWorkspacesDeleteEmpty-500-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspacesDeleteEmpty-500-schema">
<div id='responses-instanceWorkspacesDeleteEmpty-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-instanceWorkspacesDeleteEmpty-500-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspacesDeleteEmpty-500-schema-500');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspacesDeleteEmpty-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-instanceWorkspacesDeleteEmpty-501-schema">Schema</a>
</li>
</ul>
<div class="tab-content" style='margin-bottom: 10px;'>
<div class="tab-pane active" id="responses-instanceWorkspacesDeleteEmpty-501-schema">
<div id='responses-instanceWorkspacesDeleteEmpty-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-instanceWorkspacesDeleteEmpty-501-schema-data').val(stringify(schema));
var result = $('#responses-instanceWorkspacesDeleteEmpty-501-schema-501');
result.empty();
result.append(view.render());
});
</script>
</div>
<input id='responses-instanceWorkspacesDeleteEmpty-501-schema-data' type='hidden' value=''></input>
</div>
</div>
</article>
</div>
<hr>
</section>
</div>
<div id="footer">
<div id="api-_footer">
@ -55825,7 +56503,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-05-08T19:09:57.985+02:00
Generated 2022-05-09T01:10:06.823+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,136 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGWorkspaceApi.h"
#include "SWGHelpers.h"
#include "SWGModelFactory.h"
#include <QJsonArray>
#include <QJsonDocument>
namespace SWGSDRangel {
SWGWorkspaceApi::SWGWorkspaceApi() {}
SWGWorkspaceApi::~SWGWorkspaceApi() {}
SWGWorkspaceApi::SWGWorkspaceApi(QString host, QString basePath) {
this->host = host;
this->basePath = basePath;
}
void
SWGWorkspaceApi::instanceWorkspaceAdd() {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/workspace");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "POST");
foreach(QString key, this->defaultHeaders.keys()) {
input.headers.insert(key, this->defaultHeaders.value(key));
}
connect(worker,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGWorkspaceApi::instanceWorkspaceAddCallback);
worker->execute(&input);
}
void
SWGWorkspaceApi::instanceWorkspaceAddCallback(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);
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceWorkspaceAddSignal(output);
} else {
emit instanceWorkspaceAddSignalE(output, error_type, error_str);
emit instanceWorkspaceAddSignalEFull(worker, error_type, error_str);
}
}
void
SWGWorkspaceApi::instanceWorkspacesDeleteEmpty() {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/workspace");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "DELETE");
foreach(QString key, this->defaultHeaders.keys()) {
input.headers.insert(key, this->defaultHeaders.value(key));
}
connect(worker,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGWorkspaceApi::instanceWorkspacesDeleteEmptyCallback);
worker->execute(&input);
}
void
SWGWorkspaceApi::instanceWorkspacesDeleteEmptyCallback(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);
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceWorkspacesDeleteEmptySignal(output);
} else {
emit instanceWorkspacesDeleteEmptySignalE(output, error_type, error_str);
emit instanceWorkspacesDeleteEmptySignalEFull(worker, error_type, error_str);
}
}
}

View 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. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#ifndef _SWG_SWGWorkspaceApi_H_
#define _SWG_SWGWorkspaceApi_H_
#include "SWGHttpRequest.h"
#include "SWGErrorResponse.h"
#include "SWGSuccessResponse.h"
#include <QObject>
namespace SWGSDRangel {
class SWGWorkspaceApi: public QObject {
Q_OBJECT
public:
SWGWorkspaceApi();
SWGWorkspaceApi(QString host, QString basePath);
~SWGWorkspaceApi();
QString host;
QString basePath;
QMap<QString, QString> defaultHeaders;
void instanceWorkspaceAdd();
void instanceWorkspacesDeleteEmpty();
private:
void instanceWorkspaceAddCallback (SWGHttpRequestWorker * worker);
void instanceWorkspacesDeleteEmptyCallback (SWGHttpRequestWorker * worker);
signals:
void instanceWorkspaceAddSignal(SWGSuccessResponse* summary);
void instanceWorkspacesDeleteEmptySignal(SWGSuccessResponse* summary);
void instanceWorkspaceAddSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceWorkspacesDeleteEmptySignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceWorkspaceAddSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceWorkspacesDeleteEmptySignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
};
}
#endif