REST API device and channel actions: extension of record action: implementation

pull/489/head
f4exb 2020-03-10 05:23:19 +01:00
rodzic ba08ff5090
commit 323e75cddd
49 zmienionych plików z 995 dodań i 3 usunięć

Wyświetl plik

@ -144,6 +144,23 @@ bool AirspyGui::handleMessage(const Message& message)
return true;
}
else if (AirspyInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const AirspyInput::MsgFileRecord& notif = (const AirspyInput::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;

Wyświetl plik

@ -26,7 +26,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGAirspyReport.h"
#include "SWGAirspyActions.h"
#include "airspyinput.h"
#include "airspyplugin.h"
@ -751,6 +753,37 @@ int AirspyInput::webapiReportGet(
return 200;
}
int AirspyInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGAirspyActions *swgAirspyActions = query.getAirspyActions();
if (swgAirspyActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgAirspyActions->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 AirspyActions in query";
return 400;
}
}
void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings)
{
response.getAirspySettings()->setCenterFrequency(settings.m_centerFrequency);

Wyświetl plik

@ -140,6 +140,11 @@ public:
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
virtual int webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& actions,
QString& errorMessage);
static void webapiFormatDeviceSettings(
SWGSDRangel::SWGDeviceSettings& response,
const AirspySettings& settings);

Wyświetl plik

@ -143,6 +143,23 @@ bool AirspyHFGui::handleMessage(const Message& message)
return true;
}
else if (AirspyHFInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const AirspyHFInput::MsgFileRecord& notif = (const AirspyHFInput::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;

Wyświetl plik

@ -25,7 +25,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGAirspyHFReport.h"
#include "SWGAirspyHFActions.h"
#include "device/deviceapi.h"
#include "dsp/filerecord.h"
@ -797,6 +799,37 @@ int AirspyHFInput::webapiReportGet(
return 200;
}
int AirspyHFInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGAirspyHFActions *swgAirspyHFActions = query.getAirspyHfActions();
if (swgAirspyHFActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgAirspyHFActions->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 AirspyHFActions in query";
return 400;
}
}
int AirspyHFInput::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage)

Wyświetl plik

@ -132,6 +132,11 @@ public:
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
virtual int webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& actions,
QString& errorMessage);
virtual int webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);

Wyświetl plik

@ -24,6 +24,8 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGBladeRF1InputActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
@ -771,6 +773,37 @@ int Bladerf1Input::webapiRun(
return 200;
}
int Bladerf1Input::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGBladeRF1InputActions *swgBladeRF1InputActions = query.getBladeRf1InputActions();
if (swgBladeRF1InputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgBladeRF1InputActions->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 BladeRF1InputActions in query";
return 400;
}
}
void Bladerf1Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();

Wyświetl plik

@ -138,6 +138,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 BladeRF1InputSettings& settings);

Wyświetl plik

@ -152,6 +152,23 @@ bool Bladerf1InputGui::handleMessage(const Message& message)
return true;
}
else if (Bladerf1Input::MsgFileRecord::match(message)) // API action "record" feedback
{
const Bladerf1Input::MsgFileRecord& notif = (const Bladerf1Input::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;

Wyświetl plik

@ -235,6 +235,23 @@ bool FCDProGui::handleMessage(const Message& message)
return true;
}
else if (FCDProInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const FCDProInput::MsgFileRecord& notif = (const FCDProInput::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;

Wyświetl plik

@ -24,6 +24,8 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGFCDProActions.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
@ -854,6 +856,37 @@ int FCDProInput::webapiRun(
return 200;
}
int FCDProInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGFCDProActions *swgFCDProActions = query.getFcdProActions();
if (swgFCDProActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgFCDProActions->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 AirspyActions in query";
return 400;
}
}
int FCDProInput::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage)

Wyświetl plik

@ -145,6 +145,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 FCDProSettings& settings);

Wyświetl plik

