mirror of https://github.com/f4exb/sdrangel.git
REST API: config: GET (11). Support of the rest of devices
This commit is contained in:
parent
16e9684118
commit
a078239685
|
@ -35,8 +35,8 @@ const char *fcd_traits<ProPlus>::displayedName = "FunCube Dongle Pro+";
|
||||||
const char *fcd_traits<Pro>::pluginDisplayedName = "FunCube Pro Input";
|
const char *fcd_traits<Pro>::pluginDisplayedName = "FunCube Pro Input";
|
||||||
const char *fcd_traits<ProPlus>::pluginDisplayedName = "FunCube Pro+ Input";
|
const char *fcd_traits<ProPlus>::pluginDisplayedName = "FunCube Pro+ Input";
|
||||||
|
|
||||||
const char *fcd_traits<Pro>::pluginVersion = "4.5.2";
|
const char *fcd_traits<Pro>::pluginVersion = "4.11.6";
|
||||||
const char *fcd_traits<ProPlus>::pluginVersion = "4.5.2";
|
const char *fcd_traits<ProPlus>::pluginVersion = "4.11.6";
|
||||||
|
|
||||||
const int64_t fcd_traits<Pro>::loLowLimitFreq = 64000000L;
|
const int64_t fcd_traits<Pro>::loLowLimitFreq = 64000000L;
|
||||||
const int64_t fcd_traits<ProPlus>::loLowLimitFreq = 150000L;
|
const int64_t fcd_traits<ProPlus>::loLowLimitFreq = 150000L;
|
||||||
|
|
|
@ -4,14 +4,16 @@ set(testmi_SOURCES
|
||||||
testmi.cpp
|
testmi.cpp
|
||||||
testmiplugin.cpp
|
testmiplugin.cpp
|
||||||
testmithread.cpp
|
testmithread.cpp
|
||||||
testmisettings.cpp
|
testmisettings.cpp
|
||||||
|
testmiwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(testmi_HEADERS
|
set(testmi_HEADERS
|
||||||
testmi.h
|
testmi.h
|
||||||
testmiplugin.h
|
testmiplugin.h
|
||||||
testmithread.h
|
testmithread.h
|
||||||
testmisettings.h
|
testmisettings.h
|
||||||
|
testmiwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
|
@ -570,7 +570,26 @@ int TestMI::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
TestMISettings settings = m_settings;
|
TestMISettings settings = m_settings;
|
||||||
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
|
MsgConfigureTestSource *msg = MsgConfigureTestSource::create(settings, force);
|
||||||
|
m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgConfigureTestSource *msgToGUI = MsgConfigureTestSource::create(settings, force);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
webapiFormatDeviceSettings(response, settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
void webapiUpdateDeviceSettings(
|
||||||
|
TestMISettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("streams"))
|
if (deviceSettingsKeys.contains("streams"))
|
||||||
{
|
{
|
||||||
QList<SWGSDRangel::SWGTestMiStreamSettings*> *streamsSettings = response.getTestMiSettings()->getStreams();
|
QList<SWGSDRangel::SWGTestMiStreamSettings*> *streamsSettings = response.getTestMiSettings()->getStreams();
|
||||||
|
@ -580,60 +599,60 @@ int TestMI::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
int istream = (*it)->getStreamIndex();
|
int istream = (*it)->getStreamIndex();
|
||||||
|
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].centerFrequency").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].centerFrequency").arg(istream))) {
|
||||||
settings.m_streams[istream].m_centerFrequency = (*it)->getCenterFrequency();
|
settings.m_streams[istream].m_centerFrequency = (*it)->getCenterFrequency();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].frequencyShift").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].frequencyShift").arg(istream))) {
|
||||||
settings.m_streams[istream].m_frequencyShift = (*it)->getFrequencyShift();
|
settings.m_streams[istream].m_frequencyShift = (*it)->getFrequencyShift();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].sampleRate").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].sampleRate").arg(istream))) {
|
||||||
settings.m_streams[istream].m_sampleRate = (*it)->getSampleRate();
|
settings.m_streams[istream].m_sampleRate = (*it)->getSampleRate();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].log2Decim").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].log2Decim").arg(istream))) {
|
||||||
settings.m_streams[istream].m_log2Decim = (*it)->getLog2Decim();
|
settings.m_streams[istream].m_log2Decim = (*it)->getLog2Decim();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].fcPos").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].fcPos").arg(istream))) {
|
||||||
int fcPos = (*it)->getFcPos();
|
int fcPos = (*it)->getFcPos();
|
||||||
fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos;
|
fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos;
|
||||||
settings.m_streams[istream].m_fcPos = (TestMIStreamSettings::fcPos_t) fcPos;
|
settings.m_streams[istream].m_fcPos = (TestMIStreamSettings::fcPos_t) fcPos;
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].sampleSizeIndex").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].sampleSizeIndex").arg(istream))) {
|
||||||
int sampleSizeIndex = (*it)->getSampleSizeIndex();
|
int sampleSizeIndex = (*it)->getSampleSizeIndex();
|
||||||
sampleSizeIndex = sampleSizeIndex < 0 ? 0 : sampleSizeIndex > 1 ? 2 : sampleSizeIndex;
|
sampleSizeIndex = sampleSizeIndex < 0 ? 0 : sampleSizeIndex > 1 ? 2 : sampleSizeIndex;
|
||||||
settings.m_streams[istream].m_sampleSizeIndex = sampleSizeIndex;
|
settings.m_streams[istream].m_sampleSizeIndex = sampleSizeIndex;
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].amplitudeBits").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].amplitudeBits").arg(istream))) {
|
||||||
settings.m_streams[istream].m_amplitudeBits = (*it)->getAmplitudeBits();
|
settings.m_streams[istream].m_amplitudeBits = (*it)->getAmplitudeBits();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].autoCorrOptions").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].autoCorrOptions").arg(istream))) {
|
||||||
int autoCorrOptions = (*it)->getAutoCorrOptions();
|
int autoCorrOptions = (*it)->getAutoCorrOptions();
|
||||||
autoCorrOptions = autoCorrOptions < 0 ? 0 : autoCorrOptions >= TestMIStreamSettings::AutoCorrLast ? TestMIStreamSettings::AutoCorrLast-1 : autoCorrOptions;
|
autoCorrOptions = autoCorrOptions < 0 ? 0 : autoCorrOptions >= TestMIStreamSettings::AutoCorrLast ? TestMIStreamSettings::AutoCorrLast-1 : autoCorrOptions;
|
||||||
settings.m_streams[istream].m_sampleSizeIndex = (TestMIStreamSettings::AutoCorrOptions) autoCorrOptions;
|
settings.m_streams[istream].m_sampleSizeIndex = (TestMIStreamSettings::AutoCorrOptions) autoCorrOptions;
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].modulation").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].modulation").arg(istream))) {
|
||||||
int modulation = (*it)->getModulation();
|
int modulation = (*it)->getModulation();
|
||||||
modulation = modulation < 0 ? 0 : modulation >= TestMIStreamSettings::ModulationLast ? TestMIStreamSettings::ModulationLast-1 : modulation;
|
modulation = modulation < 0 ? 0 : modulation >= TestMIStreamSettings::ModulationLast ? TestMIStreamSettings::ModulationLast-1 : modulation;
|
||||||
settings.m_streams[istream].m_modulation = (TestMIStreamSettings::Modulation) modulation;
|
settings.m_streams[istream].m_modulation = (TestMIStreamSettings::Modulation) modulation;
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].modulationTone").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].modulationTone").arg(istream))) {
|
||||||
settings.m_streams[istream].m_modulationTone = (*it)->getModulationTone();
|
settings.m_streams[istream].m_modulationTone = (*it)->getModulationTone();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].amModulation").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].amModulation").arg(istream))) {
|
||||||
settings.m_streams[istream].m_amModulation = (*it)->getAmModulation();
|
settings.m_streams[istream].m_amModulation = (*it)->getAmModulation();
|
||||||
};
|
};
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].fmDeviation").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].fmDeviation").arg(istream))) {
|
||||||
settings.m_streams[istream].m_fmDeviation = (*it)->getFmDeviation();
|
settings.m_streams[istream].m_fmDeviation = (*it)->getFmDeviation();
|
||||||
};
|
};
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].dcFactor").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].dcFactor").arg(istream))) {
|
||||||
settings.m_streams[istream].m_dcFactor = (*it)->getDcFactor();
|
settings.m_streams[istream].m_dcFactor = (*it)->getDcFactor();
|
||||||
};
|
};
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].iFactor").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].iFactor").arg(istream))) {
|
||||||
settings.m_streams[istream].m_iFactor = (*it)->getIFactor();
|
settings.m_streams[istream].m_iFactor = (*it)->getIFactor();
|
||||||
};
|
};
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].qFactor").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].qFactor").arg(istream))) {
|
||||||
settings.m_streams[istream].m_qFactor = (*it)->getQFactor();
|
settings.m_streams[istream].m_qFactor = (*it)->getQFactor();
|
||||||
};
|
};
|
||||||
if (deviceSettingsKeys.contains(tr("streams[%1].phaseImbalance").arg(istream))) {
|
if (deviceSettingsKeys.contains(QString("streams[%1].phaseImbalance").arg(istream))) {
|
||||||
settings.m_streams[istream].m_phaseImbalance = (*it)->getPhaseImbalance();
|
settings.m_streams[istream].m_phaseImbalance = (*it)->getPhaseImbalance();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -655,18 +674,6 @@ int TestMI::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getTestMiSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getTestMiSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureTestSource *msg = MsgConfigureTestSource::create(settings, force);
|
|
||||||
m_inputMessageQueue.push(msg);
|
|
||||||
|
|
||||||
if (m_guiMessageQueue) // forward to GUI if any
|
|
||||||
{
|
|
||||||
MsgConfigureTestSource *msgToGUI = MsgConfigureTestSource::create(settings, force);
|
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
|
||||||
}
|
|
||||||
|
|
||||||
webapiFormatDeviceSettings(response, settings);
|
|
||||||
return 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestMI::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const TestMISettings& settings)
|
void TestMI::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const TestMISettings& settings)
|
||||||
|
|
|
@ -144,6 +144,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const TestMISettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
TestMISettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
bool isRecording(unsigned int istream) const;
|
bool isRecording(unsigned int istream) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -165,7 +174,6 @@ private:
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
|
|
||||||
bool applySettings(const TestMISettings& settings, bool force);
|
bool applySettings(const TestMISettings& settings, bool force);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const TestMISettings& settings);
|
|
||||||
void webapiReverseSendSettings(const DeviceSettingsKeys& deviceSettingsKeys, const TestMISettings& settings, bool force);
|
void webapiReverseSendSettings(const DeviceSettingsKeys& deviceSettingsKeys, const TestMISettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
#include "testmigui.h"
|
#include "testmigui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "testmiplugin.h"
|
#include "testmiplugin.h"
|
||||||
|
#include "testmiwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor TestMIPlugin::m_pluginDescriptor = {
|
const PluginDescriptor TestMIPlugin::m_pluginDescriptor = {
|
||||||
QString("Test Multiple Input"),
|
QString("Test Multiple Input"),
|
||||||
QString("4.8.1"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -112,3 +113,7 @@ DeviceSampleMIMO *TestMIPlugin::createSampleMIMOPluginInstance(const QString& mi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *TestMIPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new TestMIWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleMIMO* createSampleMIMOPluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleMIMO* createSampleMIMOPluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "testmi.h"
|
||||||
|
#include "testmiwebapiadapter.h"
|
||||||
|
|
||||||
|
TestMIWebAPIAdapter::TestMIWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
TestMIWebAPIAdapter::~TestMIWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int TestMIWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
TestMI::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestMIWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
TestMI::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 "testmisettings.h"
|
||||||
|
|
||||||
|
class TestMIWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TestMIWebAPIAdapter();
|
||||||
|
virtual ~TestMIWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
TestMISettings m_settings;
|
||||||
|
};
|
|
@ -3,14 +3,16 @@ project(bladerf1output)
|
||||||
set(bladerf1output_SOURCES
|
set(bladerf1output_SOURCES
|
||||||
bladerf1output.cpp
|
bladerf1output.cpp
|
||||||
bladerf1outputplugin.cpp
|
bladerf1outputplugin.cpp
|
||||||
bladerf1outputsettings.cpp
|
bladerf1outputsettings.cpp
|
||||||
|
bladerf1outputwebapiadapter.cpp
|
||||||
bladerf1outputthread.cpp
|
bladerf1outputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerf1output_HEADERS
|
set(bladerf1output_HEADERS
|
||||||
bladerf1output.h
|
bladerf1output.h
|
||||||
bladerf1soutputplugin.h
|
bladerf1soutputplugin.h
|
||||||
bladerf1outputsettings.h
|
bladerf1outputsettings.h
|
||||||
|
bladerf1outputwebapiadapter.h
|
||||||
bladerf1outputthread.h
|
bladerf1outputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -590,7 +590,26 @@ int Bladerf1Output::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
BladeRF1OutputSettings settings = m_settings;
|
BladeRF1OutputSettings 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 webapiUpdateDeviceSettings(
|
||||||
|
BladeRF1OutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getBladeRf1OutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getBladeRf1OutputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -630,18 +649,6 @@ int Bladerf1Output::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf1OutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getBladeRf1OutputSettings()->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 Bladerf1Output::webapiRunGet(
|
int Bladerf1Output::webapiRunGet(
|
||||||
|
|
|
@ -133,6 +133,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const BladeRF1OutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
BladeRF1OutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -148,7 +157,6 @@ private:
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
bool applySettings(const BladeRF1OutputSettings& settings, bool force);
|
bool applySettings(const BladeRF1OutputSettings& settings, bool force);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1OutputSettings& settings);
|
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1OutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1OutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
|
||||||
#include "bladerf1outputplugin.h"
|
#include "bladerf1outputplugin.h"
|
||||||
|
#include "bladerf1outputwebapiadapter.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "bladerf1output.h"
|
#include "bladerf1output.h"
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
const PluginDescriptor Bladerf1OutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor Bladerf1OutputPlugin::m_pluginDescriptor = {
|
||||||
QString("BladeRF1 Output"),
|
QString("BladeRF1 Output"),
|
||||||
QString("4.5.4"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -150,3 +151,8 @@ DeviceSampleSink* Bladerf1OutputPlugin::createSampleSinkPluginInstance(const QSt
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *Bladerf1OutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new BladeRF1OutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
|
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "bladerf1output.h"
|
||||||
|
#include "bladerf1outputwebapiadapter.h"
|
||||||
|
|
||||||
|
BladeRF1OutputWebAPIAdapter::BladeRF1OutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
BladeRF1OutputWebAPIAdapter::~BladeRF1OutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int BladeRF1OutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
Bladerf1Output::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BladeRF1OutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
Bladerf1Output::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 "bladerf1outputsettings.h"
|
||||||
|
|
||||||
|
class BladeRF1OutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BladeRF1OutputWebAPIAdapter();
|
||||||
|
virtual ~BladeRF1OutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
BladeRF1OutputSettings m_settings;
|
||||||
|
};
|
|
@ -3,14 +3,16 @@ project(bladerf2output)
|
||||||
set(bladerf2output_SOURCES
|
set(bladerf2output_SOURCES
|
||||||
bladerf2output.cpp
|
bladerf2output.cpp
|
||||||
bladerf2outputplugin.cpp
|
bladerf2outputplugin.cpp
|
||||||
bladerf2outputsettings.cpp
|
bladerf2outputsettings.cpp
|
||||||
|
bladerf2outputwebapiadapter.cpp
|
||||||
bladerf2outputthread.cpp
|
bladerf2outputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerf2output_HEADERS
|
set(bladerf2output_HEADERS
|
||||||
bladerf2output.h
|
bladerf2output.h
|
||||||
bladerf2outputplugin.h
|
bladerf2outputplugin.h
|
||||||
bladerf2outputsettings.h
|
bladerf2outputsettings.h
|
||||||
|
bladerf2outputwebapiadapter.h
|
||||||
bladerf2outputthread.h
|
bladerf2outputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -966,7 +966,26 @@ int BladeRF2Output::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
BladeRF2OutputSettings settings = m_settings;
|
BladeRF2OutputSettings 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 webapiUpdateDeviceSettings(
|
||||||
|
BladeRF2OutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getBladeRf2OutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getBladeRf2OutputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -1006,18 +1025,6 @@ int BladeRF2Output::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf2OutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getBladeRf2OutputSettings()->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 BladeRF2Output::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage)
|
int BladeRF2Output::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage)
|
||||||
|
|
|
@ -153,6 +153,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const BladeRF2OutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
BladeRF2OutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -172,7 +181,6 @@ private:
|
||||||
bool applySettings(const BladeRF2OutputSettings& settings, bool force);
|
bool applySettings(const BladeRF2OutputSettings& settings, bool force);
|
||||||
int getNbChannels();
|
int getNbChannels();
|
||||||
bool setDeviceCenterFrequency(struct bladerf *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
bool setDeviceCenterFrequency(struct bladerf *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF2OutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2OutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2OutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
|
||||||
#include "bladerf2outputplugin.h"
|
#include "bladerf2outputplugin.h"
|
||||||
|
#include "bladerf2outputwebapiadapter.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "bladerf2output.h"
|
#include "bladerf2output.h"
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
const PluginDescriptor BladeRF2OutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor BladeRF2OutputPlugin::m_pluginDescriptor = {
|
||||||
QString("BladeRF2 Output"),
|
QString("BladeRF2 Output"),
|
||||||
QString("4.5.4"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -155,6 +156,7 @@ DeviceSampleSink* BladeRF2OutputPlugin::createSampleSinkPluginInstance(const QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *BladeRF2OutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new BladeRF2OutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
|
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "bladerf2output.h"
|
||||||
|
#include "bladerf2outputwebapiadapter.h"
|
||||||
|
|
||||||
|
BladeRF2OutputWebAPIAdapter::BladeRF2OutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
BladeRF2OutputWebAPIAdapter::~BladeRF2OutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int BladeRF2OutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
BladeRF2Output::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BladeRF2OutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
BladeRF2Output::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 "bladerf2outputsettings.h"
|
||||||
|
|
||||||
|
class BladeRF2OutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BladeRF2OutputWebAPIAdapter();
|
||||||
|
virtual ~BladeRF2OutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
BladeRF2OutputSettings m_settings;
|
||||||
|
};
|
|
@ -4,6 +4,7 @@ set(hackrfoutput_SOURCES
|
||||||
hackrfoutput.cpp
|
hackrfoutput.cpp
|
||||||
hackrfoutputplugin.cpp
|
hackrfoutputplugin.cpp
|
||||||
hackrfoutputsettings.cpp
|
hackrfoutputsettings.cpp
|
||||||
|
hackrfoutputwebapiadapter.cpp
|
||||||
hackrfoutputthread.cpp
|
hackrfoutputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ set(hackrfoutput_HEADERS
|
||||||
hackrfoutput.h
|
hackrfoutput.h
|
||||||
hackrfoutputplugin.h
|
hackrfoutputplugin.h
|
||||||
hackrfoutputsettings.h
|
hackrfoutputsettings.h
|
||||||
|
hackrfoutputwebapiadapter.h
|
||||||
hackrfoutputthread.h
|
hackrfoutputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -561,7 +561,26 @@ int HackRFOutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
HackRFOutputSettings settings = m_settings;
|
HackRFOutputSettings 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 HackRFOutput::webapiUpdateDeviceSettings(
|
||||||
|
HackRFOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getHackRfOutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getHackRfOutputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -604,18 +623,6 @@ int HackRFOutput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getHackRfOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getHackRfOutputSettings()->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 HackRFOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const HackRFOutputSettings& settings)
|
void HackRFOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const HackRFOutputSettings& settings)
|
||||||
|
|
|
@ -134,6 +134,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const HackRFOutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
HackRFOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -151,7 +160,6 @@ private:
|
||||||
bool applySettings(const HackRFOutputSettings& settings, bool force);
|
bool applySettings(const HackRFOutputSettings& settings, bool force);
|
||||||
// hackrf_device *open_hackrf_from_sequence(int sequence);
|
// hackrf_device *open_hackrf_from_sequence(int sequence);
|
||||||
void setDeviceCenterFrequency(quint64 freq_hz, qint32 LOppmTenths);
|
void setDeviceCenterFrequency(quint64 freq_hz, qint32 LOppmTenths);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const HackRFOutputSettings& settings);
|
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const HackRFOutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const HackRFOutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
#include "hackrfoutputgui.h"
|
#include "hackrfoutputgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "hackrfoutputplugin.h"
|
#include "hackrfoutputplugin.h"
|
||||||
|
#include "hackrfoutputwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor HackRFOutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor HackRFOutputPlugin::m_pluginDescriptor = {
|
||||||
QString("HackRF Output"),
|
QString("HackRF Output"),
|
||||||
QString("4.5.5"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -57,13 +58,6 @@ void HackRFOutputPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
|
|
||||||
PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
|
PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
|
||||||
{
|
{
|
||||||
// hackrf_error rc = (hackrf_error) hackrf_init();
|
|
||||||
//
|
|
||||||
// if (rc != HACKRF_SUCCESS)
|
|
||||||
// {
|
|
||||||
// qCritical("HackRFOutputPlugin::enumSampleSinks: failed to initiate HackRF library: %s", hackrf_error_name(rc));
|
|
||||||
// }
|
|
||||||
|
|
||||||
SamplingDevices result;
|
SamplingDevices result;
|
||||||
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
|
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
|
||||||
hackrf_device *hackrf_ptr;
|
hackrf_device *hackrf_ptr;
|
||||||
|
@ -115,9 +109,6 @@ PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
|
||||||
}
|
}
|
||||||
|
|
||||||
hackrf_device_list_free(hackrf_devices);
|
hackrf_device_list_free(hackrf_devices);
|
||||||
// rc = (hackrf_error) hackrf_exit();
|
|
||||||
// qDebug("HackRFOutputPlugin::enumSampleSinks: hackrf_exit: %s", hackrf_error_name(rc));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,4 +156,7 @@ DeviceSampleSink* HackRFOutputPlugin::createSampleSinkPluginInstance(const QStri
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *HackRFOutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new HackRFOutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "hackrfoutput.h"
|
||||||
|
#include "hackrfoutputwebapiadapter.h"
|
||||||
|
|
||||||
|
HackRFOutputWebAPIAdapter::HackRFOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
HackRFOutputWebAPIAdapter::~HackRFOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int HackRFOutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
HackRFOutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int HackRFOutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
HackRFOutput::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 "hackrfoutputsettings.h"
|
||||||
|
|
||||||
|
class HackRFOutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HackRFOutputWebAPIAdapter();
|
||||||
|
virtual ~HackRFOutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
HackRFOutputSettings m_settings;
|
||||||
|
};
|
|
@ -3,14 +3,16 @@ project(limesdroutput)
|
||||||
set(limesdroutput_SOURCES
|
set(limesdroutput_SOURCES
|
||||||
limesdroutput.cpp
|
limesdroutput.cpp
|
||||||
limesdroutputplugin.cpp
|
limesdroutputplugin.cpp
|
||||||
limesdroutputsettings.cpp
|
limesdroutputsettings.cpp
|
||||||
|
limesdroutputwebapiadapter.cpp
|
||||||
limesdroutputthread.cpp
|
limesdroutputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(limesdroutput_HEADERS
|
set(limesdroutput_HEADERS
|
||||||
limesdroutput.h
|
limesdroutput.h
|
||||||
limesdroutputplugin.h
|
limesdroutputplugin.h
|
||||||
limesdroutputsettings.h
|
limesdroutputsettings.h
|
||||||
|
limesdroutputwebapiadapter.h
|
||||||
limesdroutputthread.h
|
limesdroutputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1254,7 +1254,26 @@ int LimeSDROutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
LimeSDROutputSettings settings = m_settings;
|
LimeSDROutputSettings 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 LimeSDROutput::webapiUpdateDeviceSettings(
|
||||||
|
LimeSDROutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("antennaPath")) {
|
if (deviceSettingsKeys.contains("antennaPath")) {
|
||||||
settings.m_antennaPath = (LimeSDROutputSettings::PathRFE) response.getLimeSdrOutputSettings()->getAntennaPath();
|
settings.m_antennaPath = (LimeSDROutputSettings::PathRFE) response.getLimeSdrOutputSettings()->getAntennaPath();
|
||||||
}
|
}
|
||||||
|
@ -1318,18 +1337,6 @@ int LimeSDROutput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getLimeSdrOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getLimeSdrOutputSettings()->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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int LimeSDROutput::webapiReportGet(
|
int LimeSDROutput::webapiReportGet(
|
||||||
|
|
|
@ -227,6 +227,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const LimeSDROutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
LimeSDROutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
std::size_t getChannelIndex();
|
std::size_t getChannelIndex();
|
||||||
void getLORange(float& minF, float& maxF) const;
|
void getLORange(float& minF, float& maxF) const;
|
||||||
void getSRRange(float& minF, float& maxF) const;
|
void getSRRange(float& minF, float& maxF) const;
|
||||||
|
@ -256,7 +265,6 @@ private:
|
||||||
void suspendTxBuddies();
|
void suspendTxBuddies();
|
||||||
void resumeTxBuddies();
|
void resumeTxBuddies();
|
||||||
bool applySettings(const LimeSDROutputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
bool applySettings(const LimeSDROutputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LimeSDROutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDROutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDROutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
#include "limesdroutputgui.h"
|
#include "limesdroutputgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "limesdroutputplugin.h"
|
#include "limesdroutputplugin.h"
|
||||||
|
#include "limesdroutputwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor LimeSDROutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor LimeSDROutputPlugin::m_pluginDescriptor = {
|
||||||
QString("LimeSDR Output"),
|
QString("LimeSDR Output"),
|
||||||
QString("4.5.5"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -172,3 +173,7 @@ DeviceSampleSink* LimeSDROutputPlugin::createSampleSinkPluginInstance(const QStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *LimeSDROutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new LimeSDROutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "limesdroutput.h"
|
||||||
|
#include "limesdroutputwebapiadapter.h"
|
||||||
|
|
||||||
|
LimeSDROutputWebAPIAdapter::LimeSDROutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
LimeSDROutputWebAPIAdapter::~LimeSDROutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int LimeSDROutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
LimeSDROutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LimeSDROutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
LimeSDROutput::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 "limesdroutputsettings.h"
|
||||||
|
|
||||||
|
class LimeSDROutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LimeSDROutputWebAPIAdapter();
|
||||||
|
virtual ~LimeSDROutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
LimeSDROutputSettings m_settings;
|
||||||
|
};
|
|
@ -3,13 +3,15 @@ project(localoutput)
|
||||||
set(localoutput_SOURCES
|
set(localoutput_SOURCES
|
||||||
localoutput.cpp
|
localoutput.cpp
|
||||||
localoutputplugin.cpp
|
localoutputplugin.cpp
|
||||||
localoutputsettings.cpp
|
localoutputsettings.cpp
|
||||||
|
localoutputwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(localoutput_HEADERS
|
set(localoutput_HEADERS
|
||||||
localoutput.h
|
localoutput.h
|
||||||
localoutputplugin.h
|
localoutputplugin.h
|
||||||
localoutputsettings.h
|
localoutputsettings.h
|
||||||
|
localoutputwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
|
@ -267,19 +267,7 @@ int LocalOutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
LocalOutputSettings settings = m_settings;
|
LocalOutputSettings settings = m_settings;
|
||||||
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
if (deviceSettingsKeys.contains("useReverseAPI")) {
|
|
||||||
settings.m_useReverseAPI = response.getLocalOutputSettings()->getUseReverseApi() != 0;
|
|
||||||
}
|
|
||||||
if (deviceSettingsKeys.contains("reverseAPIAddress")) {
|
|
||||||
settings.m_reverseAPIAddress = *response.getLocalOutputSettings()->getReverseApiAddress();
|
|
||||||
}
|
|
||||||
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
|
||||||
settings.m_reverseAPIPort = response.getLocalOutputSettings()->getReverseApiPort();
|
|
||||||
}
|
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
|
||||||
settings.m_reverseAPIDeviceIndex = response.getLocalOutputSettings()->getReverseApiDeviceIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
MsgConfigureLocalOutput *msg = MsgConfigureLocalOutput::create(settings, force);
|
MsgConfigureLocalOutput *msg = MsgConfigureLocalOutput::create(settings, force);
|
||||||
m_inputMessageQueue.push(msg);
|
m_inputMessageQueue.push(msg);
|
||||||
|
@ -294,6 +282,25 @@ int LocalOutput::webapiSettingsPutPatch(
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalOutput::webapiUpdateDeviceSettings(
|
||||||
|
LocalOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
|
if (deviceSettingsKeys.contains("useReverseAPI")) {
|
||||||
|
settings.m_useReverseAPI = response.getLocalOutputSettings()->getUseReverseApi() != 0;
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("reverseAPIAddress")) {
|
||||||
|
settings.m_reverseAPIAddress = *response.getLocalOutputSettings()->getReverseApiAddress();
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
||||||
|
settings.m_reverseAPIPort = response.getLocalOutputSettings()->getReverseApiPort();
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
|
settings.m_reverseAPIDeviceIndex = response.getLocalOutputSettings()->getReverseApiDeviceIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LocalOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LocalOutputSettings& settings)
|
void LocalOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LocalOutputSettings& settings)
|
||||||
{
|
{
|
||||||
response.getLocalOutputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
response.getLocalOutputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||||
|
|
|
@ -147,6 +147,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const LocalOutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
LocalOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -160,7 +169,6 @@ private:
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
|
|
||||||
void applySettings(const LocalOutputSettings& settings, bool force = false);
|
void applySettings(const LocalOutputSettings& settings, bool force = false);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LocalOutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LocalOutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LocalOutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
#include "localoutputgui.h"
|
#include "localoutputgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "localoutputplugin.h"
|
#include "localoutputplugin.h"
|
||||||
|
#include "localoutputwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor LocalOutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor LocalOutputPlugin::m_pluginDescriptor = {
|
||||||
QString("Local device output"),
|
QString("Local device output"),
|
||||||
QString("4.8.0"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -114,3 +115,8 @@ DeviceSampleSink *LocalOutputPlugin::createSampleSinkPluginInstance(const QStrin
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *LocalOutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new LocalOutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "localoutput.h"
|
||||||
|
#include "localoutputwebapiadapter.h"
|
||||||
|
|
||||||
|
LocalOutputWebAPIAdapter::LocalOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
LocalOutputWebAPIAdapter::~LocalOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int LocalOutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
LocalOutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LocalOutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
LocalOutput::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 "localoutputsettings.h"
|
||||||
|
|
||||||
|
class LocalOutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LocalOutputWebAPIAdapter();
|
||||||
|
virtual ~LocalOutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
LocalOutputSettings m_settings;
|
||||||
|
};
|
|
@ -4,6 +4,7 @@ set(plutosdroutput_SOURCES
|
||||||
plutosdroutput.cpp
|
plutosdroutput.cpp
|
||||||
plutosdroutputplugin.cpp
|
plutosdroutputplugin.cpp
|
||||||
plutosdroutputsettings.cpp
|
plutosdroutputsettings.cpp
|
||||||
|
plutosdroutputwebapiadapter.cpp
|
||||||
plutosdroutputthread.cpp
|
plutosdroutputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ set(plutosdroutput_HEADERS
|
||||||
plutosdroutput.h
|
plutosdroutput.h
|
||||||
plutosdroutputplugin.h
|
plutosdroutputplugin.h
|
||||||
plutosdroutputsettings.h
|
plutosdroutputsettings.h
|
||||||
|
plutosdroutputwebapiadapter.h
|
||||||
plutosdroutputthread.h
|
plutosdroutputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -670,7 +670,26 @@ int PlutoSDROutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
PlutoSDROutputSettings settings = m_settings;
|
PlutoSDROutputSettings 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 PlutoSDROutput::webapiUpdateDeviceSettings(
|
||||||
|
PlutoSDROutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getPlutoSdrOutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getPlutoSdrOutputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -724,18 +743,6 @@ int PlutoSDROutput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getPlutoSdrOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getPlutoSdrOutputSettings()->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 PlutoSDROutput::webapiReportGet(
|
int PlutoSDROutput::webapiReportGet(
|
||||||
|
|
|
@ -121,6 +121,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const PlutoSDROutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
PlutoSDROutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
uint32_t getDACSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
|
uint32_t getDACSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
|
||||||
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
|
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
|
||||||
void getRSSI(std::string& rssiStr);
|
void getRSSI(std::string& rssiStr);
|
||||||
|
@ -147,7 +156,6 @@ public:
|
||||||
void suspendBuddies();
|
void suspendBuddies();
|
||||||
void resumeBuddies();
|
void resumeBuddies();
|
||||||
bool applySettings(const PlutoSDROutputSettings& settings, bool force = false);
|
bool applySettings(const PlutoSDROutputSettings& settings, bool force = false);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PlutoSDROutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDROutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDROutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
#include "plutosdroutputgui.h"
|
#include "plutosdroutputgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "plutosdroutputplugin.h"
|
#include "plutosdroutputplugin.h"
|
||||||
|
#include "plutosdroutputwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor PlutoSDROutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor PlutoSDROutputPlugin::m_pluginDescriptor = {
|
||||||
QString("PlutoSDR Output"),
|
QString("PlutoSDR Output"),
|
||||||
QString("4.5.4"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -129,3 +130,7 @@ DeviceSampleSink *PlutoSDROutputPlugin::createSampleSinkPluginInstance(const QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *PlutoSDROutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new PlutoSDROutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "plutosdroutput.h"
|
||||||
|
#include "plutosdroutputwebapiadapter.h"
|
||||||
|
|
||||||
|
PlutoSDROutputWebAPIAdapter::PlutoSDROutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
PlutoSDROutputWebAPIAdapter::~PlutoSDROutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int PlutoSDROutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
PlutoSDROutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PlutoSDROutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
PlutoSDROutput::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 "plutosdroutputsettings.h"
|
||||||
|
|
||||||
|
class PlutoSDROutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PlutoSDROutputWebAPIAdapter();
|
||||||
|
virtual ~PlutoSDROutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
PlutoSDROutputSettings m_settings;
|
||||||
|
};
|
|
@ -12,19 +12,21 @@ endif()
|
||||||
set(remoteoutput_SOURCES
|
set(remoteoutput_SOURCES
|
||||||
remoteoutput.cpp
|
remoteoutput.cpp
|
||||||
remoteoutputplugin.cpp
|
remoteoutputplugin.cpp
|
||||||
remoteoutputsettings.cpp
|
remoteoutputsettings.cpp
|
||||||
|
remoteoutputwebapiadapter.cpp
|
||||||
remoteoutputthread.cpp
|
remoteoutputthread.cpp
|
||||||
udpsinkfec.cpp
|
udpsinkfec.cpp
|
||||||
udpsinkfecworker.cpp
|
udpsinkfecworker.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(remoteoutput_HEADERS
|
set(remoteoutput_HEADERS
|
||||||
remoteoutput.h
|
remoteoutput.h
|
||||||
remoteoutputplugin.h
|
remoteoutputplugin.h
|
||||||
remoteoutputsettings.h
|
remoteoutputsettings.h
|
||||||
|
remoteoutputwebapiadapter.h
|
||||||
remoteoutputthread.h
|
remoteoutputthread.h
|
||||||
udpsinkfec.h
|
udpsinkfec.h
|
||||||
udpsinkfecworker.h
|
udpsinkfecworker.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
|
@ -385,7 +385,26 @@ int RemoteOutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
RemoteOutputSettings settings = m_settings;
|
RemoteOutputSettings settings = m_settings;
|
||||||
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
|
MsgConfigureRemoteOutput *msg = MsgConfigureRemoteOutput::create(settings, force);
|
||||||
|
m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgConfigureRemoteOutput *msgToGUI = MsgConfigureRemoteOutput::create(settings, force);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
webapiFormatDeviceSettings(response, settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoteOutput::webapiUpdateDeviceSettings(
|
||||||
|
RemoteOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("sampleRate")) {
|
if (deviceSettingsKeys.contains("sampleRate")) {
|
||||||
settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate();
|
settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate();
|
||||||
}
|
}
|
||||||
|
@ -425,18 +444,6 @@ int RemoteOutput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getRemoteOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getRemoteOutputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureRemoteOutput *msg = MsgConfigureRemoteOutput::create(settings, force);
|
|
||||||
m_inputMessageQueue.push(msg);
|
|
||||||
|
|
||||||
if (m_guiMessageQueue) // forward to GUI if any
|
|
||||||
{
|
|
||||||
MsgConfigureRemoteOutput *msgToGUI = MsgConfigureRemoteOutput::create(settings, force);
|
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
|
||||||
}
|
|
||||||
|
|
||||||
webapiFormatDeviceSettings(response, settings);
|
|
||||||
return 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RemoteOutput::webapiReportGet(
|
int RemoteOutput::webapiReportGet(
|
||||||
|
@ -452,7 +459,7 @@ int RemoteOutput::webapiReportGet(
|
||||||
|
|
||||||
void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteOutputSettings& settings)
|
void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteOutputSettings& settings)
|
||||||
{
|
{
|
||||||
response.getRemoteOutputSettings()->setCenterFrequency(m_centerFrequency);
|
response.getRemoteOutputSettings()->setCenterFrequency(settings.m_centerFrequency);
|
||||||
response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate);
|
response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate);
|
||||||
response.getRemoteOutputSettings()->setTxDelay(settings.m_txDelay);
|
response.getRemoteOutputSettings()->setTxDelay(settings.m_txDelay);
|
||||||
response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
|
response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
|
||||||
|
@ -538,7 +545,8 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString&
|
||||||
if (jsonObject.contains("RemoteSourceReport"))
|
if (jsonObject.contains("RemoteSourceReport"))
|
||||||
{
|
{
|
||||||
QJsonObject report = jsonObject["RemoteSourceReport"].toObject();
|
QJsonObject report = jsonObject["RemoteSourceReport"].toObject();
|
||||||
m_centerFrequency = report["deviceCenterFreq"].toInt() * 1000;
|
m_settings.m_centerFrequency = report["deviceCenterFreq"].toInt();
|
||||||
|
m_centerFrequency = m_settings.m_centerFrequency * 1000;
|
||||||
|
|
||||||
if (!m_remoteOutputThread) {
|
if (!m_remoteOutputThread) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -166,6 +166,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const RemoteOutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
RemoteOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -192,7 +201,6 @@ private:
|
||||||
static const uint32_t NbSamplesForRateCorrection;
|
static const uint32_t NbSamplesForRateCorrection;
|
||||||
|
|
||||||
void applySettings(const RemoteOutputSettings& settings, bool force = false);
|
void applySettings(const RemoteOutputSettings& settings, bool force = false);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteOutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
|
|
||||||
void analyzeApiReply(const QJsonObject& jsonObject, const QString& answer);
|
void analyzeApiReply(const QJsonObject& jsonObject, const QString& answer);
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
#include "remoteoutputgui.h"
|
#include "remoteoutputgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "remoteoutputplugin.h"
|
#include "remoteoutputplugin.h"
|
||||||
|
#include "remoteoutputwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor RemoteOutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor RemoteOutputPlugin::m_pluginDescriptor = {
|
||||||
QString("Remote device output"),
|
QString("Remote device output"),
|
||||||
QString("4.5.2"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -115,3 +116,8 @@ DeviceSampleSink* RemoteOutputPlugin::createSampleSinkPluginInstance(const QStri
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *RemoteOutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new RemoteOutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "remoteoutput.h"
|
||||||
|
#include "remoteoutputwebapiadapter.h"
|
||||||
|
|
||||||
|
RemoteOutputWebAPIAdapter::RemoteOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
RemoteOutputWebAPIAdapter::~RemoteOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int RemoteOutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
RemoteOutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RemoteOutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
RemoteOutput::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 "remoteoutputsettings.h"
|
||||||
|
|
||||||
|
class RemoteOutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RemoteOutputWebAPIAdapter();
|
||||||
|
virtual ~RemoteOutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
RemoteOutputSettings m_settings;
|
||||||
|
};
|
|
@ -3,14 +3,16 @@ project(soapysdroutput)
|
||||||
set(soapysdroutput_SOURCES
|
set(soapysdroutput_SOURCES
|
||||||
soapysdroutput.cpp
|
soapysdroutput.cpp
|
||||||
soapysdroutputplugin.cpp
|
soapysdroutputplugin.cpp
|
||||||
soapysdroutputsettings.cpp
|
soapysdroutputsettings.cpp
|
||||||
|
soapysdroutputwebapiadapter.cpp
|
||||||
soapysdroutputthread.cpp
|
soapysdroutputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(soapysdroutput_HEADERS
|
set(soapysdroutput_HEADERS
|
||||||
soapysdroutput.h
|
soapysdroutput.h
|
||||||
soapysdroutputplugin.h
|
soapysdroutputplugin.h
|
||||||
soapysdroutputsettings.h
|
soapysdroutputsettings.h
|
||||||
|
soapysdroutputwebapiadapter.h
|
||||||
soapysdroutputthread.h
|
soapysdroutputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1355,7 +1355,26 @@ int SoapySDROutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
SoapySDROutputSettings settings = m_settings;
|
SoapySDROutputSettings settings = m_settings;
|
||||||
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
|
MsgConfigureSoapySDROutput *msg = MsgConfigureSoapySDROutput::create(settings, force);
|
||||||
|
m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgConfigureSoapySDROutput *msgToGUI = MsgConfigureSoapySDROutput::create(settings, force);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
webapiFormatDeviceSettings(response, settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoapySDROutput::webapiUpdateDeviceSettings(
|
||||||
|
SoapySDROutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getSoapySdrOutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getSoapySdrOutputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -1477,18 +1496,6 @@ int SoapySDROutput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getSoapySdrOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getSoapySdrOutputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureSoapySDROutput *msg = MsgConfigureSoapySDROutput::create(settings, force);
|
|
||||||
m_inputMessageQueue.push(msg);
|
|
||||||
|
|
||||||
if (m_guiMessageQueue) // forward to GUI if any
|
|
||||||
{
|
|
||||||
MsgConfigureSoapySDROutput *msgToGUI = MsgConfigureSoapySDROutput::create(settings, force);
|
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
|
||||||
}
|
|
||||||
|
|
||||||
webapiFormatDeviceSettings(response, settings);
|
|
||||||
return 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SoapySDROutput::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage)
|
int SoapySDROutput::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage)
|
||||||
|
|
|
@ -181,6 +181,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const SoapySDROutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
SoapySDROutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -200,10 +209,9 @@ private:
|
||||||
bool setDeviceCenterFrequency(SoapySDR::Device *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
bool setDeviceCenterFrequency(SoapySDR::Device *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
||||||
void updateGains(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings);
|
void updateGains(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings);
|
||||||
void updateTunableElements(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings);
|
void updateTunableElements(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SoapySDROutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
QVariant webapiVariantFromArgValue(SWGSDRangel::SWGArgValue *argValue);
|
static QVariant webapiVariantFromArgValue(SWGSDRangel::SWGArgValue *argValue);
|
||||||
void webapiFormatArgValue(const QVariant& v, SWGSDRangel::SWGArgValue *argValue);
|
static void webapiFormatArgValue(const QVariant& v, SWGSDRangel::SWGArgValue *argValue);
|
||||||
void webapiFormatArgInfo(const SoapySDR::ArgInfo& arg, SWGSDRangel::SWGArgInfo *argInfo);
|
void webapiFormatArgInfo(const SoapySDR::ArgInfo& arg, SWGSDRangel::SWGArgInfo *argInfo);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const SoapySDROutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const SoapySDROutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "soapysdr/devicesoapysdr.h"
|
#include "soapysdr/devicesoapysdr.h"
|
||||||
|
|
||||||
#include "soapysdroutputplugin.h"
|
#include "soapysdroutputplugin.h"
|
||||||
|
#include "soapysdroutputwebapiadapter.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "soapysdroutput.h"
|
#include "soapysdroutput.h"
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
|
|
||||||
const PluginDescriptor SoapySDROutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor SoapySDROutputPlugin::m_pluginDescriptor = {
|
||||||
QString("SoapySDR Output"),
|
QString("SoapySDR Output"),
|
||||||
QString("4.5.2"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -132,7 +133,7 @@ DeviceSampleSink* SoapySDROutputPlugin::createSampleSinkPluginInstance(const QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *SoapySDROutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new SoapySDROutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
|
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "soapysdroutput.h"
|
||||||
|
#include "soapysdroutputwebapiadapter.h"
|
||||||
|
|
||||||
|
SoapySDROutputWebAPIAdapter::SoapySDROutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
SoapySDROutputWebAPIAdapter::~SoapySDROutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int SoapySDROutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
SoapySDROutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SoapySDROutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
SoapySDROutput::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 "soapysdroutputsettings.h"
|
||||||
|
|
||||||
|
class SoapySDROutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SoapySDROutputWebAPIAdapter();
|
||||||
|
virtual ~SoapySDROutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
SoapySDROutputSettings m_settings;
|
||||||
|
};
|
|
@ -1185,7 +1185,26 @@ int XTRXOutput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
XTRXOutputSettings settings = m_settings;
|
XTRXOutputSettings settings = m_settings;
|
||||||
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
|
MsgConfigureXTRX *msg = MsgConfigureXTRX::create(settings, force);
|
||||||
|
m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgConfigureXTRX *msgToGUI = MsgConfigureXTRX::create(settings, force);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
webapiFormatDeviceSettings(response, settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
void webapiUpdateDeviceSettings(
|
||||||
|
XTRXOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
{
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getXtrxOutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getXtrxOutputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -1234,18 +1253,6 @@ int XTRXOutput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getXtrxOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = response.getXtrxOutputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureXTRX *msg = MsgConfigureXTRX::create(settings, force);
|
|
||||||
m_inputMessageQueue.push(msg);
|
|
||||||
|
|
||||||
if (m_guiMessageQueue) // forward to GUI if any
|
|
||||||
{
|
|
||||||
MsgConfigureXTRX *msgToGUI = MsgConfigureXTRX::create(settings, force);
|
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
|
||||||
}
|
|
||||||
|
|
||||||
webapiFormatDeviceSettings(response, settings);
|
|
||||||
return 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTRXOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const XTRXOutputSettings& settings)
|
void XTRXOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const XTRXOutputSettings& settings)
|
||||||
|
|
|
@ -218,6 +218,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const XTRXOutputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
XTRXOutputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
std::size_t getChannelIndex();
|
std::size_t getChannelIndex();
|
||||||
void getLORange(float& minF, float& maxF, float& stepF) const;
|
void getLORange(float& minF, float& maxF, float& stepF) const;
|
||||||
void getSRRange(float& minF, float& maxF, float& stepF) const;
|
void getSRRange(float& minF, float& maxF, float& stepF) const;
|
||||||
|
@ -242,7 +251,6 @@ private:
|
||||||
void suspendRxThread();
|
void suspendRxThread();
|
||||||
void resumeRxThread();
|
void resumeRxThread();
|
||||||
bool applySettings(const XTRXOutputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
bool applySettings(const XTRXOutputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const XTRXOutputSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const XTRXOutputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const XTRXOutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -30,11 +30,12 @@
|
||||||
#else
|
#else
|
||||||
#include "xtrxoutputgui.h"
|
#include "xtrxoutputgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "../xtrxoutput/xtrxoutputplugin.h"
|
#include "xtrxoutputplugin.h"
|
||||||
|
#include "xtrxoutputwebapiadapter.h"
|
||||||
|
|
||||||
const PluginDescriptor XTRXOutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor XTRXOutputPlugin::m_pluginDescriptor = {
|
||||||
QString("XTRX Output"),
|
QString("XTRX Output"),
|
||||||
QString("4.5.4"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -128,3 +129,7 @@ DeviceSampleSink* XTRXOutputPlugin::createSampleSinkPluginInstance(const QString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *XTRXOutputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new XTRXOutputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSink* createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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 "xtrxoutput.h"
|
||||||
|
#include "xtrxoutputwebapiadapter.h"
|
||||||
|
|
||||||
|
XTRXOutputWebAPIAdapter::XTRXOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
XTRXOutputWebAPIAdapter::~XTRXOutputWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int XTRXOutputWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings());
|
||||||
|
response.getAirspyHfSettings()->init();
|
||||||
|
XTRXOutput::webapiFormatDeviceSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XTRXOutputWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
XTRXOutput::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 "xtrxoutputsettings.h"
|
||||||
|
|
||||||
|
class XTRXOutputWebAPIAdapter : public DeviceWebAPIAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XTRXOutputWebAPIAdapter();
|
||||||
|
virtual ~XTRXOutputWebAPIAdapter();
|
||||||
|
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:
|
||||||
|
XTRXOutputSettings m_settings;
|
||||||
|
};
|
|
@ -671,7 +671,7 @@ int AirspyInput::webapiSettingsPutPatch(
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
void webapiUpdateDeviceSettings(
|
void AirspyInput::webapiUpdateDeviceSettings(
|
||||||
AirspySettings& settings,
|
AirspySettings& settings,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response)
|
SWGSDRangel::SWGDeviceSettings& response)
|
||||||
|
|
|
@ -4,6 +4,7 @@ set(airspyhf_SOURCES
|
||||||
airspyhfinput.cpp
|
airspyhfinput.cpp
|
||||||
airspyhfplugin.cpp
|
airspyhfplugin.cpp
|
||||||
airspyhfsettings.cpp
|
airspyhfsettings.cpp
|
||||||
|
airspyhfwebapiadapter.cpp
|
||||||
airspyhfthread.cpp
|
airspyhfthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ set(airspyhf_HEADERS
|
||||||
airspyhfinput.h
|
airspyhfinput.h
|
||||||
airspyhfplugin.h
|
airspyhfplugin.h
|
||||||
airspyhfsettings.h
|
airspyhfsettings.h
|
||||||
|
airspyhfwebapiadapter.h
|
||||||
airspyhfthread.h
|
airspyhfthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -661,7 +661,26 @@ int AirspyHFInput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
AirspyHFSettings settings = m_settings;
|
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")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getAirspyHfSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getAirspyHfSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -719,18 +738,6 @@ int AirspyHFInput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("iqCorrection")) {
|
if (deviceSettingsKeys.contains("iqCorrection")) {
|
||||||
settings.m_iqCorrection = response.getAirspyHfSettings()->getIqCorrection() != 0;
|
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)
|
void AirspyHFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings)
|
||||||
|
|
|
@ -141,6 +141,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
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 loLowLimitFreqHF;
|
||||||
static const qint64 loHighLimitFreqHF;
|
static const qint64 loHighLimitFreqHF;
|
||||||
static const qint64 loLowLimitFreqVHF;
|
static const qint64 loLowLimitFreqVHF;
|
||||||
|
@ -164,7 +173,6 @@ private:
|
||||||
bool applySettings(const AirspyHFSettings& settings, bool force);
|
bool applySettings(const AirspyHFSettings& settings, bool force);
|
||||||
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
||||||
void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings);
|
void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings);
|
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "airspyhfplugin.h"
|
#include "airspyhfplugin.h"
|
||||||
|
#include "airspyhfwebapiadapter.h"
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "airspyhfinput.h"
|
#include "airspyhfinput.h"
|
||||||
#else
|
#else
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = {
|
const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = {
|
||||||
QString("AirspyHF Input"),
|
QString("AirspyHF Input"),
|
||||||
QString("4.5.2"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -140,3 +141,8 @@ DeviceSampleSource *AirspyHFPlugin::createSampleSourcePluginInstance(const QStri
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *AirspyHFPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new AirspyHFWebAPIAdapter();
|
||||||
|
}
|
|
@ -42,6 +42,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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
|
set(bladerf1input_SOURCES
|
||||||
bladerf1input.cpp
|
bladerf1input.cpp
|
||||||
bladerf1inputplugin.cpp
|
bladerf1inputplugin.cpp
|
||||||
bladerf1inputsettings.cpp
|
bladerf1inputsettings.cpp
|
||||||
|
bladerf1inputwebapiadapter.cpp
|
||||||
bladerf1inputthread.cpp
|
bladerf1inputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerf1input_HEADERS
|
set(bladerf1input_HEADERS
|
||||||
bladerf1input.h
|
bladerf1input.h
|
||||||
bladerf1inputplugin.h
|
bladerf1inputplugin.h
|
||||||
bladerf1inputsettings.h
|
bladerf1inputsettings.h
|
||||||
|
bladerf1inputwebapiadapter.h
|
||||||
bladerf1inputthread.h
|
bladerf1inputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -667,7 +667,26 @@ int Bladerf1Input::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
BladeRF1InputSettings settings = m_settings;
|
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")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getBladeRf1InputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getBladeRf1InputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -722,18 +741,6 @@ int Bladerf1Input::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf1InputSettings()->getReverseApiDeviceIndex();
|
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(
|
int Bladerf1Input::webapiRunGet(
|
||||||
|
|
|
@ -138,6 +138,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const BladeRF1InputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
BladeRF1InputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -155,7 +164,6 @@ private:
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
bool applySettings(const BladeRF1InputSettings& settings, bool force);
|
bool applySettings(const BladeRF1InputSettings& settings, bool force);
|
||||||
bladerf_lna_gain getLnaGain(int lnaGain);
|
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 webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
#include "bladerf1inputwebapiadapter.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "bladerf1input.h"
|
#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,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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
|
set(bladerf2input_SOURCES
|
||||||
bladerf2input.cpp
|
bladerf2input.cpp
|
||||||
bladerf2inputplugin.cpp
|
bladerf2inputplugin.cpp
|
||||||
bladerf2inputsettings.cpp
|
bladerf2inputsettings.cpp
|
||||||
|
bladerf2inputwebapiadapter.cpp
|
||||||
bladerf2inputthread.cpp
|
bladerf2inputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerf2input_HEADERS
|
set(bladerf2input_HEADERS
|
||||||
bladerf2input.h
|
bladerf2input.h
|
||||||
bladerf2inputplugin.h
|
bladerf2inputplugin.h
|
||||||
bladerf2inputsettings.h
|
bladerf2inputsettings.h
|
||||||
|
bladerf2inputwebapiadapter.h
|
||||||
bladerf2inputthread.h
|
bladerf2inputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1056,7 +1056,26 @@ int BladeRF2Input::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
BladeRF2InputSettings settings = m_settings;
|
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")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getBladeRf2InputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getBladeRf2InputSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -1111,18 +1130,6 @@ int BladeRF2Input::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf2InputSettings()->getReverseApiDeviceIndex();
|
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)
|
int BladeRF2Input::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage)
|
||||||
|
|
|
@ -182,6 +182,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
static void webapiFormatDeviceSettings(
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
|
const BladeRF2InputSettings& settings);
|
||||||
|
|
||||||
|
static void webapiUpdateDeviceSettings(
|
||||||
|
BladeRF2InputSettings& settings,
|
||||||
|
const QStringList& deviceSettingsKeys,
|
||||||
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -201,7 +210,6 @@ private:
|
||||||
void moveThreadToBuddy();
|
void moveThreadToBuddy();
|
||||||
bool applySettings(const BladeRF2InputSettings& settings, bool force = false);
|
bool applySettings(const BladeRF2InputSettings& settings, bool force = false);
|
||||||
bool setDeviceCenterFrequency(struct bladerf *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
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 webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2InputSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2InputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
#include "bladerf2inputwebapiadapter.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "bladerf2input.h"
|
#include "bladerf2input.h"
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
const PluginDescriptor Blderf2InputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor Blderf2InputPlugin::m_pluginDescriptor = {
|
||||||
QString("BladeRF2 Input"),
|
QString("BladeRF2 Input"),
|
||||||
QString("4.5.4"),
|
QString("4.11.6"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -120,7 +121,7 @@ PluginInstanceGUI* Blderf2InputPlugin::createSampleSourcePluginInstanceGUI(
|
||||||
{
|
{
|
||||||
(void) sourceId;
|
(void) sourceId;
|
||||||
(void) widget;
|
(void) widget;
|
||||||
(void) deviceUISet;
|
(void) deviceUISet;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -155,6 +156,7 @@ DeviceSampleSource *Blderf2InputPlugin::createSampleSourcePluginInstance(const Q
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *Blderf2InputPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new BladeRF2InputWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
static const QString m_hardwareID;
|
static const QString m_hardwareID;
|
||||||
static const QString m_deviceTypeID;
|
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
|
set(fcdpro_SOURCES
|
||||||
fcdproinput.cpp
|
fcdproinput.cpp
|
||||||
fcdproplugin.cpp
|
fcdproplugin.cpp
|
||||||
fcdprosettings.cpp
|
fcdprosettings.cpp
|
||||||
|
fcdprowebapiadapter.cpp
|
||||||
fcdprothread.cpp
|
fcdprothread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(fcdpro_HEADERS
|
set(fcdpro_HEADERS
|
||||||
fcdproinput.h
|
fcdproinput.h
|
||||||
fcdproplugin.h
|
fcdproplugin.h
|
||||||
fcdprosettings.h
|
fcdprosettings.h
|
||||||
|
fcdprowebapiadapter.h
|
||||||
fcdprothread.h
|
fcdprothread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,26 @@ int FCDProInput::webapiSettingsPutPatch(
|
||||||
{
|
{
|
||||||
(void) errorMessage;
|
(void) errorMessage;
|
||||||
FCDProSettings settings = m_settings;
|
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")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getFcdProSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getFcdProSettings()->getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
@ -961,18 +980,6 @@ int FCDProInput::webapiSettingsPutPatch(
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getFcdProSettings()->getReverseApiDeviceIndex();
|
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)
|
void FCDProInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FCDProSettings& settings)
|
||||||
|
|
|
@ -145,6 +145,15 @@ public:
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
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_center_freq(double freq);
|
||||||
void set_bias_t(bool on);
|
void set_bias_t(bool on);
|
||||||
void set_lnaGain(int index);
|
void set_lnaGain(int index);
|
||||||
|
@ -184,7 +193,6 @@ private:
|
||||||
void closeFCDAudio();
|
void closeFCDAudio();
|
||||||
void applySettings(const FCDProSettings& settings, bool force);
|
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 webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const FCDProSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "fcdproplugin.h"
|
#include "fcdproplugin.h"
|
||||||
|
#include "fcdprowebapiadapter.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "fcdproinput.h"
|
#include "fcdproinput.h"
|
||||||
|
@ -122,3 +123,8 @@ DeviceSampleSource *FCDProPlugin::createSampleSourcePluginInstance(const QString
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceWebAPIAdapter *FCDProPlugin::createDeviceWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new FCDProWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet);
|
DeviceUISet *deviceUISet);
|
||||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||||
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
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
|
set(fcdproplus_SOURCES
|
||||||
fcdproplusinput.cpp
|
fcdproplusinput.cpp
|
||||||
fcdproplusplugin.cpp
|
fcdproplusplugin.cpp
|
||||||
fcdproplussettings.cpp
|
fcdproplussettings.cpp
|
||||||
|
fcdpropluswebapiadapter.cpp
|
||||||
fcdproplusthread.cpp
|
fcdproplusthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(fcdproplus_HEADERS
|
set(fcdproplus_HEADERS
|
||||||
fcdproplusinput.h
|
fcdproplusinput.h
|
||||||
fcdproplusplugin.h
|
fcdproplusplugin.h
|
||||||
fcdproplussettings.h
|
fcdproplussettings.h
|
||||||
|
fcdpropluswebapiadapter.h
|
||||||
fcdproplusthread.h
|
fcdproplusthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue