mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
REST API device and channel actions: extension of record action: implementation
This commit is contained in:
@@ -25,7 +25,9 @@
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGDeviceActions.h"
|
||||
#include "SWGLocalInputReport.h"
|
||||
#include "SWGLocalInputActions.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
@@ -334,6 +336,37 @@ int LocalInput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LocalInput::webapiActionsPost(
|
||||
const QStringList& deviceActionsKeys,
|
||||
SWGSDRangel::SWGDeviceActions& query,
|
||||
QString& errorMessage)
|
||||
{
|
||||
SWGSDRangel::SWGLocalInputActions *swgLocalInputActions = query.getLocalInputActions();
|
||||
|
||||
if (swgLocalInputActions)
|
||||
{
|
||||
if (deviceActionsKeys.contains("record"))
|
||||
{
|
||||
bool record = swgLocalInputActions->getRecord() != 0;
|
||||
MsgFileRecord *msg = MsgFileRecord::create(record);
|
||||
getInputMessageQueue()->push(msg);
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
MsgFileRecord *msgToGUI = MsgFileRecord::create(record);
|
||||
getMessageQueueToGUI()->push(msgToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "Missing LocalInputActions in query";
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
|
||||
void LocalInput::webapiUpdateDeviceSettings(
|
||||
LocalInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
|
||||
@@ -165,6 +165,11 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiActionsPost(
|
||||
const QStringList& deviceActionsKeys,
|
||||
SWGSDRangel::SWGDeviceActions& actions,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const LocalInputSettings& settings);
|
||||
|
||||
@@ -203,6 +203,23 @@ bool LocalInputGui::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (LocalInput::MsgFileRecord::match(message)) // API action "record" feedback
|
||||
{
|
||||
const LocalInput::MsgFileRecord& notif = (const LocalInput::MsgFileRecord&) message;
|
||||
bool record = notif.getStartStop();
|
||||
|
||||
ui->record->blockSignals(true);
|
||||
ui->record->setChecked(record);
|
||||
|
||||
if (record) {
|
||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||
} else {
|
||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
ui->record->blockSignals(false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user