@ -153,6 +153,23 @@ bool FCDProPlusGui::handleMessage(const Message& message)
return true;
}
else if (FCDProPlusInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const FCDProPlusInput::MsgFileRecord& notif = (const FCDProPlusInput::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;

Wyświetl plik

@ -24,6 +24,8 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGFCDProPlusActions.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
@ -615,6 +617,37 @@ int FCDProPlusInput::webapiSettingsPutPatch(
return 200;
}
int FCDProPlusInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGFCDProPlusActions *swgFCDProPlusActions = query.getFcdProPlusActions();
if (swgFCDProPlusActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgFCDProPlusActions->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 FCDProPlusActions in query";
return 400;
}
}
void FCDProPlusInput::webapiUpdateDeviceSettings(
FCDProPlusSettings& settings,
const QStringList& deviceSettingsKeys,

Wyświetl plik

@ -145,6 +145,11 @@ public:
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage);
virtual int webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& actions,
QString& errorMessage);
static void webapiFormatDeviceSettings(
SWGSDRangel::SWGDeviceSettings& response,
const FCDProPlusSettings& settings);

Wyświetl plik

@ -24,6 +24,8 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGHackRFInputActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
@ -755,6 +757,37 @@ int HackRFInput::webapiRun(
return 200;
}
int HackRFInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGHackRFInputActions *swgHackRFInputActions = query.getHackRfInputActions();
if (swgHackRFInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgHackRFInputActions->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 HackRFInputActions in query";
return 400;
}
}
void HackRFInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const HackRFInputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();

Wyświetl plik

@ -155,6 +155,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 HackRFInputSettings& settings);

Wyświetl plik

@ -155,6 +155,23 @@ bool HackRFInputGui::handleMessage(const Message& message)
return true;
}
else if (HackRFInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const HackRFInput::MsgFileRecord& notif = (const HackRFInput::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;

Wyświetl plik

@ -287,6 +287,23 @@ bool KiwiSDRGui::handleMessage(const Message& message)
m_statusColors[status] + "; border-radius: 7px; }");
return true;
}
else if (KiwiSDRInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const KiwiSDRInput::MsgFileRecord& notif = (const KiwiSDRInput::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;

Wyświetl plik

@ -27,7 +27,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGKiwiSDRReport.h"
#include "SWGKiwiSDRActions.h"
#include "kiwisdrinput.h"
#include "device/deviceapi.h"
@ -444,6 +446,37 @@ int KiwiSDRInput::webapiReportGet(
return 200;
}
int KiwiSDRInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGKiwiSDRActions *swgKiwiSDRActions = query.getKiwiSdrActions();
if (swgKiwiSDRActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgKiwiSDRActions->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 KiwiSDRInputActions in query";
return 400;
}
}
void KiwiSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const KiwiSDRSettings& settings)
{
response.getKiwiSdrSettings()->setGain(settings.m_gain);

Wyświetl plik

@ -160,6 +160,11 @@ public:
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
virtual int webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& actions,
QString& errorMessage);
static void webapiFormatDeviceSettings(
SWGSDRangel::SWGDeviceSettings& response,
const KiwiSDRSettings& settings);

Wyświetl plik

@ -29,7 +29,9 @@
#include "SWGLimeSdrInputSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGLimeSdrInputReport.h"
#include "SWGLimeSdrInputActions.h"
#include "device/deviceapi.h"
#include "dsp/dspcommands.h"
@ -1631,6 +1633,37 @@ int LimeSDRInput::webapiRun(
return 200;
}
int LimeSDRInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGLimeSdrInputActions *swgLimeSdrInputActions = query.getLimeSdrInputActions();
if (swgLimeSdrInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgLimeSdrInputActions->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 LimeSdrInputActions in query";
return 400;
}
}
void LimeSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
bool success = false;

Wyświetl plik

@ -247,6 +247,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 LimeSDRInputSettings& settings);

Wyświetl plik

