mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-14 15:33:34 -04:00
REST API: config: GET (11). Support of the rest of devices
This commit is contained in:
@@ -671,7 +671,7 @@ int AirspyInput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
void webapiUpdateDeviceSettings(
|
||||
void AirspyInput::webapiUpdateDeviceSettings(
|
||||
AirspySettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
|
||||
@@ -4,6 +4,7 @@ set(airspyhf_SOURCES
|
||||
airspyhfinput.cpp
|
||||
airspyhfplugin.cpp
|
||||
airspyhfsettings.cpp
|
||||
airspyhfwebapiadapter.cpp
|
||||
airspyhfthread.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ set(airspyhf_HEADERS
|
||||
airspyhfinput.h
|
||||
airspyhfplugin.h
|
||||
airspyhfsettings.h
|
||||
airspyhfwebapiadapter.h
|
||||
airspyhfthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -661,7 +661,26 @@ int AirspyHFInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
AirspyHFSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureAirspyHF *msg = MsgConfigureAirspyHF::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureAirspyHF *msgToGUI = MsgConfigureAirspyHF::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void AirspyHFInput::webapiUpdateDeviceSettings(
|
||||
AirspyHFSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getAirspyHfSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -719,18 +738,6 @@ int AirspyHFInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("iqCorrection")) {
|
||||
settings.m_iqCorrection = response.getAirspyHfSettings()->getIqCorrection() != 0;
|
||||
}
|
||||
|
||||
MsgConfigureAirspyHF *msg = MsgConfigureAirspyHF::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureAirspyHF *msgToGUI = MsgConfigureAirspyHF::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void AirspyHFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings)
|
||||
|
||||
@@ -141,6 +141,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const AirspyHFSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
AirspyHFSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
static const qint64 loLowLimitFreqHF;
|
||||
static const qint64 loHighLimitFreqHF;
|
||||
static const qint64 loLowLimitFreqVHF;
|
||||
@@ -164,7 +173,6 @@ private:
|
||||
bool applySettings(const AirspyHFSettings& settings, bool force);
|
||||
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
||||
void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "airspyhfplugin.h"
|
||||
#include "airspyhfwebapiadapter.h"
|
||||
#ifdef SERVER_MODE
|
||||
#include "airspyhfinput.h"
|
||||
#else
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = {
|
||||
QString("AirspyHF Input"),
|
||||
QString("4.5.2"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -140,3 +141,8 @@ DeviceSampleSource *AirspyHFPlugin::createSampleSourcePluginInstance(const QStri
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *AirspyHFPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new AirspyHFWebAPIAdapter();
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "airspyhfinput.h"
|
||||
#include "airspyhfwebapiadapter.h"
|
||||
|
||||
AirspyHFWebAPIAdapter::AirspyHFWebAPIAdapter()
|
||||
{}
|
||||
|
||||
AirspyHFWebAPIAdapter::~AirspyHFWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int AirspyHFWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
AirspyHFInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int AirspyHFWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
AirspyHFInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "airspyhfsettings.h"
|
||||
|
||||
class AirspyHFWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
AirspyHFWebAPIAdapter();
|
||||
virtual ~AirspyHFWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
AirspyHFSettings m_settings;
|
||||
};
|
||||
@@ -3,14 +3,16 @@ project(bladerf1input)
|
||||
set(bladerf1input_SOURCES
|
||||
bladerf1input.cpp
|
||||
bladerf1inputplugin.cpp
|
||||
bladerf1inputsettings.cpp
|
||||
bladerf1inputsettings.cpp
|
||||
bladerf1inputwebapiadapter.cpp
|
||||
bladerf1inputthread.cpp
|
||||
)
|
||||
|
||||
set(bladerf1input_HEADERS
|
||||
bladerf1input.h
|
||||
bladerf1inputplugin.h
|
||||
bladerf1inputsettings.h
|
||||
bladerf1inputsettings.h
|
||||
bladerf1inputwebapiadapter.h
|
||||
bladerf1inputthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -667,7 +667,26 @@ int Bladerf1Input::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
BladeRF1InputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureBladerf1 *msg = MsgConfigureBladerf1::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureBladerf1 *msgToGUI = MsgConfigureBladerf1::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void Bladerf1Input::webapiUpdateDeviceSettings(
|
||||
BladeRF1InputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getBladeRf1InputSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -722,18 +741,6 @@ int Bladerf1Input::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf1InputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureBladerf1 *msg = MsgConfigureBladerf1::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureBladerf1 *msgToGUI = MsgConfigureBladerf1::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int Bladerf1Input::webapiRunGet(
|
||||
|
||||
@@ -138,6 +138,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const BladeRF1InputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
BladeRF1InputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
@@ -155,7 +164,6 @@ private:
|
||||
void closeDevice();
|
||||
bool applySettings(const BladeRF1InputSettings& settings, bool force);
|
||||
bladerf_lna_gain getLnaGain(int lnaGain);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1InputSettings& settings);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <libbladeRF.h>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "bladerf1inputwebapiadapter.h"
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
#include "bladerf1input.h"
|
||||
@@ -150,3 +151,7 @@ DeviceSampleSource *Blderf1InputPlugin::createSampleSourcePluginInstance(const Q
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *Blderf1InputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new BladeRF1InputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "bladerf1input.h"
|
||||
#include "bladerf1inputwebapiadapter.h"
|
||||
|
||||
BladeRF1InputWebAPIAdapter::BladeRF1InputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
BladeRF1InputWebAPIAdapter::~BladeRF1InputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int BladeRF1InputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
Bladerf1Input::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int BladeRF1InputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
Bladerf1Input::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "bladerf1inputsettings.h"
|
||||
|
||||
class BladeRF1InputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
BladeRF1InputWebAPIAdapter();
|
||||
virtual ~BladeRF1InputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
BladeRF1InputSettings m_settings;
|
||||
};
|
||||
@@ -3,14 +3,16 @@ project(bladerf2input)
|
||||
set(bladerf2input_SOURCES
|
||||
bladerf2input.cpp
|
||||
bladerf2inputplugin.cpp
|
||||
bladerf2inputsettings.cpp
|
||||
bladerf2inputsettings.cpp
|
||||
bladerf2inputwebapiadapter.cpp
|
||||
bladerf2inputthread.cpp
|
||||
)
|
||||
|
||||
set(bladerf2input_HEADERS
|
||||
bladerf2input.h
|
||||
bladerf2inputplugin.h
|
||||
bladerf2inputsettings.h
|
||||
bladerf2inputsettings.h
|
||||
bladerf2inputwebapiadapter.h
|
||||
bladerf2inputthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -1056,7 +1056,26 @@ int BladeRF2Input::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
BladeRF2InputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureBladeRF2 *msg = MsgConfigureBladeRF2::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureBladeRF2 *msgToGUI = MsgConfigureBladeRF2::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void BladeRF2Input::webapiUpdateDeviceSettings(
|
||||
BladeRF2InputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getBladeRf2InputSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -1111,18 +1130,6 @@ int BladeRF2Input::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf2InputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureBladeRF2 *msg = MsgConfigureBladeRF2::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureBladeRF2 *msgToGUI = MsgConfigureBladeRF2::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int BladeRF2Input::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage)
|
||||
|
||||
@@ -182,6 +182,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const BladeRF2InputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
BladeRF2InputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
@@ -201,7 +210,6 @@ private:
|
||||
void moveThreadToBuddy();
|
||||
bool applySettings(const BladeRF2InputSettings& settings, bool force = false);
|
||||
bool setDeviceCenterFrequency(struct bladerf *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF2InputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2InputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <libbladeRF.h>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "bladerf2inputwebapiadapter.h"
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
#include "bladerf2input.h"
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
const PluginDescriptor Blderf2InputPlugin::m_pluginDescriptor = {
|
||||
QString("BladeRF2 Input"),
|
||||
QString("4.5.4"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -120,7 +121,7 @@ PluginInstanceGUI* Blderf2InputPlugin::createSampleSourcePluginInstanceGUI(
|
||||
{
|
||||
(void) sourceId;
|
||||
(void) widget;
|
||||
(void) deviceUISet;
|
||||
(void) deviceUISet;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
@@ -155,6 +156,7 @@ DeviceSampleSource *Blderf2InputPlugin::createSampleSourcePluginInstance(const Q
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DeviceWebAPIAdapter *Blderf2InputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new BladeRF2InputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "bladerf2input.h"
|
||||
#include "bladerf2inputwebapiadapter.h"
|
||||
|
||||
BladeRF2InputWebAPIAdapter::BladeRF2InputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
BladeRF2InputWebAPIAdapter::~BladeRF2InputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int BladeRF2InputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
BladeRF2Input::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int BladeRF2InputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
BladeRF2Input::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "bladerf2inputsettings.h"
|
||||
|
||||
class BladeRF2InputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
BladeRF2InputWebAPIAdapter();
|
||||
virtual ~BladeRF2InputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
BladeRF2InputSettings m_settings;
|
||||
};
|
||||
@@ -3,14 +3,16 @@ project(fcdpro)
|
||||
set(fcdpro_SOURCES
|
||||
fcdproinput.cpp
|
||||
fcdproplugin.cpp
|
||||
fcdprosettings.cpp
|
||||
fcdprosettings.cpp
|
||||
fcdprowebapiadapter.cpp
|
||||
fcdprothread.cpp
|
||||
)
|
||||
|
||||
set(fcdpro_HEADERS
|
||||
fcdproinput.h
|
||||
fcdproplugin.h
|
||||
fcdprosettings.h
|
||||
fcdprosettings.h
|
||||
fcdprowebapiadapter.h
|
||||
fcdprothread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -873,7 +873,26 @@ int FCDProInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
FCDProSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureFCDPro *msg = MsgConfigureFCDPro::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureFCDPro *msgToGUI = MsgConfigureFCDPro::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void FCDProInput::webapiUpdateDeviceSettings(
|
||||
FCDProSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getFcdProSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -961,18 +980,6 @@ int FCDProInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getFcdProSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureFCDPro *msg = MsgConfigureFCDPro::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureFCDPro *msgToGUI = MsgConfigureFCDPro::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void FCDProInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FCDProSettings& settings)
|
||||
|
||||
@@ -145,6 +145,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const FCDProSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
FCDProSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
void set_center_freq(double freq);
|
||||
void set_bias_t(bool on);
|
||||
void set_lnaGain(int index);
|
||||
@@ -184,7 +193,6 @@ private:
|
||||
void closeFCDAudio();
|
||||
void applySettings(const FCDProSettings& settings, bool force);
|
||||
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FCDProSettings& settings);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const FCDProSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "fcdproplugin.h"
|
||||
#include "fcdprowebapiadapter.h"
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
#include "fcdproinput.h"
|
||||
@@ -122,3 +123,8 @@ DeviceSampleSource *FCDProPlugin::createSampleSourcePluginInstance(const QString
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *FCDProPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new FCDProWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
private:
|
||||
static const PluginDescriptor m_pluginDescriptor;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "fcdproinput.h"
|
||||
#include "fcdprowebapiadapter.h"
|
||||
|
||||
FCDProWebAPIAdapter::FCDProWebAPIAdapter()
|
||||
{}
|
||||
|
||||
FCDProWebAPIAdapter::~FCDProWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int FCDProWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
FCDProInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int FCDProWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
FCDProInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "fcdprosettings.h"
|
||||
|
||||
class FCDProWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
FCDProWebAPIAdapter();
|
||||
virtual ~FCDProWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
FCDProSettings m_settings;
|
||||
};
|
||||
@@ -3,14 +3,16 @@ project(fcdproplus)
|
||||
set(fcdproplus_SOURCES
|
||||
fcdproplusinput.cpp
|
||||
fcdproplusplugin.cpp
|
||||
fcdproplussettings.cpp
|
||||
fcdproplussettings.cpp
|
||||
fcdpropluswebapiadapter.cpp
|
||||
fcdproplusthread.cpp
|
||||
)
|
||||
|
||||
set(fcdproplus_HEADERS
|
||||
fcdproplusinput.h
|
||||
fcdproplusplugin.h
|
||||
fcdproplussettings.h
|
||||
fcdproplussettings.h
|
||||
fcdpropluswebapiadapter.h
|
||||
fcdproplusthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -600,7 +600,26 @@ int FCDProPlusInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
FCDProPlusSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureFCDProPlus *msg = MsgConfigureFCDProPlus::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureFCDProPlus *msgToGUI = MsgConfigureFCDProPlus::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void FCDProPlusInput::webapiUpdateDeviceSettings(
|
||||
FCDProPlusSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getFcdProPlusSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -661,18 +680,6 @@ int FCDProPlusInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getFcdProPlusSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureFCDProPlus *msg = MsgConfigureFCDProPlus::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureFCDProPlus *msgToGUI = MsgConfigureFCDProPlus::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void FCDProPlusInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FCDProPlusSettings& settings)
|
||||
|
||||
@@ -145,6 +145,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const FCDProPlusSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
FCDProPlusSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
void set_center_freq(double freq);
|
||||
void set_bias_t(bool on);
|
||||
void set_lna_gain(bool on);
|
||||
@@ -172,7 +181,6 @@ private:
|
||||
bool openFCDAudio(const char *filename);
|
||||
void closeFCDAudio();
|
||||
void applySettings(const FCDProPlusSettings& settings, bool force);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FCDProPlusSettings& settings);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const FCDProPlusSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "fcdproplusplugin.h"
|
||||
#include "fcdpropluswebapiadapter.h"
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
#include "fcdproplusinput.h"
|
||||
@@ -124,3 +125,8 @@ DeviceSampleSource *FCDProPlusPlugin::createSampleSourcePluginInstance(const QSt
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *FCDProPlusPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new FCDProPlusWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "fcdproplusinput.h"
|
||||
#include "fcdpropluswebapiadapter.h"
|
||||
|
||||
FCDProPlusWebAPIAdapter::FCDProPlusWebAPIAdapter()
|
||||
{}
|
||||
|
||||
FCDProPlusWebAPIAdapter::~FCDProPlusWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int FCDProPlusWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
FCDProPlusInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int FCDProPlusWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
FCDProPlusInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "fcdproplussettings.h"
|
||||
|
||||
class FCDProPlusWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
FCDProPlusWebAPIAdapter();
|
||||
virtual ~FCDProPlusWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
FCDProPlusSettings m_settings;
|
||||
};
|
||||
@@ -4,14 +4,16 @@ set(fileinput_SOURCES
|
||||
fileinput.cpp
|
||||
fileinputplugin.cpp
|
||||
fileinputthread.cpp
|
||||
fileinputsettings.cpp
|
||||
fileinputsettings.cpp
|
||||
fileinputwebapiadapter.cpp
|
||||
)
|
||||
|
||||
set(fileinput_HEADERS
|
||||
fileinput.h
|
||||
fileinputplugin.h
|
||||
fileinputthread.h
|
||||
fileinputsettings.h
|
||||
fileinputsettings.h
|
||||
fileinputwebapiadapter.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
||||
@@ -465,7 +465,26 @@ int FileInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
FileInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureFileInput *msg = MsgConfigureFileInput::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureFileInput *msgToGUI = MsgConfigureFileInput::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void FileInput::webapiUpdateDeviceSettings(
|
||||
FileInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("fileName")) {
|
||||
settings.m_fileName = *response.getFileInputSettings()->getFileName();
|
||||
}
|
||||
@@ -487,18 +506,6 @@ int FileInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getFileInputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureFileInput *msg = MsgConfigureFileInput::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureFileInput *msgToGUI = MsgConfigureFileInput::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int FileInput::webapiRunGet(
|
||||
|
||||
@@ -319,6 +319,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const FileInputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
FileInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
@@ -339,7 +348,6 @@ public:
|
||||
void openFileStream();
|
||||
void seekFileStream(int seekMillis);
|
||||
bool applySettings(const FileInputSettings& settings, bool force = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FileInputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const FileInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#include "fileinputgui.h"
|
||||
#endif
|
||||
#include "fileinputplugin.h"
|
||||
#include "fileinputwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor FileInputPlugin::m_pluginDescriptor = {
|
||||
QString("File device input"),
|
||||
QString("4.11.0"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -115,3 +116,7 @@ DeviceSampleSource *FileInputPlugin::createSampleSourcePluginInstance(const QStr
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *FileInputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new FileInputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "fileinput.h"
|
||||
#include "fileinputwebapiadapter.h"
|
||||
|
||||
FileInputWebAPIAdapter::FileInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
FileInputWebAPIAdapter::~FileInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int FileInputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
FileInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int FileInputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
FileInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "fileinputsettings.h"
|
||||
|
||||
class FileInputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
FileInputWebAPIAdapter();
|
||||
virtual ~FileInputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
FileInputSettings m_settings;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ set(hackrfinput_SOURCES
|
||||
hackrfinput.cpp
|
||||
hackrfinputplugin.cpp
|
||||
hackrfinputsettings.cpp
|
||||
hackrfinputwebapiadapter.cpp
|
||||
hackrfinputthread.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ set(hackrfinput_HEADERS
|
||||
hackrfinput.h
|
||||
hackrfinputplugin.h
|
||||
hackrfinputsettings.h
|
||||
hackrfinputwebapiadapter.h
|
||||
hackrfinputthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -602,7 +602,26 @@ int HackRFInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
HackRFInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureHackRF *msg = MsgConfigureHackRF::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureHackRF *msgToGUI = MsgConfigureHackRF::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void HackRFInput::webapiUpdateDeviceSettings(
|
||||
HackRFInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getHackRfInputSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -657,18 +676,6 @@ int HackRFInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getHackRfInputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureHackRF *msg = MsgConfigureHackRF::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureHackRF *msgToGUI = MsgConfigureHackRF::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void HackRFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const HackRFInputSettings& settings)
|
||||
|
||||
@@ -155,6 +155,14 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const HackRFInputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
HackRFInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
@@ -173,7 +181,6 @@ private:
|
||||
void closeDevice();
|
||||
bool applySettings(const HackRFInputSettings& settings, bool force);
|
||||
void setDeviceCenterFrequency(quint64 freq, qint32 LOppmTenths);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const HackRFInputSettings& settings);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const HackRFInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
|
||||
@@ -28,10 +28,11 @@
|
||||
#include "hackrfinputgui.h"
|
||||
#endif
|
||||
#include "hackrfinputplugin.h"
|
||||
#include "hackrfinputwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
|
||||
QString("HackRF Input"),
|
||||
QString("4.5.4"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -165,3 +166,8 @@ DeviceSampleSource *HackRFInputPlugin::createSampleSourcePluginInstance(const QS
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *HackRFInputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new HackRFInputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "hackrfinput.h"
|
||||
#include "hackrfinputwebapiadapter.h"
|
||||
|
||||
HackRFInputWebAPIAdapter::HackRFInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
HackRFInputWebAPIAdapter::~HackRFInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int HackRFInputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
HackRFInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int HackRFInputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
HackRFInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "hackrfinputsettings.h"
|
||||
|
||||
class HackRFInputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
HackRFInputWebAPIAdapter();
|
||||
virtual ~HackRFInputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
HackRFInputSettings m_settings;
|
||||
};
|
||||
@@ -4,14 +4,16 @@ set(kiwisdr_SOURCES
|
||||
kiwisdrinput.cpp
|
||||
kiwisdrplugin.cpp
|
||||
kiwisdrworker.cpp
|
||||
kiwisdrsettings.cpp
|
||||
kiwisdrsettings.cpp
|
||||
kiwisdrwebapiadapter.cpp
|
||||
)
|
||||
|
||||
set(kiwisdr_HEADERS
|
||||
kiwisdrinput.h
|
||||
kiwisdrplugin.h
|
||||
kiwisdrworker.h
|
||||
kiwisdrsettings.h
|
||||
kiwisdrsettings.h
|
||||
kiwisdrwebapiadapter.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
||||
@@ -381,7 +381,26 @@ int KiwiSDRInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
KiwiSDRSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureKiwiSDR *msg = MsgConfigureKiwiSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureKiwiSDR *msgToGUI = MsgConfigureKiwiSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void KiwiSDRInput::webapiUpdateDeviceSettings(
|
||||
KiwiSDRSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("gain")) {
|
||||
settings.m_gain = response.getKiwiSdrSettings()->getGain();
|
||||
}
|
||||
@@ -412,18 +431,6 @@ int KiwiSDRInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getKiwiSdrSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureKiwiSDR *msg = MsgConfigureKiwiSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureKiwiSDR *msgToGUI = MsgConfigureKiwiSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int KiwiSDRInput::webapiReportGet(
|
||||
|
||||
@@ -160,6 +160,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const KiwiSDRSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
KiwiSDRSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
@@ -175,7 +184,6 @@ private:
|
||||
|
||||
int getStatus() const;
|
||||
bool applySettings(const KiwiSDRSettings& settings, bool force);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const KiwiSDRSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const KiwiSDRSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -27,10 +27,11 @@
|
||||
#include "kiwisdrgui.h"
|
||||
#endif
|
||||
#include "kiwisdrplugin.h"
|
||||
#include "kiwisdrwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor KiwiSDRPlugin::m_pluginDescriptor = {
|
||||
QString("KiwiSDR input"),
|
||||
QString("4.10.0"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Vort (c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -113,3 +114,7 @@ DeviceSampleSource *KiwiSDRPlugin::createSampleSourcePluginInstance(const QStrin
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *KiwiSDRPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new KiwiSDRWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "kiwisdrinput.h"
|
||||
#include "kiwisdrwebapiadapter.h"
|
||||
|
||||
KiwiSDRWebAPIAdapter::KiwiSDRWebAPIAdapter()
|
||||
{}
|
||||
|
||||
KiwiSDRWebAPIAdapter::~KiwiSDRWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int KiwiSDRWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
KiwiSDRInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int KiwiSDRWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
KiwiSDRInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "kiwisdrsettings.h"
|
||||
|
||||
class KiwiSDRWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
KiwiSDRWebAPIAdapter();
|
||||
virtual ~KiwiSDRWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
KiwiSDRSettings m_settings;
|
||||
};
|
||||
@@ -3,14 +3,16 @@ project(limesdrinput)
|
||||
set(limesdrinput_SOURCES
|
||||
limesdrinput.cpp
|
||||
limesdrinputplugin.cpp
|
||||
limesdrinputsettings.cpp
|
||||
limesdrinputsettings.cpp
|
||||
limesdrinputwebapiadapter.cpp
|
||||
limesdrinputthread.cpp
|
||||
)
|
||||
|
||||
set(limesdrinput_HEADERS
|
||||
limesdrinput.h
|
||||
limesdrinputplugin.h
|
||||
limesdrinputsettings.h
|
||||
limesdrinputsettings.h
|
||||
limesdrinputwebapiadapter.h
|
||||
limesdrinputthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -1442,7 +1442,26 @@ int LimeSDRInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
LimeSDRInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureLimeSDR *msg = MsgConfigureLimeSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureLimeSDR *msgToGUI = MsgConfigureLimeSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void LimeSDRInput::webapiUpdateDeviceSettings(
|
||||
LimeSDRInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("antennaPath")) {
|
||||
settings.m_antennaPath = (LimeSDRInputSettings::PathRFE) response.getLimeSdrInputSettings()->getAntennaPath();
|
||||
}
|
||||
@@ -1527,18 +1546,6 @@ int LimeSDRInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getLimeSdrInputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureLimeSDR *msg = MsgConfigureLimeSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureLimeSDR *msgToGUI = MsgConfigureLimeSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void LimeSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LimeSDRInputSettings& settings)
|
||||
|
||||
@@ -247,6 +247,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const LimeSDRInputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
LimeSDRInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
std::size_t getChannelIndex();
|
||||
void getLORange(float& minF, float& maxF) const;
|
||||
void getSRRange(float& minF, float& maxF) const;
|
||||
@@ -277,7 +286,6 @@ private:
|
||||
void suspendTxBuddies();
|
||||
void resumeTxBuddies();
|
||||
bool applySettings(const LimeSDRInputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LimeSDRInputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
#include "limesdrinputgui.h"
|
||||
#endif
|
||||
#include "limesdrinputplugin.h"
|
||||
#include "limesdrinputwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor LimeSDRInputPlugin::m_pluginDescriptor = {
|
||||
QString("LimeSDR Input"),
|
||||
QString("4.5.5"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -171,3 +172,7 @@ DeviceSampleSource *LimeSDRInputPlugin::createSampleSourcePluginInstance(const Q
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *LimeSDRInputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new LimeSDRInputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "limesdrinput.h"
|
||||
#include "limesdrinputwebapiadapter.h"
|
||||
|
||||
LimeSDRInputWebAPIAdapter::LimeSDRInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
LimeSDRInputWebAPIAdapter::~LimeSDRInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int LimeSDRInputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
LimeSDRInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LimeSDRInputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
LimeSDRInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "limesdrinputsettings.h"
|
||||
|
||||
class LimeSDRInputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
LimeSDRInputWebAPIAdapter();
|
||||
virtual ~LimeSDRInputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
LimeSDRInputSettings m_settings;
|
||||
};
|
||||
@@ -3,12 +3,14 @@ project(localinput)
|
||||
set(localinput_SOURCES
|
||||
localinput.cpp
|
||||
localinputsettings.cpp
|
||||
localinputwebapiadapter.cpp
|
||||
localinputplugin.cpp
|
||||
)
|
||||
|
||||
set(localinput_HEADERS
|
||||
localinput.h
|
||||
localinputsettings.h
|
||||
localinputwebapiadapter.h
|
||||
localinputplugin.h
|
||||
)
|
||||
|
||||
|
||||
@@ -319,7 +319,26 @@ int LocalInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
LocalInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureLocalInput *msg = MsgConfigureLocalInput::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureLocalInput *msgToGUI = MsgConfigureLocalInput::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void LocalInput::webapiUpdateDeviceSettings(
|
||||
LocalInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("dcBlock")) {
|
||||
settings.m_dcBlock = response.getLocalInputSettings()->getDcBlock() != 0;
|
||||
}
|
||||
@@ -341,18 +360,6 @@ int LocalInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getLocalInputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureLocalInput *msg = MsgConfigureLocalInput::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureLocalInput *msgToGUI = MsgConfigureLocalInput::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void LocalInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LocalInputSettings& settings)
|
||||
|
||||
@@ -165,6 +165,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const LocalInputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
LocalInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
@@ -178,7 +187,6 @@ private:
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
void applySettings(const LocalInputSettings& settings, bool force = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LocalInputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LocalInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#include "localinputgui.h"
|
||||
#endif
|
||||
#include "localinputplugin.h"
|
||||
#include "localinputwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor LocalInputPlugin::m_pluginDescriptor = {
|
||||
QString("Local device input"),
|
||||
QString("4.6.0"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -114,3 +115,8 @@ DeviceSampleSource *LocalInputPlugin::createSampleSourcePluginInstance(const QSt
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *LocalInputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new LocalInputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "localinput.h"
|
||||
#include "localinputwebapiadapter.h"
|
||||
|
||||
LocalInputWebAPIAdapter::LocalInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
LocalInputWebAPIAdapter::~LocalInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int LocalInputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
LocalInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LocalInputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
LocalInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "localinputsettings.h"
|
||||
|
||||
class LocalInputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
LocalInputWebAPIAdapter();
|
||||
virtual ~LocalInputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
LocalInputSettings m_settings;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ set(perseus_SOURCES
|
||||
perseusinput.cpp
|
||||
perseusplugin.cpp
|
||||
perseussettings.cpp
|
||||
perseuswebapiadapter.cpp
|
||||
perseusthread.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ set(perseus_HEADERS
|
||||
perseusinput.h
|
||||
perseusplugin.h
|
||||
perseussettings.h
|
||||
perseuswebapiadapter.h
|
||||
perseusthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -496,7 +496,26 @@ int PerseusInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
PerseusSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigurePerseus *msg = MsgConfigurePerseus::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePerseus *msgToGUI = MsgConfigurePerseus::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void PerseusInput::webapiUpdateDeviceSettings(
|
||||
PerseusSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getPerseusSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -544,18 +563,6 @@ int PerseusInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getPerseusSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigurePerseus *msg = MsgConfigurePerseus::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePerseus *msgToGUI = MsgConfigurePerseus::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PerseusInput::webapiReportGet(
|
||||
|
||||
@@ -140,6 +140,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const PerseusSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
PerseusSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
const std::vector<uint32_t>& getSampleRates() const { return m_sampleRates; }
|
||||
|
||||
private:
|
||||
@@ -158,7 +167,6 @@ private:
|
||||
void closeDevice();
|
||||
void setDeviceCenterFrequency(quint64 freq, const PerseusSettings& settings);
|
||||
bool applySettings(const PerseusSettings& settings, bool force = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PerseusSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "util/simpleserializer.h"
|
||||
#include "perseus/deviceperseus.h"
|
||||
#include "perseusplugin.h"
|
||||
#include "perseuswebapiadapter.h"
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
#include "perseusinput.h"
|
||||
@@ -31,7 +32,7 @@
|
||||
|
||||
const PluginDescriptor PerseusPlugin::m_pluginDescriptor = {
|
||||
QString("Perseus Input"),
|
||||
QString("4.5.2"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -130,3 +131,8 @@ DeviceSampleSource *PerseusPlugin::createSampleSourcePluginInstance(const QStrin
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *PerseusPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new PerseusWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "perseusinput.h"
|
||||
#include "perseuswebapiadapter.h"
|
||||
|
||||
PerseusWebAPIAdapter::PerseusWebAPIAdapter()
|
||||
{}
|
||||
|
||||
PerseusWebAPIAdapter::~PerseusWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int PerseusWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
PerseusInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PerseusWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
PerseusInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "perseussettings.h"
|
||||
|
||||
class PerseusWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
PerseusWebAPIAdapter();
|
||||
virtual ~PerseusWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
PerseusSettings m_settings;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ set(plutosdrinput_SOURCES
|
||||
plutosdrinput.cpp
|
||||
plutosdrinputplugin.cpp
|
||||
plutosdrinputsettings.cpp
|
||||
plutosdrinputwebapiadapter.cpp
|
||||
plutosdrinputthread.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ set(plutosdrinput_HEADERS
|
||||
plutosdrinput.h
|
||||
plutosdrinputplugin.h
|
||||
plutosdrinputsettings.h
|
||||
plutosdrinputwebapiadapter.h
|
||||
plutosdrinputthread.h
|
||||
)
|
||||
|
||||
|
||||
@@ -795,7 +795,26 @@ int PlutoSDRInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
PlutoSDRInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigurePlutoSDR *msg = MsgConfigurePlutoSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePlutoSDR *msgToGUI = MsgConfigurePlutoSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void webapiUpdateDeviceSettings(
|
||||
PlutoSDRInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getPlutoSdrInputSettings()->getCenterFrequency();
|
||||
}
|
||||
@@ -877,18 +896,6 @@ int PlutoSDRInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getPlutoSdrInputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigurePlutoSDR *msg = MsgConfigurePlutoSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePlutoSDR *msgToGUI = MsgConfigurePlutoSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PlutoSDRInput::webapiReportGet(
|
||||
@@ -920,7 +927,7 @@ void PlutoSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
|
||||
response.getPlutoSdrInputSettings()->setLog2Decim(settings.m_log2Decim);
|
||||
response.getPlutoSdrInputSettings()->setLpfBw(settings.m_lpfBW);
|
||||
response.getPlutoSdrInputSettings()->setGain(settings.m_gain);
|
||||
response.getPlutoSdrInputSettings()->setAntennaPath((int) m_settings.m_antennaPath);
|
||||
response.getPlutoSdrInputSettings()->setAntennaPath((int) settings.m_antennaPath);
|
||||
response.getPlutoSdrInputSettings()->setGainMode((int) settings.m_gainMode);
|
||||
response.getPlutoSdrInputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
|
||||
response.getPlutoSdrInputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
|
||||
|
||||
@@ -142,6 +142,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const PlutoSDRInputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
PlutoSDRInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
uint32_t getADCSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
|
||||
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
|
||||
void getRSSI(std::string& rssiStr);
|
||||
@@ -170,7 +179,6 @@ public:
|
||||
void suspendBuddies();
|
||||
void resumeBuddies();
|
||||
bool applySettings(const PlutoSDRInputSettings& settings, bool force = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PlutoSDRInputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDRInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "plutosdrinputgui.h"
|
||||
#endif
|
||||
#include "plutosdrinputplugin.h"
|
||||
#include "plutosdrinputwebapiadapter.h"
|
||||
|
||||
class DeviceAPI;
|
||||
|
||||
@@ -131,3 +132,7 @@ DeviceSampleSource *PlutoSDRInputPlugin::createSampleSourcePluginInstance(const
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *PlutoSDRInputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new PlutoSDRInputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "plutosdrinput.h"
|
||||
#include "plutosdrinputwebapiadapter.h"
|
||||
|
||||
PlutoSDRInputWebAPIAdapter::PlutoSDRInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
PlutoSDRInputWebAPIAdapter::~PlutoSDRInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int PlutoSDRInputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
PlutoSDRInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PlutoSDRInputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
PlutoSDRInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "plutosdrinputsettings.h"
|
||||
|
||||
class PlutoSDRInputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
PlutoSDRInputWebAPIAdapter();
|
||||
virtual ~PlutoSDRInputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
PlutoSDRInputSettings m_settings;
|
||||
};
|
||||
@@ -14,6 +14,7 @@ set(remoteinput_SOURCES
|
||||
remoteinputudphandler.cpp
|
||||
remoteinput.cpp
|
||||
remoteinputsettings.cpp
|
||||
remoteinputwebapiadapter.cpp
|
||||
remoteinputplugin.cpp
|
||||
)
|
||||
|
||||
@@ -22,6 +23,7 @@ set(remoteinput_HEADERS
|
||||
remoteinputudphandler.h
|
||||
remoteinput.h
|
||||
remoteinputsettings.h
|
||||
remoteinputwebapiadapter.h
|
||||
remoteinputplugin.h
|
||||
)
|
||||
|
||||
|
||||
@@ -333,7 +333,26 @@ int RemoteInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
RemoteInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureRemoteInput *msg = MsgConfigureRemoteInput::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRemoteInput *msgToGUI = MsgConfigureRemoteInput::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void webapiUpdateDeviceSettings(
|
||||
RemoteInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("apiAddress")) {
|
||||
settings.m_apiAddress = *response.getRemoteInputSettings()->getApiAddress();
|
||||
}
|
||||
@@ -367,18 +386,6 @@ int RemoteInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getRemoteInputSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureRemoteInput *msg = MsgConfigureRemoteInput::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRemoteInput *msgToGUI = MsgConfigureRemoteInput::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void RemoteInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteInputSettings& settings)
|
||||
|
||||
@@ -313,6 +313,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const RemoteInputSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
RemoteInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
@@ -326,7 +335,6 @@ private:
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
void applySettings(const RemoteInputSettings& settings, bool force = false);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteInputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#include "remoteinputgui.h"
|
||||
#endif
|
||||
#include "remoteinputplugin.h"
|
||||
#include "remoteinputwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor RemoteInputPlugin::m_pluginDescriptor = {
|
||||
QString("Remote device input"),
|
||||
QString("4.5.6"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -114,3 +115,8 @@ DeviceSampleSource *RemoteInputPlugin::createSampleSourcePluginInstance(const QS
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *RemoteInputPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new RemoteInputWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "remoteinput.h"
|
||||
#include "remoteinputwebapiadapter.h"
|
||||
|
||||
RemoteInputWebAPIAdapter::RemoteInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
RemoteInputWebAPIAdapter::~RemoteInputWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int RemoteInputWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
RemoteInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int RemoteInputWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
RemoteInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "remoteinputsettings.h"
|
||||
|
||||
class RemoteInputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
RemoteInputWebAPIAdapter();
|
||||
virtual ~RemoteInputWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
RemoteInputSettings m_settings;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ set(rtlsdr_SOURCES
|
||||
rtlsdrinput.cpp
|
||||
rtlsdrplugin.cpp
|
||||
rtlsdrsettings.cpp
|
||||
rtlsdrwebapiadapter.cpp
|
||||
rtlsdrthread.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ set(rtlsdr_HEADERS
|
||||
rtlsdrinput.h
|
||||
rtlsdrplugin.h
|
||||
rtlsdrsettings.h
|
||||
rtlsdrwebapiadapter.h
|
||||
rtlsdrthread.h
|
||||
)
|
||||
include_directories(
|
||||
|
||||
@@ -598,7 +598,26 @@ int RTLSDRInput::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
RTLSDRSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureRTLSDR *msg = MsgConfigureRTLSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRTLSDR *msgToGUI = MsgConfigureRTLSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void RTLSDRInput::webapiUpdateDeviceSettings(
|
||||
RTLSDRSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
if (deviceSettingsKeys.contains("agc")) {
|
||||
settings.m_agc = response.getRtlSdrSettings()->getAgc() != 0;
|
||||
}
|
||||
@@ -659,18 +678,6 @@ int RTLSDRInput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getRtlSdrSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
|
||||
MsgConfigureRTLSDR *msg = MsgConfigureRTLSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRTLSDR *msgToGUI = MsgConfigureRTLSDR::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatDeviceSettings(response, settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void RTLSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RTLSDRSettings& settings)
|
||||
|
||||
@@ -140,6 +140,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatDeviceSettings(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
const RTLSDRSettings& settings);
|
||||
|
||||
static void webapiUpdateDeviceSettings(
|
||||
RTLSDRSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
const std::vector<int>& getGains() const { return m_gains; }
|
||||
void set_ds_mode(int on);
|
||||
|
||||
@@ -168,7 +177,6 @@ private:
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
bool applySettings(const RTLSDRSettings& settings, bool force);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RTLSDRSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
#include "rtlsdrgui.h"
|
||||
#endif
|
||||
#include "rtlsdrplugin.h"
|
||||
#include "rtlsdrwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor RTLSDRPlugin::m_pluginDescriptor = {
|
||||
QString("RTL-SDR Input"),
|
||||
QString("4.5.4"),
|
||||
QString("4.11.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -108,3 +109,7 @@ DeviceSampleSource *RTLSDRPlugin::createSampleSourcePluginInstance(const QString
|
||||
}
|
||||
}
|
||||
|
||||
DeviceWebAPIAdapter *RTLSDRPlugin::createDeviceWebAPIAdapter() const
|
||||
{
|
||||
return new RTLSDRWebAPIAdapter();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "rtlsdrinput.h"
|
||||
#include "rtlsdrwebapiadapter.h"
|
||||
|
||||
RTLSDRWebAPIAdapter::RTLSDRWebAPIAdapter()
|
||||
{}
|
||||
|
||||
RTLSDRWebAPIAdapter::~RTLSDRWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int RTLSDRWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||
response.getAirspyHfSettings()->init();
|
||||
RTLSDRInput::webapiFormatDeviceSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int RTLSDRWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
RTLSDRInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// Implementation of static web API adapters used for preset serialization and //
|
||||
// deserialization //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "rtlsdrsettings.h"
|
||||
|
||||
class RTLSDRWebAPIAdapter : public DeviceWebAPIAdapter
|
||||
{
|
||||
public:
|
||||
RTLSDRWebAPIAdapter();
|
||||
virtual ~RTLSDRWebAPIAdapter();
|
||||
virtual QByteArray serialize() { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
RTLSDRSettings m_settings;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ set(sdrplay_SOURCES
|
||||
sdrplayinput.cpp
|
||||
sdrplayplugin.cpp
|
||||
sdrplaysettings.cpp
|
||||
sdrplaywebapiadapter.cpp
|
||||
sdrplaythread.cpp
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ set(sdrplay_HEADERS
|
||||
sdrplayinput.h
|
||||
sdrplayplugin.h
|
||||
sdrplaysettings.h
|
||||
sdrplaywebapiadapter.h
|
||||
sdrplaythread.h
|
||||
)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user