mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-01 21:54:55 -04:00
Web API: /sdrangel/audio (GET) implementation (1)
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGInstanceChannelsResponse.h"
|
||||
#include "SWGAudioDevices.h"
|
||||
#include "SWGAudioDevicesSelect.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
|
||||
@@ -185,6 +187,33 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
||||
response.write("Invalid HTTP method");
|
||||
}
|
||||
}
|
||||
else if (path == WebAPIAdapterInterface::instanceAudioURL)
|
||||
{
|
||||
Swagger::SWGErrorResponse errorResponse;
|
||||
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
Swagger::SWGAudioDevices normalResponse;
|
||||
|
||||
int status = m_adapter->instanceAudioGet(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status == 200) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "PATCH")
|
||||
{
|
||||
Swagger::SWGAudioDevicesSelect normalResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
response.write("Invalid HTTP method");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// QDirIterator it(":", QDirIterator::Subdirectories);
|
||||
|
||||
Reference in New Issue
Block a user