@ -256,6 +256,23 @@ bool LimeSDRInputGUI::handleMessage(const Message& message)
return true;
}
else if (LimeSDRInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const LimeSDRInput::MsgFileRecord& notif = (const LimeSDRInput::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;

Wyświetl plik

@ -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,

Wyświetl plik

@ -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);

Wyświetl plik

@ -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;

Wyświetl plik

@ -142,6 +142,23 @@ bool PerseusGui::handleMessage(const Message& message)
return true;
}
else if (PerseusInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const PerseusInput::MsgFileRecord& notif = (const PerseusInput::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;

Wyświetl plik

@ -22,7 +22,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGPerseusReport.h"
#include "SWGPerseusActions.h"
#include "dsp/filerecord.h"
#include "dsp/dspcommands.h"
@ -511,6 +513,37 @@ int PerseusInput::webapiSettingsPutPatch(
return 200;
}
int PerseusInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGPerseusActions *swgPerseusActions = query.getPerseusActions();
if (swgPerseusActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgPerseusActions->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 PerseusActions in query";
return 400;
}
}
void PerseusInput::webapiUpdateDeviceSettings(
PerseusSettings& settings,
const QStringList& deviceSettingsKeys,

Wyświetl plik

@ -140,6 +140,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 PerseusSettings& settings);

Wyświetl plik

@ -22,7 +22,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGPlutoSdrInputReport.h"
#include "SWGPlutoSdrInputActions.h"
#include "dsp/filerecord.h"
#include "dsp/dspcommands.h"
@ -929,6 +931,37 @@ int PlutoSDRInput::webapiReportGet(
return 200;
}
int PlutoSDRInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGPlutoSdrInputActions *swgPlutoSdrInputActions = query.getPlutoSdrInputActions();
if (swgPlutoSdrInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgPlutoSdrInputActions->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 PlutoSdrInputActions in query";
return 400;
}
}
void PlutoSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PlutoSDRInputSettings& settings)
{
response.getPlutoSdrInputSettings()->setCenterFrequency(settings.m_centerFrequency);

Wyświetl plik

@ -142,6 +142,11 @@ public:
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
virtual int webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& actions,
QString& errorMessage);
static void webapiFormatDeviceSettings(
SWGSDRangel::SWGDeviceSettings& response,
const PlutoSDRInputSettings& settings);

Wyświetl plik

@ -174,6 +174,23 @@ bool PlutoSDRInputGui::handleMessage(const Message& message)
return true;
}
else if (PlutoSDRInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const PlutoSDRInput::MsgFileRecord& notif = (const PlutoSDRInput::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;

Wyświetl plik

@ -25,7 +25,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGRemoteInputReport.h"
#include "SWGRemoteInputActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
@ -348,6 +350,37 @@ int RemoteInput::webapiSettingsPutPatch(
return 200;
}
int RemoteInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGRemoteInputActions *swgRemoteInputActions = query.getRemoteInputActions();
if (swgRemoteInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgRemoteInputActions->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 RemoteInputActions in query";
return 400;
}
}
void RemoteInput::webapiUpdateDeviceSettings(
RemoteInputSettings& settings,
const QStringList& deviceSettingsKeys,

Wyświetl plik

@ -313,6 +313,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 RemoteInputSettings& settings);

Wyświetl plik

@ -238,6 +238,23 @@ bool RemoteInputGui::handleMessage(const Message& message)
return true;
}
else if (RemoteInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const RemoteInput::MsgFileRecord& notif = (const RemoteInput::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;

Wyświetl plik

@ -189,6 +189,23 @@ bool SDRPlayGui::handleMessage(const Message& message)
return true;
}
else if (SDRPlayInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const SDRPlayInput::MsgFileRecord& notif = (const SDRPlayInput::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;

Wyświetl plik

@ -25,7 +25,9 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGSDRPlayReport.h"
#include "SWGSDRPlayActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
@ -700,6 +702,37 @@ int SDRPlayInput::webapiSettingsPutPatch(
return 200;
}
int SDRPlayInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGSDRPlayActions *swgSDRPlayActions = query.getSdrPlayActions();
if (swgSDRPlayActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgSDRPlayActions->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 SDRPlayActions in query";
return 400;
}
}
void SDRPlayInput::webapiUpdateDeviceSettings(
SDRPlaySettings& settings,
const QStringList& deviceSettingsKeys,

Wyświetl plik

@ -178,6 +178,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 SDRPlaySettings& settings);

Wyświetl plik

@ -25,7 +25,9 @@
#include "SWGSoapySDRInputSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGSoapySDRReport.h"
#include "SWGSoapySDRInputActions.h"
#include "device/deviceapi.h"
#include "dsp/dspcommands.h"
@ -1630,6 +1632,37 @@ int SoapySDRInput::webapiRun(
return 200;
}
int SoapySDRInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGSoapySDRInputActions *swgSoapySDRInputActions = query.getSoapySdrInputActions();
if (swgSoapySDRInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgSoapySDRInputActions->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 SoapySDRInputActions in query";
return 400;
}
}
void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SoapySDRInputSettings& settings)
{
response.getSoapySdrInputSettings()->setCenterFrequency(settings.m_centerFrequency);

Wyświetl plik

@ -203,6 +203,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 SoapySDRInputSettings& settings);

