1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-15 20:28:52 -04:00

Single DeviceAPI: REST API fixes

This commit is contained in:
f4exb
2019-05-09 01:12:40 +02:00
parent 89e53cf179
commit 029e559824
14 changed files with 339 additions and 215 deletions
+30 -15
View File
@@ -212,14 +212,19 @@ void WebAPIRequestMapper::instanceDevicesService(qtwebapp::HttpRequest& request,
if (request.getMethod() == "GET")
{
QByteArray txStr = request.getParameter("tx");
bool tx = false;
QByteArray dirStr = request.getParameter("direction");
int direction = 0;
if (txStr.length() != 0) {
tx = !(txStr == "0");
if (dirStr.length() != 0)
{
bool ok;
int tmp = dirStr.toInt(&ok);
if (ok) {
direction = tmp;
}
}
int status = m_adapter->instanceDevices(tx, normalResponse, errorResponse);
int status = m_adapter->instanceDevices(direction, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
@@ -246,14 +251,19 @@ void WebAPIRequestMapper::instanceChannelsService(qtwebapp::HttpRequest& request
if (request.getMethod() == "GET")
{
QByteArray txStr = request.getParameter("tx");
bool tx = false;
QByteArray dirStr = request.getParameter("direction");
int direction = 0;
if (txStr.length() != 0) {
tx = !(txStr == "0");
if (dirStr.length() != 0)
{
bool ok;
int tmp = dirStr.toInt(&ok);
if (ok) {
direction = tmp;
}
}
int status = m_adapter->instanceChannels(tx, normalResponse, errorResponse);
int status = m_adapter->instanceChannels(direction, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
@@ -962,14 +972,19 @@ void WebAPIRequestMapper::instanceDeviceSetService(qtwebapp::HttpRequest& reques
if (request.getMethod() == "POST")
{
SWGSDRangel::SWGSuccessResponse normalResponse;
QByteArray txStr = request.getParameter("tx");
bool tx = false;
QByteArray dirStr = request.getParameter("direction");
int direction = 0;
if (txStr.length() != 0) {
tx = !(txStr == "0");
if (dirStr.length() != 0)
{
bool ok;
int tmp = dirStr.toInt(&ok);
if (ok) {
direction = tmp;
}
}
int status = m_adapter->instanceDeviceSetPost(tx, normalResponse, errorResponse);
int status = m_adapter->instanceDeviceSetPost(direction, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {