mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-25 05:25:27 -04:00
REST API: config (8): preset channel Tx adapters where there is CW keyer. AM mod working only
This commit is contained in:
parent
9610a6b93a
commit
68a4e23fb0
@ -4,12 +4,14 @@ set(modam_SOURCES
|
|||||||
ammod.cpp
|
ammod.cpp
|
||||||
ammodplugin.cpp
|
ammodplugin.cpp
|
||||||
ammodsettings.cpp
|
ammodsettings.cpp
|
||||||
|
ammodwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(modam_HEADERS
|
set(modam_HEADERS
|
||||||
ammod.h
|
ammod.h
|
||||||
ammodplugin.h
|
ammodplugin.h
|
||||||
ammodsettings.h
|
ammodsettings.h
|
||||||
|
ammodwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
#include "ammodgui.h"
|
#include "ammodgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "ammod.h"
|
#include "ammod.h"
|
||||||
|
#include "ammodwebapiadapter.h"
|
||||||
#include "ammodplugin.h"
|
#include "ammodplugin.h"
|
||||||
|
|
||||||
const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
|
const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
|
||||||
QString("AM Modulator"),
|
QString("AM Modulator"),
|
||||||
QString("4.11.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,
|
||||||
@ -76,3 +77,7 @@ ChannelAPI* AMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) const
|
|||||||
return new AMMod(deviceAPI);
|
return new AMMod(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelAPI* AMModPlugin::createChannelWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new AMModWebAPIAdapter();
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
||||||
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
||||||
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
||||||
|
virtual ChannelAPI* createChannelWebAPIAdapter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
@ -65,6 +65,8 @@ QByteArray AMModSettings::serialize() const
|
|||||||
|
|
||||||
if (m_cwKeyerGUI) {
|
if (m_cwKeyerGUI) {
|
||||||
s.writeBlob(7, m_cwKeyerGUI->serialize());
|
s.writeBlob(7, m_cwKeyerGUI->serialize());
|
||||||
|
} else { // standalone operation with presets
|
||||||
|
s.writeBlob(7, m_cwKeyerSettings.serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_channelMarker) {
|
if (m_channelMarker) {
|
||||||
@ -109,9 +111,10 @@ bool AMModSettings::deserialize(const QByteArray& data)
|
|||||||
d.readReal(4, &m_modFactor, 0.2f);
|
d.readReal(4, &m_modFactor, 0.2f);
|
||||||
d.readU32(5, &m_rgbColor);
|
d.readU32(5, &m_rgbColor);
|
||||||
d.readReal(6, &m_volumeFactor, 1.0);
|
d.readReal(6, &m_volumeFactor, 1.0);
|
||||||
|
d.readBlob(7, &bytetmp);
|
||||||
|
m_cwKeyerSettings.deserialize(bytetmp);
|
||||||
|
|
||||||
if (m_cwKeyerGUI) {
|
if (m_cwKeyerGUI) {
|
||||||
d.readBlob(7, &bytetmp);
|
|
||||||
m_cwKeyerGUI->deserialize(bytetmp);
|
m_cwKeyerGUI->deserialize(bytetmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
|
#include "dsp/cwkeyersettings.h"
|
||||||
|
|
||||||
class Serializable;
|
class Serializable;
|
||||||
|
|
||||||
struct AMModSettings
|
struct AMModSettings
|
||||||
@ -56,12 +58,16 @@ struct AMModSettings
|
|||||||
Serializable *m_channelMarker;
|
Serializable *m_channelMarker;
|
||||||
Serializable *m_cwKeyerGUI;
|
Serializable *m_cwKeyerGUI;
|
||||||
|
|
||||||
|
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
|
||||||
|
|
||||||
AMModSettings();
|
AMModSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
|
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
|
const CWKeyerSettings& getCWKeyerSettings() const { return m_cwKeyerSettings; }
|
||||||
|
void setCWKeyerSettings(const CWKeyerSettings& cwKeyerSettings) { m_cwKeyerSettings = cwKeyerSettings; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
66
plugins/channeltx/modam/ammodwebapiadapter.cpp
Normal file
66
plugins/channeltx/modam/ammodwebapiadapter.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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 "SWGChannelSettings.h"
|
||||||
|
#include "ammod.h"
|
||||||
|
#include "ammodwebapiadapter.h"
|
||||||
|
|
||||||
|
AMModWebAPIAdapter::AMModWebAPIAdapter() :
|
||||||
|
ChannelAPI(AMMod::m_channelIdURI, ChannelAPI::StreamSingleSource)
|
||||||
|
{}
|
||||||
|
|
||||||
|
AMModWebAPIAdapter::~AMModWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int AMModWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setAmModSettings(new SWGSDRangel::SWGAMModSettings());
|
||||||
|
response.getAmModSettings()->init();
|
||||||
|
AMMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
|
||||||
|
const CWKeyerSettings& cwKeyerSettings = m_settings.getCWKeyerSettings();
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer();
|
||||||
|
apiCwKeyerSettings->init();
|
||||||
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AMModWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
AMMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
|
||||||
|
|
||||||
|
if (channelSettingsKeys.contains("cwKeyer"))
|
||||||
|
{
|
||||||
|
CWKeyerSettings newCWKeyerSettings;
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings);
|
||||||
|
m_settings.setCWKeyerSettings(newCWKeyerSettings);
|
||||||
|
const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings
|
||||||
|
}
|
||||||
|
|
||||||
|
AMMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
66
plugins/channeltx/modam/ammodwebapiadapter.h
Normal file
66
plugins/channeltx/modam/ammodwebapiadapter.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDE_AMMOD_WEBAPIADAPTER_H
|
||||||
|
#define INCLUDE_AMMOD_WEBAPIADAPTER_H
|
||||||
|
|
||||||
|
#include "channel/channelapi.h"
|
||||||
|
#include "dsp/cwkeyersettings.h"
|
||||||
|
#include "ammodsettings.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standalone API adapter only for the settings
|
||||||
|
*/
|
||||||
|
class AMModWebAPIAdapter : public ChannelAPI {
|
||||||
|
public:
|
||||||
|
AMModWebAPIAdapter();
|
||||||
|
virtual ~AMModWebAPIAdapter();
|
||||||
|
|
||||||
|
// unused pure virtual methods
|
||||||
|
virtual void destroy() {}
|
||||||
|
virtual void getIdentifier(QString& id) {}
|
||||||
|
virtual void getTitle(QString& title) {}
|
||||||
|
virtual qint64 getCenterFrequency() const { return 0; }
|
||||||
|
virtual int getNbSinkStreams() const { return 1; }
|
||||||
|
virtual int getNbSourceStreams() const { return 0; }
|
||||||
|
|
||||||
|
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||||
|
{
|
||||||
|
(void) streamIndex;
|
||||||
|
(void) sinkElseSource;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual methods actually implemented
|
||||||
|
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||||
|
virtual bool deserialize(const QByteArray& data) { m_settings.deserialize(data); }
|
||||||
|
|
||||||
|
virtual int webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
AMModSettings m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_AMMOD_WEBAPIADAPTER_H
|
@ -4,12 +4,14 @@ set(modfreedv_SOURCES
|
|||||||
freedvmod.cpp
|
freedvmod.cpp
|
||||||
freedvmodplugin.cpp
|
freedvmodplugin.cpp
|
||||||
freedvmodsettings.cpp
|
freedvmodsettings.cpp
|
||||||
|
freedvmodwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(modfreedv_HEADERS
|
set(modfreedv_HEADERS
|
||||||
freedvmod.h
|
freedvmod.h
|
||||||
freedvmodplugin.h
|
freedvmodplugin.h
|
||||||
freedvmodsettings.h
|
freedvmodsettings.h
|
||||||
|
freedvmodwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
#include "freedvmodgui.h"
|
#include "freedvmodgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "freedvmod.h"
|
#include "freedvmod.h"
|
||||||
|
#include "freedvmodwebapiadapter.h"
|
||||||
#include "freedvmodplugin.h"
|
#include "freedvmodplugin.h"
|
||||||
|
|
||||||
const PluginDescriptor FreeDVModPlugin::m_pluginDescriptor = {
|
const PluginDescriptor FreeDVModPlugin::m_pluginDescriptor = {
|
||||||
QString("FreeDV Modulator"),
|
QString("FreeDV Modulator"),
|
||||||
QString("4.11.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,
|
||||||
@ -76,4 +77,7 @@ ChannelAPI* FreeDVModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) const
|
|||||||
return new FreeDVMod(deviceAPI);
|
return new FreeDVMod(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelAPI* FreeDVModPlugin::createChannelWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new FreeDVModWebAPIAdapter();
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
||||||
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
||||||
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
||||||
|
virtual ChannelAPI* createChannelWebAPIAdapter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
81
plugins/channeltx/modfreedv/freedvmodwebapiadapter.cpp
Normal file
81
plugins/channeltx/modfreedv/freedvmodwebapiadapter.cpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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 "SWGChannelSettings.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
#include "freedvmod.h"
|
||||||
|
#include "freedvmodwebapiadapter.h"
|
||||||
|
|
||||||
|
FreeDVModWebAPIAdapter::FreeDVModWebAPIAdapter() :
|
||||||
|
ChannelAPI(FreeDVMod::m_channelIdURI, ChannelAPI::StreamSingleSource)
|
||||||
|
{}
|
||||||
|
|
||||||
|
FreeDVModWebAPIAdapter::~FreeDVModWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int FreeDVModWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setFreeDvModSettings(new SWGSDRangel::SWGFreeDVModSettings());
|
||||||
|
response.getFreeDvModSettings()->init();
|
||||||
|
FreeDVMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FreeDVModWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
FreeDVMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
|
||||||
|
const QByteArray& serializedNewCWKeyerSettings = cwKeyerSettings.serialize();
|
||||||
|
cwKeyerGUI->deserialize(serializedNewCWKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeDVMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
65
plugins/channeltx/modfreedv/freedvmodwebapiadapter.h
Normal file
65
plugins/channeltx/modfreedv/freedvmodwebapiadapter.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDE_FREEDVMOD_WEBAPIADAPTER_H
|
||||||
|
#define INCLUDE_FREEDVMOD_WEBAPIADAPTER_H
|
||||||
|
|
||||||
|
#include "channel/channelapi.h"
|
||||||
|
#include "freedvmodsettings.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standalone API adapter only for the settings
|
||||||
|
*/
|
||||||
|
class FreeDVModWebAPIAdapter : public ChannelAPI {
|
||||||
|
public:
|
||||||
|
FreeDVModWebAPIAdapter();
|
||||||
|
virtual ~FreeDVModWebAPIAdapter();
|
||||||
|
|
||||||
|
// unused pure virtual methods
|
||||||
|
virtual void destroy() {}
|
||||||
|
virtual void getIdentifier(QString& id) {}
|
||||||
|
virtual void getTitle(QString& title) {}
|
||||||
|
virtual qint64 getCenterFrequency() const { return 0; }
|
||||||
|
virtual int getNbSinkStreams() const { return 1; }
|
||||||
|
virtual int getNbSourceStreams() const { return 0; }
|
||||||
|
|
||||||
|
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||||
|
{
|
||||||
|
(void) streamIndex;
|
||||||
|
(void) sinkElseSource;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual methods actually implemented
|
||||||
|
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||||
|
virtual bool deserialize(const QByteArray& data) { m_settings.deserialize(data); }
|
||||||
|
|
||||||
|
virtual int webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FreeDVModSettings m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_FREEDVMOD_WEBAPIADAPTER_H
|
@ -4,12 +4,14 @@ set(modnfm_SOURCES
|
|||||||
nfmmod.cpp
|
nfmmod.cpp
|
||||||
nfmmodplugin.cpp
|
nfmmodplugin.cpp
|
||||||
nfmmodsettings.cpp
|
nfmmodsettings.cpp
|
||||||
|
nfmmodwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(modnfm_HEADERS
|
set(modnfm_HEADERS
|
||||||
nfmmod.h
|
nfmmod.h
|
||||||
nfmmodplugin.h
|
nfmmodplugin.h
|
||||||
nfmmodsettings.h
|
nfmmodsettings.h
|
||||||
|
nfmmodwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
#include "nfmmodgui.h"
|
#include "nfmmodgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "nfmmod.h"
|
#include "nfmmod.h"
|
||||||
|
#include "nfmmodwebapiadapter.h"
|
||||||
#include "nfmmodplugin.h"
|
#include "nfmmodplugin.h"
|
||||||
|
|
||||||
const PluginDescriptor NFMModPlugin::m_pluginDescriptor = {
|
const PluginDescriptor NFMModPlugin::m_pluginDescriptor = {
|
||||||
QString("NFM Modulator"),
|
QString("NFM Modulator"),
|
||||||
QString("4.11.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,
|
||||||
@ -76,4 +77,7 @@ ChannelAPI* NFMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) const
|
|||||||
return new NFMMod(deviceAPI);
|
return new NFMMod(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelAPI* NFMModPlugin::createChannelWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new NFMModWebAPIAdapter();
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel) const;
|
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel) const;
|
||||||
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
||||||
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
||||||
|
virtual ChannelAPI* createChannelWebAPIAdapter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
81
plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp
Normal file
81
plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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 "SWGChannelSettings.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
#include "nfmmod.h"
|
||||||
|
#include "nfmmodwebapiadapter.h"
|
||||||
|
|
||||||
|
NFMModWebAPIAdapter::NFMModWebAPIAdapter() :
|
||||||
|
ChannelAPI(NFMMod::m_channelIdURI, ChannelAPI::StreamSingleSource)
|
||||||
|
{}
|
||||||
|
|
||||||
|
NFMModWebAPIAdapter::~NFMModWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int NFMModWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
|
||||||
|
response.getNfmModSettings()->init();
|
||||||
|
NFMMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NFMModWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
NFMMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
|
||||||
|
const QByteArray& serializedNewCWKeyerSettings = cwKeyerSettings.serialize();
|
||||||
|
cwKeyerGUI->deserialize(serializedNewCWKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NFMMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
65
plugins/channeltx/modnfm/nfmmodwebapiadapter.h
Normal file
65
plugins/channeltx/modnfm/nfmmodwebapiadapter.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDE_NFMMOD_WEBAPIADAPTER_H
|
||||||
|
#define INCLUDE_NFMMOD_WEBAPIADAPTER_H
|
||||||
|
|
||||||
|
#include "channel/channelapi.h"
|
||||||
|
#include "nfmmodsettings.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standalone API adapter only for the settings
|
||||||
|
*/
|
||||||
|
class NFMModWebAPIAdapter : public ChannelAPI {
|
||||||
|
public:
|
||||||
|
NFMModWebAPIAdapter();
|
||||||
|
virtual ~NFMModWebAPIAdapter();
|
||||||
|
|
||||||
|
// unused pure virtual methods
|
||||||
|
virtual void destroy() {}
|
||||||
|
virtual void getIdentifier(QString& id) {}
|
||||||
|
virtual void getTitle(QString& title) {}
|
||||||
|
virtual qint64 getCenterFrequency() const { return 0; }
|
||||||
|
virtual int getNbSinkStreams() const { return 1; }
|
||||||
|
virtual int getNbSourceStreams() const { return 0; }
|
||||||
|
|
||||||
|
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||||
|
{
|
||||||
|
(void) streamIndex;
|
||||||
|
(void) sinkElseSource;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual methods actually implemented
|
||||||
|
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||||
|
virtual bool deserialize(const QByteArray& data) { m_settings.deserialize(data); }
|
||||||
|
|
||||||
|
virtual int webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
NFMModSettings m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_NFMMOD_WEBAPIADAPTER_H
|
@ -4,12 +4,14 @@ set(modssb_SOURCES
|
|||||||
ssbmod.cpp
|
ssbmod.cpp
|
||||||
ssbmodplugin.cpp
|
ssbmodplugin.cpp
|
||||||
ssbmodsettings.cpp
|
ssbmodsettings.cpp
|
||||||
|
ssbmodwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(modssb_HEADERS
|
set(modssb_HEADERS
|
||||||
ssbmod.h
|
ssbmod.h
|
||||||
ssbmodplugin.h
|
ssbmodplugin.h
|
||||||
ssbmodsettings.h
|
ssbmodsettings.h
|
||||||
|
ssbmodwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
#include "ssbmodgui.h"
|
#include "ssbmodgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "ssbmod.h"
|
#include "ssbmod.h"
|
||||||
|
#include "ssbmodwebapiadapter.h"
|
||||||
#include "ssbmodplugin.h"
|
#include "ssbmodplugin.h"
|
||||||
|
|
||||||
const PluginDescriptor SSBModPlugin::m_pluginDescriptor = {
|
const PluginDescriptor SSBModPlugin::m_pluginDescriptor = {
|
||||||
QString("SSB Modulator"),
|
QString("SSB Modulator"),
|
||||||
QString("4.11.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,
|
||||||
@ -76,4 +77,8 @@ ChannelAPI* SSBModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) const
|
|||||||
return new SSBMod(deviceAPI);
|
return new SSBMod(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelAPI* SSBModPlugin::createChannelWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new SSBModWebAPIAdapter();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
||||||
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
||||||
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
||||||
|
virtual ChannelAPI* createChannelWebAPIAdapter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
81
plugins/channeltx/modssb/ssbmodwebapiadapter.cpp
Normal file
81
plugins/channeltx/modssb/ssbmodwebapiadapter.cpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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 "SWGChannelSettings.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
#include "ssbmod.h"
|
||||||
|
#include "ssbmodwebapiadapter.h"
|
||||||
|
|
||||||
|
SSBModWebAPIAdapter::SSBModWebAPIAdapter() :
|
||||||
|
ChannelAPI(SSBMod::m_channelIdURI, ChannelAPI::StreamSingleSource)
|
||||||
|
{}
|
||||||
|
|
||||||
|
SSBModWebAPIAdapter::~SSBModWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int SSBModWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setSsbModSettings(new SWGSDRangel::SWGSSBModSettings());
|
||||||
|
response.getSsbModSettings()->init();
|
||||||
|
SSBMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getSsbModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SSBModWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
SSBMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getSsbModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
|
||||||
|
const QByteArray& serializedNewCWKeyerSettings = cwKeyerSettings.serialize();
|
||||||
|
cwKeyerGUI->deserialize(serializedNewCWKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SSBMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
65
plugins/channeltx/modssb/ssbmodwebapiadapter.h
Normal file
65
plugins/channeltx/modssb/ssbmodwebapiadapter.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDE_SSBMOD_WEBAPIADAPTER_H
|
||||||
|
#define INCLUDE_SSBMOD_WEBAPIADAPTER_H
|
||||||
|
|
||||||
|
#include "channel/channelapi.h"
|
||||||
|
#include "ssbmodsettings.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standalone API adapter only for the settings
|
||||||
|
*/
|
||||||
|
class SSBModWebAPIAdapter : public ChannelAPI {
|
||||||
|
public:
|
||||||
|
SSBModWebAPIAdapter();
|
||||||
|
virtual ~SSBModWebAPIAdapter();
|
||||||
|
|
||||||
|
// unused pure virtual methods
|
||||||
|
virtual void destroy() {}
|
||||||
|
virtual void getIdentifier(QString& id) {}
|
||||||
|
virtual void getTitle(QString& title) {}
|
||||||
|
virtual qint64 getCenterFrequency() const { return 0; }
|
||||||
|
virtual int getNbSinkStreams() const { return 1; }
|
||||||
|
virtual int getNbSourceStreams() const { return 0; }
|
||||||
|
|
||||||
|
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||||
|
{
|
||||||
|
(void) streamIndex;
|
||||||
|
(void) sinkElseSource;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual methods actually implemented
|
||||||
|
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||||
|
virtual bool deserialize(const QByteArray& data) { m_settings.deserialize(data); }
|
||||||
|
|
||||||
|
virtual int webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SSBModSettings m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_SSBMOD_WEBAPIADAPTER_H
|
@ -4,12 +4,14 @@ set(modwfm_SOURCES
|
|||||||
wfmmod.cpp
|
wfmmod.cpp
|
||||||
wfmmodplugin.cpp
|
wfmmodplugin.cpp
|
||||||
wfmmodsettings.cpp
|
wfmmodsettings.cpp
|
||||||
|
wfmmodwebapiadapter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(modwfm_HEADERS
|
set(modwfm_HEADERS
|
||||||
wfmmod.h
|
wfmmod.h
|
||||||
wfmmodplugin.h
|
wfmmodplugin.h
|
||||||
wfmmodsettings.h
|
wfmmodsettings.h
|
||||||
|
wfmmodwebapiadapter.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
#include "wfmmodgui.h"
|
#include "wfmmodgui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "wfmmod.h"
|
#include "wfmmod.h"
|
||||||
|
#include "wfmmodwebapiadapter.h"
|
||||||
#include "wfmmodplugin.h"
|
#include "wfmmodplugin.h"
|
||||||
|
|
||||||
const PluginDescriptor WFMModPlugin::m_pluginDescriptor = {
|
const PluginDescriptor WFMModPlugin::m_pluginDescriptor = {
|
||||||
QString("WFM Modulator"),
|
QString("WFM Modulator"),
|
||||||
QString("4.11.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,
|
||||||
@ -76,4 +77,7 @@ ChannelAPI* WFMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) const
|
|||||||
return new WFMMod(deviceAPI);
|
return new WFMMod(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelAPI* WFMModPlugin::createChannelWebAPIAdapter() const
|
||||||
|
{
|
||||||
|
return new WFMModWebAPIAdapter();
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
||||||
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const;
|
||||||
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const;
|
||||||
|
virtual ChannelAPI* createChannelWebAPIAdapter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
81
plugins/channeltx/modwfm/wfmmodwebapiadapter.cpp
Normal file
81
plugins/channeltx/modwfm/wfmmodwebapiadapter.cpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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 "SWGChannelSettings.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
#include "wfmmod.h"
|
||||||
|
#include "wfmmodwebapiadapter.h"
|
||||||
|
|
||||||
|
WFMModWebAPIAdapter::WFMModWebAPIAdapter() :
|
||||||
|
ChannelAPI(WFMMod::m_channelIdURI, ChannelAPI::StreamSingleSource)
|
||||||
|
{}
|
||||||
|
|
||||||
|
WFMModWebAPIAdapter::~WFMModWebAPIAdapter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
int WFMModWebAPIAdapter::webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.setWfmModSettings(new SWGSDRangel::SWGWFMModSettings());
|
||||||
|
response.getWfmModSettings()->init();
|
||||||
|
WFMMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WFMModWebAPIAdapter::webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage)
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
WFMMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
|
||||||
|
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
|
||||||
|
|
||||||
|
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
|
||||||
|
{
|
||||||
|
const QByteArray& serializedCWKeyerSettings = cwKeyerGUI->serialize();
|
||||||
|
CWKeyerSettings cwKeyerSettings;
|
||||||
|
|
||||||
|
if (cwKeyerSettings.deserialize(serializedCWKeyerSettings))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
|
||||||
|
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
|
||||||
|
const QByteArray& serializedNewCWKeyerSettings = cwKeyerSettings.serialize();
|
||||||
|
cwKeyerGUI->deserialize(serializedNewCWKeyerSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WFMMod::webapiFormatChannelSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
65
plugins/channeltx/modwfm/wfmmodwebapiadapter.h
Normal file
65
plugins/channeltx/modwfm/wfmmodwebapiadapter.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDE_WFMMOD_WEBAPIADAPTER_H
|
||||||
|
#define INCLUDE_WFMMOD_WEBAPIADAPTER_H
|
||||||
|
|
||||||
|
#include "channel/channelapi.h"
|
||||||
|
#include "wfmmodsettings.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standalone API adapter only for the settings
|
||||||
|
*/
|
||||||
|
class WFMModWebAPIAdapter : public ChannelAPI {
|
||||||
|
public:
|
||||||
|
WFMModWebAPIAdapter();
|
||||||
|
virtual ~WFMModWebAPIAdapter();
|
||||||
|
|
||||||
|
// unused pure virtual methods
|
||||||
|
virtual void destroy() {}
|
||||||
|
virtual void getIdentifier(QString& id) {}
|
||||||
|
virtual void getTitle(QString& title) {}
|
||||||
|
virtual qint64 getCenterFrequency() const { return 0; }
|
||||||
|
virtual int getNbSinkStreams() const { return 1; }
|
||||||
|
virtual int getNbSourceStreams() const { return 0; }
|
||||||
|
|
||||||
|
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||||
|
{
|
||||||
|
(void) streamIndex;
|
||||||
|
(void) sinkElseSource;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual methods actually implemented
|
||||||
|
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||||
|
virtual bool deserialize(const QByteArray& data) { m_settings.deserialize(data); }
|
||||||
|
|
||||||
|
virtual int webapiSettingsGet(
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiSettingsPutPatch(
|
||||||
|
bool force,
|
||||||
|
const QStringList& channelSettingsKeys,
|
||||||
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
WFMModSettings m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_WFMMOD_WEBAPIADAPTER_H
|
Loading…
x
Reference in New Issue
Block a user