From da4884d1a0d2fee147873f68c90955827ad78543 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 19 Dec 2017 17:55:05 +0100 Subject: [PATCH] Web API: suppress waiting after asynchronous message posting and return 200 with a simple message --- sdrbase/resources/index.html | 52 +++++----- sdrbase/webapi/webapiadapterinterface.h | 8 +- sdrbase/webapi/webapirequestmapper.cpp | 18 ++-- sdrgui/webapi/webapiadaptergui.cpp | 81 ++++------------ sdrgui/webapi/webapiadaptergui.h | 7 +- .../sdrangel/api/swagger/include/NFMMod.yaml | 2 +- swagger/sdrangel/api/swagger/swagger.yaml | 18 ++-- swagger/sdrangel/code/html2/index.html | 52 +++++----- .../code/qt5/client/SWGDeviceSetApi.cpp | 2 +- .../code/qt5/client/SWGDeviceSetApi.h | 5 +- .../code/qt5/client/SWGInstanceApi.cpp | 4 +- .../sdrangel/code/qt5/client/SWGInstanceApi.h | 10 +- .../code/qt5/client/SWGModelFactory.h | 4 + .../code/qt5/client/SWGSuccessResponse.cpp | 95 +++++++++++++++++++ .../code/qt5/client/SWGSuccessResponse.h | 55 +++++++++++ 15 files changed, 277 insertions(+), 136 deletions(-) create mode 100644 swagger/sdrangel/code/qt5/client/SWGSuccessResponse.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGSuccessResponse.h diff --git a/sdrbase/resources/index.html b/sdrbase/resources/index.html index ab48c0131..1240833f9 100644 --- a/sdrbase/resources/index.html +++ b/sdrbase/resources/index.html @@ -1548,6 +1548,14 @@ margin-bottom: 20px; } }, "description" : "Information about a logical device available from an attached hardware device that can be used as a sampling device" +}; + defs.SuccessResponse = { + "required" : [ "message" ], + "properties" : { + "message" : { + "type" : "string" + } + } }; @@ -2216,7 +2224,7 @@ public class DeviceSetApiExample { Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list ChannelSettings body = ; // ChannelSettings | Channel identification (no settings data) try { - ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body); + SuccessResponse result = apiInstance.devicesetChannelPost(deviceSetIndex, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DeviceSetApi#devicesetChannelPost"); @@ -2236,7 +2244,7 @@ public class DeviceSetApiExample { Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list ChannelSettings body = ; // ChannelSettings | Channel identification (no settings data) try { - ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body); + SuccessResponse result = apiInstance.devicesetChannelPost(deviceSetIndex, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DeviceSetApi#devicesetChannelPost"); @@ -2257,7 +2265,7 @@ DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init]; [apiInstance devicesetChannelPostWith:deviceSetIndex body:body - completionHandler: ^(ChannelSettings output, NSError* error) { + completionHandler: ^(SuccessResponse output, NSError* error) { if (output) { NSLog(@"%@", output); } @@ -2312,7 +2320,7 @@ namespace Example try { - ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body); + SuccessResponse result = apiInstance.devicesetChannelPost(deviceSetIndex, body); Debug.WriteLine(result); } catch (Exception e) @@ -2460,7 +2468,7 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return new channel settings

+

Status: 200 - On success return informative message