diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp index bc573d993..dc1769d8e 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp @@ -838,16 +838,27 @@ void RTLSDRInput::webapiReverseSendSettings(QList& 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); } } diff --git a/plugins/samplesource/testsource/testsourceinput.cpp b/plugins/samplesource/testsource/testsourceinput.cpp index 36a017c40..dd1210bb7 100644 --- a/plugins/samplesource/testsource/testsourceinput.cpp +++ b/plugins/samplesource/testsource/testsourceinput.cpp @@ -700,16 +700,27 @@ void TestSourceInput::webapiReverseSendSettings(QList& 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); } } diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 81c572e48..1eb36808a 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -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 { -->
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);
 
@@ -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) @@ -10459,6 +10470,48 @@ except ApiException as e: +
Body parameters
+ + + + + + + + + +
NameDescription
body + + + +
+
@@ -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 { -->
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);
 
@@ -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) @@ -11381,6 +11445,48 @@ except ApiException as e: +
Body parameters
+ + + + + + + + + +
NameDescription
body + + + +
+
@@ -24546,7 +24652,7 @@ except ApiException as e:
- Generated 2019-03-24T23:28:38.479+01:00 + Generated 2019-03-25T14:39:14.782+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index ee2f90d82..01ce9bc71 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -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 diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index a72275528..9486e055a 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -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 diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 81c572e48..1eb36808a 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -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 { -->
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);
 
@@ -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) @@ -10459,6 +10470,48 @@ except ApiException as e: +
Body parameters
+ + + + + + + + + +
NameDescription
body + + + +
+
@@ -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 { -->
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);
 
@@ -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) @@ -11381,6 +11445,48 @@ except ApiException as e: +
Body parameters
+ + + + + + + + + +
NameDescription
body + + + +
+
@@ -24546,7 +24652,7 @@ except ApiException as e:
- Generated 2019-03-24T23:28:38.479+01:00 + Generated 2019-03-25T14:39:14.782+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp index c0dcc858b..2e9f3c5ca 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp @@ -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"); @@ -549,7 +549,10 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) { SWGHttpRequestInput input(fullPath, "DELETE"); - + + 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"); @@ -657,7 +660,10 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) { SWGHttpRequestInput input(fullPath, "POST"); - + + QString output = body.asJson(); + input.request_body.append(output); + foreach(QString key, this->defaultHeaders.keys()) { diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h index 39ad0ac4f..45202e32a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h @@ -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); diff --git a/swagger/sdrangel/examples/reverseapi.py b/swagger/sdrangel/examples/reverseapi.py index b7d5f0e04..69e0e1f94 100644 --- a/swagger/sdrangel/examples/reverseapi.py +++ b/swagger/sdrangel/examples/reverseapi.py @@ -18,12 +18,16 @@ def hello_sdrangel(): @app.route('/sdrangel/deviceset//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':