1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-07 16:34:45 -04:00

REST API device and channel actions: general implementation and RTLSDR and FileSource implementations

This commit is contained in:
f4exb
2020-03-09 04:01:23 +01:00
parent 29d86ac947
commit 74c073db4a
16 changed files with 859 additions and 2 deletions
@@ -25,6 +25,7 @@
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
#include "SWGChannelActions.h"
#include "SWGFileSourceReport.h"
#include "device/deviceapi.h"
@@ -377,6 +378,26 @@ int FileSource::webapiReportGet(
return 200;
}
int FileSource::webapiActionsPost(
SWGSDRangel::SWGChannelActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGFileSourceActions *swgFileSourceActions = query.getFileSourceActions();
if (swgFileSourceActions)
{
bool play = swgFileSourceActions->getPlay() != 0;
FileSourceBaseband::MsgConfigureFileSourceWork *msg = FileSourceBaseband::MsgConfigureFileSourceWork::create(play);
m_basebandSource->getInputMessageQueue()->push(msg);
return 202;
}
else
{
errorMessage = "Missing FileSourceActions key in JSON body";
return 400;
}
}
void FileSource::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const FileSourceSettings& settings)
{
if (response.getFileSourceSettings()->getFileName()) {