mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 22:14:45 -04:00
Web API: implemented /sdrange/devices: Get a list of sampling devices that can be used to take part in a device set
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "httpdocrootsettings.h"
|
||||
#include "webapirequestmapper.h"
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
|
||||
@@ -71,6 +72,32 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
}
|
||||
}
|
||||
else if (path == WebAPIAdapterInterface::instanceDevicesURL)
|
||||
{
|
||||
Swagger::SWGInstanceDevicesResponse normalResponse;
|
||||
Swagger::SWGErrorResponse errorResponse;
|
||||
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
QByteArray txStr = request.getParameter("tx");
|
||||
bool tx = (txStr == "true");
|
||||
|
||||
int status = m_adapter->instanceDevices(tx, normalResponse, errorResponse);
|
||||
|
||||
if (status == 200) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
|
||||
response.setStatus(status);
|
||||
}
|
||||
else
|
||||
{
|
||||
response.write("Invalid HTTP method");
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// QDirIterator it(":", QDirIterator::Subdirectories);
|
||||
|
||||
Reference in New Issue
Block a user