1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 14:04:46 -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
@@ -27,6 +27,7 @@
#include "SWGRtlSdrSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGRtlSdrReport.h"
#include "rtlsdrinput.h"
@@ -755,6 +756,26 @@ int RTLSDRInput::webapiReportGet(
return 200;
}
int RTLSDRInput::webapiActionsPost(
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGRtlSdrActions *swgRtlSdrActions = query.getRtlSdrActions();
if (swgRtlSdrActions)
{
bool record = swgRtlSdrActions->getRecord() != 0;
MsgFileRecord *msg = MsgFileRecord::create(record);
getInputMessageQueue()->push(msg);
return 202;
}
else
{
errorMessage = "Missing RtlSdrActions key in JSON body";
return 400;
}
}
void RTLSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
response.getRtlSdrReport()->setGains(new QList<SWGSDRangel::SWGGain*>);