Wyświetl plik

@ -512,6 +512,23 @@ bool SoapySDRInputGui::handleMessage(const Message& message)
return true;
}
else if (SoapySDRInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const SoapySDRInput::MsgFileRecord& notif = (const SoapySDRInput::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;

Wyświetl plik

@ -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;

Wyświetl plik

@ -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,

Wyświetl plik

@ -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);

Wyświetl plik

@ -28,7 +28,9 @@
#include "SWGXtrxInputSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGXtrxInputReport.h"
#include "SWGXtrxInputActions.h"
#include "device/deviceapi.h"
#include "dsp/dspcommands.h"
@ -1511,6 +1513,37 @@ int XTRXInput::webapiRun(
return 200;
}
int XTRXInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGXtrxInputActions *swgXtrxInputActions = query.getXtrxInputActions();
if (swgXtrxInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgXtrxInputActions->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 XtrxInputActions in query";
return 400;
}
}
void XTRXInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
int ret;

Wyświetl plik

@ -238,6 +238,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 XTRXInputSettings& settings);

Wyświetl plik

@ -227,6 +227,23 @@ bool XTRXInputGUI::handleMessage(const Message& message)
return true;
}
else if (XTRXInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const XTRXInput::MsgFileRecord& notif = (const XTRXInput::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;
}
return false;
}

Wyświetl plik

