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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user