mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 10:33:29 -05:00
Reverse API originator information: implemented for start/stop in RTL-SDR and TestSource
This commit is contained in:
parent
369aebf1ed
commit
546d8dca5e
@ -838,16 +838,27 @@ void RTLSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
|
||||
|
||||
void RTLSDRInput::webapiReverseSendStartStop(bool start)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setTx(0);
|
||||
swgDeviceSettings->setDeviceHwType(new QString("RTLSDR"));
|
||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
|
||||
.arg(m_settings.m_reverseAPIAddress)
|
||||
.arg(m_settings.m_reverseAPIPort)
|
||||
.arg(m_settings.m_reverseAPIDeviceIndex);
|
||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QBuffer *buffer=new QBuffer();
|
||||
buffer->open((QBuffer::ReadWrite));
|
||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||
buffer->seek(0);
|
||||
|
||||
if (start) {
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "POST");
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
|
||||
} else {
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE");
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,16 +700,27 @@ void TestSourceInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKe
|
||||
|
||||
void TestSourceInput::webapiReverseSendStartStop(bool start)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setTx(0);
|
||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||
swgDeviceSettings->setDeviceHwType(new QString("TestSource"));
|
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
|
||||
.arg(m_settings.m_reverseAPIAddress)
|
||||
.arg(m_settings.m_reverseAPIPort)
|
||||
.arg(m_settings.m_reverseAPIDeviceIndex);
|
||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QBuffer *buffer=new QBuffer();
|
||||
buffer->open((QBuffer::ReadWrite));
|
||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||
buffer->seek(0);
|
||||
|
||||
if (start) {
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "POST");
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
|
||||
} else {
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE");
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10269,8 +10269,9 @@ public class DeviceSetApiExample {
|
||||
|
||||
DeviceSetApi apiInstance = new DeviceSetApi();
|
||||
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
|
||||
@ -10288,8 +10289,9 @@ 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
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
|
||||
@ -10304,10 +10306,12 @@ public class DeviceSetApiExample {
|
||||
</div> -->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunDelete-0-objc">
|
||||
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
|
||||
DeviceSettings *body = ; // Originator information in the reverse API case (optional)
|
||||
|
||||
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
|
||||
|
||||
[apiInstance devicesetDeviceRunDeleteWith:deviceSetIndex
|
||||
body:body
|
||||
completionHandler: ^(DeviceState output, NSError* error) {
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
@ -10326,6 +10330,9 @@ var api = new SdRangel.DeviceSetApi()
|
||||
|
||||
var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
|
||||
|
||||
var opts = {
|
||||
'body': // {DeviceSettings} Originator information in the reverse API case
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@ -10334,7 +10341,7 @@ var callback = function(error, data, response) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.devicesetDeviceRunDelete(deviceSetIndex, callback);
|
||||
api.devicesetDeviceRunDelete(deviceSetIndex, opts, callback);
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
@ -10357,10 +10364,11 @@ namespace Example
|
||||
|
||||
var apiInstance = new DeviceSetApi();
|
||||
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
var body = new DeviceSettings(); // DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try
|
||||
{
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex, body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -10379,9 +10387,10 @@ 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
|
||||
$body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
try {
|
||||
$result = $api_instance->devicesetDeviceRunDelete($deviceSetIndex);
|
||||
$result = $api_instance->devicesetDeviceRunDelete($deviceSetIndex, $body);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling DeviceSetApi->devicesetDeviceRunDelete: ', $e->getMessage(), PHP_EOL;
|
||||
@ -10396,9 +10405,10 @@ use SWGSDRangel::DeviceSetApi;
|
||||
|
||||
my $api_instance = SWGSDRangel::DeviceSetApi->new();
|
||||
my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
|
||||
my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
eval {
|
||||
my $result = $api_instance->devicesetDeviceRunDelete(deviceSetIndex => $deviceSetIndex);
|
||||
my $result = $api_instance->devicesetDeviceRunDelete(deviceSetIndex => $deviceSetIndex, body => $body);
|
||||
print Dumper($result);
|
||||
};
|
||||
if ($@) {
|
||||
@ -10416,9 +10426,10 @@ 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
|
||||
body = # DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try:
|
||||
api_response = api_instance.deviceset_device_run_delete(deviceSetIndex)
|
||||
api_response = api_instance.deviceset_device_run_delete(deviceSetIndex, body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling DeviceSetApi->devicesetDeviceRunDelete: %s\n" % e)</code></pre>
|
||||
@ -10459,6 +10470,48 @@ except ApiException as e:
|
||||
</table>
|
||||
|
||||
|
||||
<div class="methodsubtabletitle">Body parameters</div>
|
||||
<table id="methodsubtable">
|
||||
<tr>
|
||||
<th width="150px">Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr><td style="width:150px;">body </td>
|
||||
<td>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var schemaWrapper = {
|
||||
"in" : "body",
|
||||
"name" : "body",
|
||||
"description" : "Originator information in the reverse API case",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/DeviceSettings"
|
||||
}
|
||||
};
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
var view = new JSONSchemaView(schema,2,{isBodyParam: true});
|
||||
var result = $('#d2e199_devicesetDeviceRunDelete_body');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
<div id="d2e199_devicesetDeviceRunDelete_body"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
@ -11191,8 +11244,9 @@ public class DeviceSetApiExample {
|
||||
|
||||
DeviceSetApi apiInstance = new DeviceSetApi();
|
||||
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
|
||||
@ -11210,8 +11264,9 @@ 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
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
|
||||
@ -11226,10 +11281,12 @@ public class DeviceSetApiExample {
|
||||
</div> -->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunPost-0-objc">
|
||||
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
|
||||
DeviceSettings *body = ; // Originator information in the reverse API case (optional)
|
||||
|
||||
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
|
||||
|
||||
[apiInstance devicesetDeviceRunPostWith:deviceSetIndex
|
||||
body:body
|
||||
completionHandler: ^(DeviceState output, NSError* error) {
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
@ -11248,6 +11305,9 @@ var api = new SdRangel.DeviceSetApi()
|
||||
|
||||
var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
|
||||
|
||||
var opts = {
|
||||
'body': // {DeviceSettings} Originator information in the reverse API case
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@ -11256,7 +11316,7 @@ var callback = function(error, data, response) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.devicesetDeviceRunPost(deviceSetIndex, callback);
|
||||
api.devicesetDeviceRunPost(deviceSetIndex, opts, callback);
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
@ -11279,10 +11339,11 @@ namespace Example
|
||||
|
||||
var apiInstance = new DeviceSetApi();
|
||||
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
var body = new DeviceSettings(); // DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try
|
||||
{
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex, body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -11301,9 +11362,10 @@ 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
|
||||
$body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
try {
|
||||
$result = $api_instance->devicesetDeviceRunPost($deviceSetIndex);
|
||||
$result = $api_instance->devicesetDeviceRunPost($deviceSetIndex, $body);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling DeviceSetApi->devicesetDeviceRunPost: ', $e->getMessage(), PHP_EOL;
|
||||
@ -11318,9 +11380,10 @@ use SWGSDRangel::DeviceSetApi;
|
||||
|
||||
my $api_instance = SWGSDRangel::DeviceSetApi->new();
|
||||
my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
|
||||
my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
eval {
|
||||
my $result = $api_instance->devicesetDeviceRunPost(deviceSetIndex => $deviceSetIndex);
|
||||
my $result = $api_instance->devicesetDeviceRunPost(deviceSetIndex => $deviceSetIndex, body => $body);
|
||||
print Dumper($result);
|
||||
};
|
||||
if ($@) {
|
||||
@ -11338,9 +11401,10 @@ 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
|
||||
body = # DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try:
|
||||
api_response = api_instance.deviceset_device_run_post(deviceSetIndex)
|
||||
api_response = api_instance.deviceset_device_run_post(deviceSetIndex, body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling DeviceSetApi->devicesetDeviceRunPost: %s\n" % e)</code></pre>
|
||||
@ -11381,6 +11445,48 @@ except ApiException as e:
|
||||
</table>
|
||||
|
||||
|
||||
<div class="methodsubtabletitle">Body parameters</div>
|
||||
<table id="methodsubtable">
|
||||
<tr>
|
||||
<th width="150px">Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr><td style="width:150px;">body </td>
|
||||
<td>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var schemaWrapper = {
|
||||
"in" : "body",
|
||||
"name" : "body",
|
||||
"description" : "Originator information in the reverse API case",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/DeviceSettings"
|
||||
}
|
||||
};
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
var view = new JSONSchemaView(schema,2,{isBodyParam: true});
|
||||
var result = $('#d2e199_devicesetDeviceRunPost_body');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
<div id="d2e199_devicesetDeviceRunPost_body"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
@ -24546,7 +24652,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2019-03-24T23:28:38.479+01:00
|
||||
Generated 2019-03-25T14:39:14.782+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -904,6 +904,12 @@ paths:
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of device set in the device set list
|
||||
- name: body
|
||||
in: body
|
||||
description: Originator information in the reverse API case
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return state before change
|
||||
@ -932,6 +938,12 @@ paths:
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of device set in the device set list
|
||||
- name: body
|
||||
in: body
|
||||
description: Originator information in the reverse API case
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return state before change
|
||||
|
@ -904,6 +904,12 @@ paths:
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of device set in the device set list
|
||||
- name: body
|
||||
in: body
|
||||
description: Originator information in the reverse API case
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return state before change
|
||||
@ -932,6 +938,12 @@ paths:
|
||||
type: integer
|
||||
required: true
|
||||
description: Index of device set in the device set list
|
||||
- name: body
|
||||
in: body
|
||||
description: Originator information in the reverse API case
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success return state before change
|
||||
|
@ -10269,8 +10269,9 @@ public class DeviceSetApiExample {
|
||||
|
||||
DeviceSetApi apiInstance = new DeviceSetApi();
|
||||
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
|
||||
@ -10288,8 +10289,9 @@ 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
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
|
||||
@ -10304,10 +10306,12 @@ public class DeviceSetApiExample {
|
||||
</div> -->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunDelete-0-objc">
|
||||
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
|
||||
DeviceSettings *body = ; // Originator information in the reverse API case (optional)
|
||||
|
||||
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
|
||||
|
||||
[apiInstance devicesetDeviceRunDeleteWith:deviceSetIndex
|
||||
body:body
|
||||
completionHandler: ^(DeviceState output, NSError* error) {
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
@ -10326,6 +10330,9 @@ var api = new SdRangel.DeviceSetApi()
|
||||
|
||||
var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
|
||||
|
||||
var opts = {
|
||||
'body': // {DeviceSettings} Originator information in the reverse API case
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@ -10334,7 +10341,7 @@ var callback = function(error, data, response) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.devicesetDeviceRunDelete(deviceSetIndex, callback);
|
||||
api.devicesetDeviceRunDelete(deviceSetIndex, opts, callback);
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
@ -10357,10 +10364,11 @@ namespace Example
|
||||
|
||||
var apiInstance = new DeviceSetApi();
|
||||
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
var body = new DeviceSettings(); // DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try
|
||||
{
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex, body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -10379,9 +10387,10 @@ 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
|
||||
$body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
try {
|
||||
$result = $api_instance->devicesetDeviceRunDelete($deviceSetIndex);
|
||||
$result = $api_instance->devicesetDeviceRunDelete($deviceSetIndex, $body);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling DeviceSetApi->devicesetDeviceRunDelete: ', $e->getMessage(), PHP_EOL;
|
||||
@ -10396,9 +10405,10 @@ use SWGSDRangel::DeviceSetApi;
|
||||
|
||||
my $api_instance = SWGSDRangel::DeviceSetApi->new();
|
||||
my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
|
||||
my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
eval {
|
||||
my $result = $api_instance->devicesetDeviceRunDelete(deviceSetIndex => $deviceSetIndex);
|
||||
my $result = $api_instance->devicesetDeviceRunDelete(deviceSetIndex => $deviceSetIndex, body => $body);
|
||||
print Dumper($result);
|
||||
};
|
||||
if ($@) {
|
||||
@ -10416,9 +10426,10 @@ 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
|
||||
body = # DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try:
|
||||
api_response = api_instance.deviceset_device_run_delete(deviceSetIndex)
|
||||
api_response = api_instance.deviceset_device_run_delete(deviceSetIndex, body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling DeviceSetApi->devicesetDeviceRunDelete: %s\n" % e)</code></pre>
|
||||
@ -10459,6 +10470,48 @@ except ApiException as e:
|
||||
</table>
|
||||
|
||||
|
||||
<div class="methodsubtabletitle">Body parameters</div>
|
||||
<table id="methodsubtable">
|
||||
<tr>
|
||||
<th width="150px">Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr><td style="width:150px;">body </td>
|
||||
<td>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var schemaWrapper = {
|
||||
"in" : "body",
|
||||
"name" : "body",
|
||||
"description" : "Originator information in the reverse API case",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/DeviceSettings"
|
||||
}
|
||||
};
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
var view = new JSONSchemaView(schema,2,{isBodyParam: true});
|
||||
var result = $('#d2e199_devicesetDeviceRunDelete_body');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
<div id="d2e199_devicesetDeviceRunDelete_body"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
@ -11191,8 +11244,9 @@ public class DeviceSetApiExample {
|
||||
|
||||
DeviceSetApi apiInstance = new DeviceSetApi();
|
||||
Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
|
||||
@ -11210,8 +11264,9 @@ 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
|
||||
DeviceSettings body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
try {
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex, body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
|
||||
@ -11226,10 +11281,12 @@ public class DeviceSetApiExample {
|
||||
</div> -->
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunPost-0-objc">
|
||||
<pre class="prettyprint"><code class="language-cpp">Integer *deviceSetIndex = 56; // Index of device set in the device set list
|
||||
DeviceSettings *body = ; // Originator information in the reverse API case (optional)
|
||||
|
||||
DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
|
||||
|
||||
[apiInstance devicesetDeviceRunPostWith:deviceSetIndex
|
||||
body:body
|
||||
completionHandler: ^(DeviceState output, NSError* error) {
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
@ -11248,6 +11305,9 @@ var api = new SdRangel.DeviceSetApi()
|
||||
|
||||
var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
|
||||
|
||||
var opts = {
|
||||
'body': // {DeviceSettings} Originator information in the reverse API case
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@ -11256,7 +11316,7 @@ var callback = function(error, data, response) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.devicesetDeviceRunPost(deviceSetIndex, callback);
|
||||
api.devicesetDeviceRunPost(deviceSetIndex, opts, callback);
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
@ -11279,10 +11339,11 @@ namespace Example
|
||||
|
||||
var apiInstance = new DeviceSetApi();
|
||||
var deviceSetIndex = 56; // Integer | Index of device set in the device set list
|
||||
var body = new DeviceSettings(); // DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try
|
||||
{
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
|
||||
DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex, body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -11301,9 +11362,10 @@ 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
|
||||
$body = ; // DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
try {
|
||||
$result = $api_instance->devicesetDeviceRunPost($deviceSetIndex);
|
||||
$result = $api_instance->devicesetDeviceRunPost($deviceSetIndex, $body);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling DeviceSetApi->devicesetDeviceRunPost: ', $e->getMessage(), PHP_EOL;
|
||||
@ -11318,9 +11380,10 @@ use SWGSDRangel::DeviceSetApi;
|
||||
|
||||
my $api_instance = SWGSDRangel::DeviceSetApi->new();
|
||||
my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
|
||||
my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Originator information in the reverse API case
|
||||
|
||||
eval {
|
||||
my $result = $api_instance->devicesetDeviceRunPost(deviceSetIndex => $deviceSetIndex);
|
||||
my $result = $api_instance->devicesetDeviceRunPost(deviceSetIndex => $deviceSetIndex, body => $body);
|
||||
print Dumper($result);
|
||||
};
|
||||
if ($@) {
|
||||
@ -11338,9 +11401,10 @@ 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
|
||||
body = # DeviceSettings | Originator information in the reverse API case (optional)
|
||||
|
||||
try:
|
||||
api_response = api_instance.deviceset_device_run_post(deviceSetIndex)
|
||||
api_response = api_instance.deviceset_device_run_post(deviceSetIndex, body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling DeviceSetApi->devicesetDeviceRunPost: %s\n" % e)</code></pre>
|
||||
@ -11381,6 +11445,48 @@ except ApiException as e:
|
||||
</table>
|
||||
|
||||
|
||||
<div class="methodsubtabletitle">Body parameters</div>
|
||||
<table id="methodsubtable">
|
||||
<tr>
|
||||
<th width="150px">Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr><td style="width:150px;">body </td>
|
||||
<td>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var schemaWrapper = {
|
||||
"in" : "body",
|
||||
"name" : "body",
|
||||
"description" : "Originator information in the reverse API case",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/DeviceSettings"
|
||||
}
|
||||
};
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
var view = new JSONSchemaView(schema,2,{isBodyParam: true});
|
||||
var result = $('#d2e199_devicesetDeviceRunPost_body');
|
||||
result.empty();
|
||||
result.append(view.render());
|
||||
});
|
||||
</script>
|
||||
<div id="d2e199_devicesetDeviceRunPost_body"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
@ -24546,7 +24652,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2019-03-24T23:28:38.479+01:00
|
||||
Generated 2019-03-25T14:39:14.782+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -537,7 +537,7 @@ SWGDeviceSetApi::devicesetDeviceReportGetCallback(SWGHttpRequestWorker * worker)
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
|
||||
SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index, SWGDeviceSettings& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run");
|
||||
|
||||
@ -550,6 +550,9 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
@ -645,7 +648,7 @@ SWGDeviceSetApi::devicesetDeviceRunGetCallback(SWGHttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
void
|
||||
SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
|
||||
SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index, SWGDeviceSettings& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run");
|
||||
|
||||
@ -658,6 +661,9 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
|
@ -51,9 +51,9 @@ public:
|
||||
void devicesetChannelsReportGet(qint32 device_set_index);
|
||||
void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body);
|
||||
void devicesetDeviceReportGet(qint32 device_set_index);
|
||||
void devicesetDeviceRunDelete(qint32 device_set_index);
|
||||
void devicesetDeviceRunDelete(qint32 device_set_index, SWGDeviceSettings& body);
|
||||
void devicesetDeviceRunGet(qint32 device_set_index);
|
||||
void devicesetDeviceRunPost(qint32 device_set_index);
|
||||
void devicesetDeviceRunPost(qint32 device_set_index, SWGDeviceSettings& body);
|
||||
void devicesetDeviceSettingsGet(qint32 device_set_index);
|
||||
void devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings& body);
|
||||
void devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings& body);
|
||||
|
@ -18,12 +18,16 @@ def hello_sdrangel():
|
||||
@app.route('/sdrangel/deviceset/<int:deviceset_index>/device/run', methods=['GET', 'POST', 'DELETE'])
|
||||
def device_run(deviceset_index):
|
||||
''' Reply with the expected reply of a working device '''
|
||||
originatorIndex = None
|
||||
content = request.get_json(silent=True)
|
||||
if content:
|
||||
originatorIndex = content.get('originatorIndex')
|
||||
if request.method == 'POST':
|
||||
print(f'Start device {deviceset_index}')
|
||||
print(f'Start device {deviceset_index} from device {originatorIndex}')
|
||||
reply = { "state": "idle" }
|
||||
return jsonify(reply)
|
||||
elif request.method == 'DELETE':
|
||||
print(f'Stop device {deviceset_index}')
|
||||
print(f'Stop device {deviceset_index} from device {originatorIndex}')
|
||||
reply = { "state": "running" }
|
||||
return jsonify(reply)
|
||||
elif request.method == 'GET':
|
||||
|
Loading…
Reference in New Issue
Block a user