@ -160,7 +160,7 @@ const QMap<QString, QString> WebAPIRequestMapper::m_channelTypeToActionsKey = {
const QMap<QString, QString> WebAPIRequestMapper::m_sourceDeviceHwIdToSettingsKey = {
{"Airspy", "airspySettings"},
{"AirspyHF", "airspyHFSettings"},
{"BladeRFI", "bladeRF1InputSettings"},
{"BladeRF1", "bladeRF1InputSettings"},
{"BladeRF2", "bladeRF2InputSettings"},
{"FCDPro", "fcdProSettings"},
{"FCDPro+", "fcdProPlusSettings"},
@ -180,7 +180,23 @@ const QMap<QString, QString> WebAPIRequestMapper::m_sourceDeviceHwIdToSettingsKe
};
const QMap<QString, QString> WebAPIRequestMapper::m_sourceDeviceHwIdToActionsKey = {
{"RTLSDR", "rtlSdrActions"}
{"Airspy", "airspyActions"},
{"AirspyHF", "airspyHFActions"},
{"BladeRF1", "bladeRF1InputActions"},
{"FCDPro", "fcdProActions"},
{"FCDPro+", "fcdProPlusActions"},
{"HackRF", "hackRFInputActions"},
{"KiwiSDR", "kiwiSDRActions"},
{"LimeSDR", "limeSdrInputActions"},
{"LocalInput", "localInputActions"},
{"Perseus", "perseusActions"},
{"PlutoSDR", "plutoSdrInputActions"},
{"RemoteInput", "remoteInputActions"},
{"RTLSDR", "rtlSdrActions"},
{"SDRplay1", "sdrPlayActions"},
{"SoapySDR", "soapySDRInputActions"},
{"TestSource", "testSourceActions"},
{"XTRX", "xtrxInputActions"}
};
const QMap<QString, QString> WebAPIRequestMapper::m_sinkDeviceHwIdToSettingsKey = {
@ -3461,11 +3477,91 @@ bool WebAPIRequestMapper::getDeviceActions(
QJsonObject actionsJsonObject = deviceActionsJson[deviceActionsKey].toObject();
deviceActionsKeys = actionsJsonObject.keys();
if (deviceActionsKey == "rtlSdrActions")
if (deviceActionsKey == "airspyActions")
{
deviceActions->setAirspyActions(new SWGSDRangel::SWGAirspyActions());
deviceActions->getAirspyActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "airspyHFActions")
{
deviceActions->setAirspyHfActions(new SWGSDRangel::SWGAirspyHFActions());
deviceActions->getAirspyHfActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "bladeRF1InputActions")
{
deviceActions->setBladeRf1InputActions(new SWGSDRangel::SWGBladeRF1InputActions());
deviceActions->getBladeRf1InputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "fcdProActions")
{
deviceActions->setFcdProActions(new SWGSDRangel::SWGFCDProActions());
deviceActions->getFcdProActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "fcdProPlusActions")
{
deviceActions->setFcdProPlusActions(new SWGSDRangel::SWGFCDProPlusActions());
deviceActions->getFcdProPlusActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "hackRFInputActions")
{
deviceActions->setHackRfInputActions(new SWGSDRangel::SWGHackRFInputActions());
deviceActions->getHackRfInputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "kiwiSDRActions")
{
deviceActions->setKiwiSdrActions(new SWGSDRangel::SWGKiwiSDRActions());
deviceActions->getKiwiSdrActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "limeSdrInputActions")
{
deviceActions->setLimeSdrInputActions(new SWGSDRangel::SWGLimeSdrInputActions());
deviceActions->getLimeSdrInputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "localInputActions")
{
deviceActions->setLocalInputActions(new SWGSDRangel::SWGLocalInputActions());
deviceActions->getLocalInputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "perseusActions")
{
deviceActions->setPerseusActions(new SWGSDRangel::SWGPerseusActions());
deviceActions->getPerseusActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "plutoSdrInputActions")
{
deviceActions->setPlutoSdrInputActions(new SWGSDRangel::SWGPlutoSdrInputActions());
deviceActions->getPlutoSdrInputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "remoteInputActions")
{
deviceActions->setRemoteInputActions(new SWGSDRangel::SWGRemoteInputActions());
deviceActions->getRemoteInputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "rtlSdrActions")
{
deviceActions->setRtlSdrActions(new SWGSDRangel::SWGRtlSdrActions());
deviceActions->getRtlSdrActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "sdrPlayActions")
{
deviceActions->setSdrPlayActions(new SWGSDRangel::SWGSDRPlayActions());
deviceActions->getSdrPlayActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "soapySDRInputActions")
{
deviceActions->setSoapySdrInputActions(new SWGSDRangel::SWGSoapySDRInputActions());
deviceActions->getSoapySdrInputActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "testSourceActions")
{
deviceActions->setTestSourceActions(new SWGSDRangel::SWGTestSourceActions());
deviceActions->getTestSourceActions()->fromJsonObject(actionsJsonObject);
}
else if (deviceActionsKey == "xtrxInputActions")
{
deviceActions->setXtrxInputActions(new SWGSDRangel::SWGXtrxInputActions());
deviceActions->getXtrxInputActions()->fromJsonObject(actionsJsonObject);
}
else
{
return false;
@ -3565,7 +3661,23 @@ void WebAPIRequestMapper::resetDeviceActions(SWGSDRangel::SWGDeviceActions& devi
{
deviceActions.cleanup();
deviceActions.setDeviceHwType(nullptr);
deviceActions.setAirspyActions(nullptr);
deviceActions.setAirspyHfActions(nullptr);
deviceActions.setBladeRf1InputActions(nullptr);
deviceActions.setFcdProActions(nullptr);
deviceActions.setFcdProPlusActions(nullptr);
deviceActions.setHackRfInputActions(nullptr);
deviceActions.setKiwiSdrActions(nullptr);
deviceActions.setLimeSdrInputActions(nullptr);
deviceActions.setLocalInputActions(nullptr);
deviceActions.setPerseusActions(nullptr);
deviceActions.setPlutoSdrInputActions(nullptr);
deviceActions.setRemoteInputActions(nullptr);
deviceActions.setRtlSdrActions(nullptr);
deviceActions.setSdrPlayActions(nullptr);
deviceActions.setSoapySdrInputActions(nullptr);
deviceActions.setTestSourceActions(nullptr);
deviceActions.setXtrxInputActions(nullptr);
}
void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings& channelSettings)