1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Web API: suppress waiting after asynchronous message posting and return 200 with a simple message

This commit is contained in:
f4exb 2017-12-19 17:55:05 +01:00
parent 15b09161ab
commit da4884d1a0
15 changed files with 277 additions and 136 deletions

View File

@ -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"
}
}
};
</script>
@ -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() {
<h2>Responses</h2>
<h3> Status: 200 - On success return new channel settings </h3>
<h3> Status: 200 - On success return informative message </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
@ -2475,9 +2483,9 @@ $(document).ready(function() {
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return new channel settings",
"description" : "On success return informative message",
"schema" : {
"$ref" : "#/definitions/ChannelSettings"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -9092,7 +9100,7 @@ public class InstanceApiExample {
InstanceApi apiInstance = new InstanceApi();
try {
DeviceSetList result = apiInstance.instanceDeviceSetsDelete();
SuccessResponse result = apiInstance.instanceDeviceSetsDelete();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsDelete");
@ -9110,7 +9118,7 @@ public class InstanceApiExample {
public static void main(String[] args) {
InstanceApi apiInstance = new InstanceApi();
try {
DeviceSetList result = apiInstance.instanceDeviceSetsDelete();
SuccessResponse result = apiInstance.instanceDeviceSetsDelete();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsDelete");
@ -9128,7 +9136,7 @@ public class InstanceApiExample {
InstanceApi *apiInstance = [[InstanceApi alloc] init];
[apiInstance instanceDeviceSetsDeleteWithCompletionHandler:
^(DeviceSetList output, NSError* error) {
^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
@ -9176,7 +9184,7 @@ namespace Example
try
{
DeviceSetList result = apiInstance.instanceDeviceSetsDelete();
SuccessResponse result = apiInstance.instanceDeviceSetsDelete();
Debug.WriteLine(result);
}
catch (Exception e)
@ -9246,7 +9254,7 @@ except ApiException as e:
<h2>Responses</h2>
<h3> Status: 200 - On success return new list of device sets </h3>
<h3> Status: 200 - On success return informative message </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
@ -9261,9 +9269,9 @@ except ApiException as e:
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return new list of device sets",
"description" : "On success return informative message",
"schema" : {
"$ref" : "#/definitions/DeviceSetList"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -9736,7 +9744,7 @@ public class InstanceApiExample {
InstanceApi apiInstance = new InstanceApi();
Integer tx = 56; // Integer | Set to non zero (true) for a Tx device set (default Rx)
try {
DeviceSet result = apiInstance.instanceDeviceSetsPost(tx);
SuccessResponse result = apiInstance.instanceDeviceSetsPost(tx);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsPost");
@ -9755,7 +9763,7 @@ public class InstanceApiExample {
InstanceApi apiInstance = new InstanceApi();
Integer tx = 56; // Integer | Set to non zero (true) for a Tx device set (default Rx)
try {
DeviceSet result = apiInstance.instanceDeviceSetsPost(tx);
SuccessResponse result = apiInstance.instanceDeviceSetsPost(tx);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsPost");
@ -9774,7 +9782,7 @@ public class InstanceApiExample {
InstanceApi *apiInstance = [[InstanceApi alloc] init];
[apiInstance instanceDeviceSetsPostWith:tx
completionHandler: ^(DeviceSet output, NSError* error) {
completionHandler: ^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
@ -9827,7 +9835,7 @@ namespace Example
try
{
DeviceSet result = apiInstance.instanceDeviceSetsPost(tx);
SuccessResponse result = apiInstance.instanceDeviceSetsPost(tx);
Debug.WriteLine(result);
}
catch (Exception e)
@ -9927,7 +9935,7 @@ except ApiException as e:
</table>
<h2>Responses</h2>
<h3> Status: 200 - On success return new device set </h3>
<h3> Status: 200 - On success return informative messsage </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
@ -9942,9 +9950,9 @@ except ApiException as e:
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return new device set",
"description" : "On success return informative messsage",
"schema" : {
"$ref" : "#/definitions/DeviceSet"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -15002,7 +15010,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2017-12-19T01:09:19.350+01:00
Generated 2017-12-19T15:17:58.471+01:00
</div>
</div>
</div>

View File

@ -43,6 +43,7 @@ namespace SWGSDRangel
class SWGDeviceSettings;
class SWGDeviceState;
class SWGChannelSettings;
class SWGSuccessResponse;
class SWGErrorResponse;
}
@ -236,7 +237,7 @@ public:
*/
virtual int instanceDeviceSetsPost(
bool tx __attribute__((unused)),
SWGSDRangel::SWGDeviceSet& response __attribute__((unused)),
SWGSDRangel::SWGSuccessResponse& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ return 501; }
@ -245,7 +246,7 @@ public:
* returns the Http status code (default 501: not implemented)
*/
virtual int instanceDeviceSetsDelete(
SWGSDRangel::SWGDeviceSetList& response __attribute__((unused)),
SWGSDRangel::SWGSuccessResponse& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ return 501; }
@ -326,7 +327,8 @@ public:
*/
virtual int devicesetChannelPost(
int deviceSetIndex __attribute__((unused)),
SWGSDRangel::SWGChannelSettings& response __attribute__((unused)),
SWGSDRangel::SWGChannelSettings& query __attribute__((unused)),
SWGSDRangel::SWGSuccessResponse& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ return 501; }

View File

@ -39,6 +39,7 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGChannelSettings.h"
#include "SWGSuccessResponse.h"
#include "SWGErrorResponse.h"
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
@ -707,7 +708,7 @@ void WebAPIRequestMapper::instanceDeviceSetsService(qtwebapp::HttpRequest& reque
}
else if (request.getMethod() == "POST")
{
SWGSDRangel::SWGDeviceSet normalResponse;
SWGSDRangel::SWGSuccessResponse normalResponse;
QByteArray txStr = request.getParameter("tx");
bool tx = false;
@ -726,7 +727,7 @@ void WebAPIRequestMapper::instanceDeviceSetsService(qtwebapp::HttpRequest& reque
}
else if (request.getMethod() == "DELETE")
{
SWGSDRangel::SWGDeviceSetList normalResponse;
SWGSDRangel::SWGSuccessResponse normalResponse;
int status = m_adapter->instanceDeviceSetsDelete(normalResponse, errorResponse);
response.setStatus(status);
@ -999,20 +1000,21 @@ void WebAPIRequestMapper::devicesetChannelService(
if (parseJsonBody(jsonStr, jsonObject, response))
{
SWGSDRangel::SWGChannelSettings normalResponse;
resetChannelSettings(normalResponse);
SWGSDRangel::SWGChannelSettings query;
SWGSDRangel::SWGSuccessResponse normalResponse;
resetChannelSettings(query);
if (jsonObject.contains("tx")) {
normalResponse.setTx(jsonObject["tx"].toInt());
query.setTx(jsonObject["tx"].toInt());
} else {
normalResponse.setTx(0); // assume Rx
query.setTx(0); // assume Rx
}
if (jsonObject.contains("channelType") && jsonObject["channelType"].isString())
{
normalResponse.setChannelType(new QString(jsonObject["channelType"].toString()));
query.setChannelType(new QString(jsonObject["channelType"].toString()));
int status = m_adapter->devicesetChannelPost(deviceSetIndex, normalResponse, errorResponse);
int status = m_adapter->devicesetChannelPost(deviceSetIndex, query, normalResponse, errorResponse);
response.setStatus(status);

View File

@ -53,6 +53,7 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGChannelSettings.h"
#include "SWGSuccessResponse.h"
#include "SWGErrorResponse.h"
#include "webapiadaptergui.h"
@ -561,22 +562,20 @@ int WebAPIAdapterGUI::instanceDeviceSetsGet(
int WebAPIAdapterGUI::instanceDeviceSetsPost(
bool tx,
SWGSDRangel::SWGDeviceSet& response,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{
MainWindow::MsgAddDeviceSet *msg = MainWindow::MsgAddDeviceSet::create(tx);
m_mainWindow.m_inputMessageQueue.push(msg);
usleep(100000);
const DeviceUISet *lastDeviceSet = m_mainWindow.m_deviceUIs.back();
getDeviceSet(&response,lastDeviceSet, (int) m_mainWindow.m_deviceUIs.size() - 1);
response.init();
*response.getMessage() = QString("MsgAddDeviceSet message submitted");
return 200;
}
int WebAPIAdapterGUI::instanceDeviceSetsDelete(
SWGSDRangel::SWGDeviceSetList& response,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
if (m_mainWindow.m_deviceUIs.size() > 1)
@ -584,9 +583,8 @@ int WebAPIAdapterGUI::instanceDeviceSetsDelete(
MainWindow::MsgRemoveLastDeviceSet *msg = MainWindow::MsgRemoveLastDeviceSet::create();
m_mainWindow.m_inputMessageQueue.push(msg);
usleep(100000);
getDeviceSetList(&response);
response.init();
*response.getMessage() = QString("MsgRemoveLastDeviceSet message submitted");
return 200;
}
@ -900,14 +898,15 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
int WebAPIAdapterGUI::devicesetChannelPost(
int deviceSetIndex,
SWGSDRangel::SWGChannelSettings& response,
SWGSDRangel::SWGChannelSettings& query,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
if (response.getTx() == 0) // Rx
if (query.getTx() == 0) // Rx
{
if (deviceSet->m_deviceSourceEngine == 0)
{
@ -921,7 +920,7 @@ int WebAPIAdapterGUI::devicesetChannelPost(
int index = 0;
for (; index < nbRegistrations; index++)
{
if (channelRegistrations->at(index).m_channelId == *response.getChannelType()) {
if (channelRegistrations->at(index).m_channelId == *query.getChannelType()) {
break;
}
}
@ -931,35 +930,15 @@ int WebAPIAdapterGUI::devicesetChannelPost(
MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, false);
m_mainWindow.m_inputMessageQueue.push(msg);
usleep(100000);
response.init();
*response.getMessage() = QString("MsgAddChannel message submitted");
int nbChannels = deviceSet->m_deviceSourceAPI->getNbChannels();
if (nbChannels > 0)
{
ChannelSinkAPI *channelAPI = deviceSet->m_deviceSourceAPI->getChanelAPIAt(nbChannels-1);
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("Expected channel not found");
return 500;
}
else
{
return channelAPI->webapiSettingsGet(response, *error.getMessage());
}
return 200;
}
else
{
error.init();
*error.getMessage() = QString("No channels for device set");
return 500;
}
}
else
{
error.init();
*error.getMessage() = QString("There is no receive channel with id %1").arg(*response.getChannelType());
*error.getMessage() = QString("There is no receive channel with id %1").arg(*query.getChannelType());
return 404;
}
}
@ -977,7 +956,7 @@ int WebAPIAdapterGUI::devicesetChannelPost(
int index = 0;
for (; index < nbRegistrations; index++)
{
if (channelRegistrations->at(index).m_channelId == *response.getChannelType()) {
if (channelRegistrations->at(index).m_channelId == *query.getChannelType()) {
break;
}
}
@ -987,35 +966,15 @@ int WebAPIAdapterGUI::devicesetChannelPost(
MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, true);
m_mainWindow.m_inputMessageQueue.push(msg);
usleep(100000);
response.init();
*response.getMessage() = QString("MsgAddChannel message submitted");
int nbChannels = deviceSet->m_deviceSinkAPI->getNbChannels();
if (nbChannels > 0)
{
ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(nbChannels-1);
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("Expected channel not found");
return 500;
}
else
{
return channelAPI->webapiSettingsGet(response, *error.getMessage());
}
return 200;
}
else
{
error.init();
*error.getMessage() = QString("No channels for device set");
return 500;
}
}
else
{
error.init();
*error.getMessage() = QString("There is no transmit channel with id %1").arg(*response.getChannelType());
*error.getMessage() = QString("There is no transmit channel with id %1").arg(*query.getChannelType());
return 404;
}
}

View File

@ -103,11 +103,11 @@ public:
virtual int instanceDeviceSetsPost(
bool tx,
SWGSDRangel::SWGDeviceSet& response,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int instanceDeviceSetsDelete(
SWGSDRangel::SWGDeviceSetList& response,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetGet(
@ -148,7 +148,8 @@ public:
virtual int devicesetChannelPost(
int deviceSetIndex,
SWGSDRangel::SWGChannelSettings& response,
SWGSDRangel::SWGChannelSettings& query,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int devicesetChannelSettingsGet(

View File

@ -39,5 +39,5 @@ NFMModSettings:
modAFInput:
type: integer
cwKeyer:
$ref: "http://localhost:8081/CWKeyer.yaml#/CWKeyerSettings"
$ref: "http://localhost:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings"

View File

@ -537,9 +537,9 @@ paths:
type: integer
responses:
"200":
description: On success return new device set
description: On success return informative messsage
schema:
$ref: "#/definitions/DeviceSet"
$ref: "#/definitions/SuccessResponse"
"500":
description: Error
schema:
@ -553,9 +553,9 @@ paths:
- Instance
responses:
"200":
description: On success return new list of device sets
description: On success return informative message
schema:
$ref: "#/definitions/DeviceSetList"
$ref: "#/definitions/SuccessResponse"
"404":
description: "No more device sets to be deleted"
schema:
@ -837,9 +837,9 @@ paths:
$ref: "#/definitions/ChannelSettings"
responses:
"200":
description: On success return new channel settings
description: On success return informative message
schema:
$ref: "#/definitions/ChannelSettings"
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid device set index
schema:
@ -1048,6 +1048,12 @@ definitions:
properties:
message:
type: string
SuccessResponse:
required:
- message
properties:
message:
type: string
LoggingInfo:
description: "Logging parameters setting"
properties:

View File

@ -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"
}
}
};
</script>
@ -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() {
<h2>Responses</h2>
<h3> Status: 200 - On success return new channel settings </h3>
<h3> Status: 200 - On success return informative message </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
@ -2475,9 +2483,9 @@ $(document).ready(function() {
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return new channel settings",
"description" : "On success return informative message",
"schema" : {
"$ref" : "#/definitions/ChannelSettings"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -9092,7 +9100,7 @@ public class InstanceApiExample {
InstanceApi apiInstance = new InstanceApi();
try {
DeviceSetList result = apiInstance.instanceDeviceSetsDelete();
SuccessResponse result = apiInstance.instanceDeviceSetsDelete();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsDelete");
@ -9110,7 +9118,7 @@ public class InstanceApiExample {
public static void main(String[] args) {
InstanceApi apiInstance = new InstanceApi();
try {
DeviceSetList result = apiInstance.instanceDeviceSetsDelete();
SuccessResponse result = apiInstance.instanceDeviceSetsDelete();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsDelete");
@ -9128,7 +9136,7 @@ public class InstanceApiExample {
InstanceApi *apiInstance = [[InstanceApi alloc] init];
[apiInstance instanceDeviceSetsDeleteWithCompletionHandler:
^(DeviceSetList output, NSError* error) {
^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
@ -9176,7 +9184,7 @@ namespace Example
try
{
DeviceSetList result = apiInstance.instanceDeviceSetsDelete();
SuccessResponse result = apiInstance.instanceDeviceSetsDelete();
Debug.WriteLine(result);
}
catch (Exception e)
@ -9246,7 +9254,7 @@ except ApiException as e:
<h2>Responses</h2>
<h3> Status: 200 - On success return new list of device sets </h3>
<h3> Status: 200 - On success return informative message </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
@ -9261,9 +9269,9 @@ except ApiException as e:
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return new list of device sets",
"description" : "On success return informative message",
"schema" : {
"$ref" : "#/definitions/DeviceSetList"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -9736,7 +9744,7 @@ public class InstanceApiExample {
InstanceApi apiInstance = new InstanceApi();
Integer tx = 56; // Integer | Set to non zero (true) for a Tx device set (default Rx)
try {
DeviceSet result = apiInstance.instanceDeviceSetsPost(tx);
SuccessResponse result = apiInstance.instanceDeviceSetsPost(tx);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsPost");
@ -9755,7 +9763,7 @@ public class InstanceApiExample {
InstanceApi apiInstance = new InstanceApi();
Integer tx = 56; // Integer | Set to non zero (true) for a Tx device set (default Rx)
try {
DeviceSet result = apiInstance.instanceDeviceSetsPost(tx);
SuccessResponse result = apiInstance.instanceDeviceSetsPost(tx);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceApi#instanceDeviceSetsPost");
@ -9774,7 +9782,7 @@ public class InstanceApiExample {
InstanceApi *apiInstance = [[InstanceApi alloc] init];
[apiInstance instanceDeviceSetsPostWith:tx
completionHandler: ^(DeviceSet output, NSError* error) {
completionHandler: ^(SuccessResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
@ -9827,7 +9835,7 @@ namespace Example
try
{
DeviceSet result = apiInstance.instanceDeviceSetsPost(tx);
SuccessResponse result = apiInstance.instanceDeviceSetsPost(tx);
Debug.WriteLine(result);
}
catch (Exception e)
@ -9927,7 +9935,7 @@ except ApiException as e:
</table>
<h2>Responses</h2>
<h3> Status: 200 - On success return new device set </h3>
<h3> Status: 200 - On success return informative messsage </h3>
<ul class="nav nav-tabs nav-tabs-examples" >
<li class="active">
@ -9942,9 +9950,9 @@ except ApiException as e:
<script>
$(document).ready(function() {
var schemaWrapper = {
"description" : "On success return new device set",
"description" : "On success return informative messsage",
"schema" : {
"$ref" : "#/definitions/DeviceSet"
"$ref" : "#/definitions/SuccessResponse"
}
};
var schema = schemaWrapper.schema;
@ -15002,7 +15010,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2017-12-19T01:09:19.350+01:00
Generated 2017-12-19T15:17:58.471+01:00
</div>
</div>
</div>

View File

@ -125,7 +125,7 @@ SWGDeviceSetApi::devicesetChannelPostCallback(HttpRequestWorker * worker) {
QString json(worker->response);
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit devicesetChannelPostSignal(output);

View File

@ -21,6 +21,7 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGErrorResponse.h"
#include "SWGSuccessResponse.h"
#include <QObject>
@ -69,7 +70,7 @@ private:
signals:
void devicesetChannelDeleteSignal(SWGChannelSettings* summary);
void devicesetChannelPostSignal(SWGChannelSettings* summary);
void devicesetChannelPostSignal(SWGSuccessResponse* summary);
void devicesetChannelSettingsGetSignal(SWGChannelSettings* summary);
void devicesetChannelSettingsPatchSignal(SWGChannelSettings* summary);
void devicesetChannelSettingsPutSignal(SWGChannelSettings* summary);
@ -83,7 +84,7 @@ signals:
void devicesetGetSignal(SWGDeviceSet* summary);
void devicesetChannelDeleteSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelPostSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsGetSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPatchSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPutSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);

View File

@ -327,7 +327,7 @@ SWGInstanceApi::instanceDeviceSetsDeleteCallback(HttpRequestWorker * worker) {
QString json(worker->response);
SWGDeviceSetList* output = static_cast<SWGDeviceSetList*>(create(json, QString("SWGDeviceSetList")));
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit instanceDeviceSetsDeleteSignal(output);
@ -431,7 +431,7 @@ SWGInstanceApi::instanceDeviceSetsPostCallback(HttpRequestWorker * worker) {
QString json(worker->response);
SWGDeviceSet* output = static_cast<SWGDeviceSet*>(create(json, QString("SWGDeviceSet")));
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit instanceDeviceSetsPostSignal(output);

View File

@ -18,7 +18,6 @@
#include "SWGAudioDevices.h"
#include "SWGAudioDevicesSelect.h"
#include "SWGDVSeralDevices.h"
#include "SWGDeviceSet.h"
#include "SWGDeviceSetList.h"
#include "SWGErrorResponse.h"
#include "SWGInstanceChannelsResponse.h"
@ -31,6 +30,7 @@
#include "SWGPresetImport.h"
#include "SWGPresetTransfer.h"
#include "SWGPresets.h"
#include "SWGSuccessResponse.h"
#include <QObject>
@ -99,9 +99,9 @@ signals:
void instanceChannelsSignal(SWGInstanceChannelsResponse* summary);
void instanceDVSerialPatchSignal(SWGDVSeralDevices* summary);
void instanceDeleteSignal(SWGInstanceSummaryResponse* summary);
void instanceDeviceSetsDeleteSignal(SWGDeviceSetList* summary);
void instanceDeviceSetsDeleteSignal(SWGSuccessResponse* summary);
void instanceDeviceSetsGetSignal(SWGDeviceSetList* summary);
void instanceDeviceSetsPostSignal(SWGDeviceSet* summary);
void instanceDeviceSetsPostSignal(SWGSuccessResponse* summary);
void instanceDevicesSignal(SWGInstanceDevicesResponse* summary);
void instanceLocationGetSignal(SWGLocationInformation* summary);
void instanceLocationPutSignal(SWGLocationInformation* summary);
@ -121,9 +121,9 @@ signals:
void instanceChannelsSignalE(SWGInstanceChannelsResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDVSerialPatchSignalE(SWGDVSeralDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeleteSignalE(SWGInstanceSummaryResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetsDeleteSignalE(SWGDeviceSetList* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetsDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetsGetSignalE(SWGDeviceSetList* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetsPostSignalE(SWGDeviceSet* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetsPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDevicesSignalE(SWGInstanceDevicesResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLocationGetSignalE(SWGLocationInformation* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLocationPutSignalE(SWGLocationInformation* summary, QNetworkReply::NetworkError error_type, QString& error_str);

View File

@ -48,6 +48,7 @@
#include "SWGPresets.h"
#include "SWGRtlSdrSettings.h"
#include "SWGSamplingDevice.h"
#include "SWGSuccessResponse.h"
namespace SWGSDRangel {
@ -154,6 +155,9 @@ namespace SWGSDRangel {
if(QString("SWGSamplingDevice").compare(type) == 0) {
return new SWGSamplingDevice();
}
if(QString("SWGSuccessResponse").compare(type) == 0) {
return new SWGSuccessResponse();
}
return nullptr;
}

View File

@ -0,0 +1,95 @@
/**
* 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: * In SDRangel GUI version there is no support for channel deletion. As a consequence the call to the API /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex} returns with a status code of 501 (not implemented) * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 * There is no API adapter in the targeted instance: message \"Service not available\" as text/plain is returned with a status 500. This should not happen with released code. ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGSuccessResponse.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSuccessResponse::SWGSuccessResponse(QString* json) {
init();
this->fromJson(*json);
}
SWGSuccessResponse::SWGSuccessResponse() {
init();
}
SWGSuccessResponse::~SWGSuccessResponse() {
this->cleanup();
}
void
SWGSuccessResponse::init() {
message = new QString("");
}
void
SWGSuccessResponse::cleanup() {
if(message != nullptr) {
delete message;
}
}
SWGSuccessResponse*
SWGSuccessResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSuccessResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString");
}
QString
SWGSuccessResponse::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject*
SWGSuccessResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject();
toJsonValue(QString("message"), message, obj, QString("QString"));
return obj;
}
QString*
SWGSuccessResponse::getMessage() {
return message;
}
void
SWGSuccessResponse::setMessage(QString* message) {
this->message = message;
}
}

View File

@ -0,0 +1,55 @@
/**
* 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: * In SDRangel GUI version there is no support for channel deletion. As a consequence the call to the API /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex} returns with a status code of 501 (not implemented) * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 * There is no API adapter in the targeted instance: message \"Service not available\" as text/plain is returned with a status 500. This should not happen with released code. ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGSuccessResponse.h
*
*
*/
#ifndef SWGSuccessResponse_H_
#define SWGSuccessResponse_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
namespace SWGSDRangel {
class SWGSuccessResponse: public SWGObject {
public:
SWGSuccessResponse();
SWGSuccessResponse(QString* json);
virtual ~SWGSuccessResponse();
void init();
void cleanup();
QString asJson ();
QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject &json);
SWGSuccessResponse* fromJson(QString &jsonString);
QString* getMessage();
void setMessage(QString* message);
private:
QString* message;
};
}
#endif /* SWGSuccessResponse_H_ */