mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-01 21:54:55 -04:00
REST API device and channel actions: extension of record action: implementation
This commit is contained in:
@@ -477,6 +477,23 @@ bool TestSourceGui::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (TestSourceInput::MsgFileRecord::match(message)) // API action "record" feedback
|
||||
{
|
||||
const TestSourceInput::MsgFileRecord& notif = (const TestSourceInput::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;
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceActions.h"
|
||||
#include "SWGTestSourceActions.h"
|
||||
|
||||
#include "testsourceinput.h"
|
||||
#include "device/deviceapi.h"
|
||||
@@ -512,6 +514,37 @@ int TestSourceInput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int TestSourceInput::webapiActionsPost(
|
||||
const QStringList& deviceActionsKeys,
|
||||
SWGSDRangel::SWGDeviceActions& query,
|
||||
QString& errorMessage)
|
||||
{
|
||||
SWGSDRangel::SWGTestSourceActions *swgTestSourceActions = query.getTestSourceActions();
|
||||
|
||||
if (swgTestSourceActions)
|
||||
{
|
||||
if (deviceActionsKeys.contains("record"))
|
||||
{
|
||||
bool record = swgTestSourceActions->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 TestSourceActions in query";
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
|
||||
void TestSourceInput::webapiUpdateDeviceSettings(
|
||||
TestSourceSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
|
||||
@@ -135,6 +135,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 TestSourceSettings& settings);
|
||||
|
||||
Reference in New Issue
Block a user