diff --git a/plugins/samplesource/bladerf2input/bladerf2input.cpp b/plugins/samplesource/bladerf2input/bladerf2input.cpp index 500be6130..605c83fe2 100644 --- a/plugins/samplesource/bladerf2input/bladerf2input.cpp +++ b/plugins/samplesource/bladerf2input/bladerf2input.cpp @@ -26,6 +26,8 @@ #include "SWGDeviceState.h" #include "SWGDeviceReport.h" #include "SWGBladeRF2InputReport.h" +#include "SWGDeviceActions.h" +#include "SWGBladeRF2InputActions.h" #include "device/deviceapi.h" #include "dsp/dspcommands.h" @@ -1248,6 +1250,37 @@ int BladeRF2Input::webapiRun( return 200; } +int BladeRF2Input::webapiActionsPost( + const QStringList& deviceActionsKeys, + SWGSDRangel::SWGDeviceActions& query, + QString& errorMessage) +{ + SWGSDRangel::SWGBladeRF2InputActions *swgBladeRF2InputActions = query.getBladeRf2InputActions(); + + if (swgBladeRF2InputActions) + { + if (deviceActionsKeys.contains("record")) + { + bool record = swgBladeRF2InputActions->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 BladeRF2InputActions in query"; + return 400; + } +} + void BladeRF2Input::webapiReverseSendSettings(QList& deviceSettingsKeys, const BladeRF2InputSettings& settings, bool force) { SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); diff --git a/plugins/samplesource/bladerf2input/bladerf2input.h b/plugins/samplesource/bladerf2input/bladerf2input.h index 5d3b48bb4..6cc35df1b 100644 --- a/plugins/samplesource/bladerf2input/bladerf2input.h +++ b/plugins/samplesource/bladerf2input/bladerf2input.h @@ -182,6 +182,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 BladeRF2InputSettings& settings); diff --git a/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp b/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp index 18d9d6bcb..0cc89c7e8 100644 --- a/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp +++ b/plugins/samplesource/bladerf2input/bladerf2inputgui.cpp @@ -216,6 +216,23 @@ bool BladeRF2InputGui::handleMessage(const Message& message) return true; } + else if (BladeRF2Input::MsgFileRecord::match(message)) // API action "record" feedback + { + const BladeRF2Input::MsgFileRecord& notif = (const BladeRF2Input::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;