REST API: config (9): preset channel Tx adapters where there is CW keyer. Fixed the rest of the modulators

This commit is contained in:
f4exb 2019-08-03 01:47:36 +02:00
parent 68a4e23fb0
commit ae49f17484
13 changed files with 86 additions and 105 deletions

View File

@ -112,10 +112,11 @@ bool AMModSettings::deserialize(const QByteArray& data)
d.readU32(5, &m_rgbColor);
d.readReal(6, &m_volumeFactor, 1.0);
d.readBlob(7, &bytetmp);
m_cwKeyerSettings.deserialize(bytetmp);
if (m_cwKeyerGUI) {
m_cwKeyerGUI->deserialize(bytetmp);
} else { // standalone operation with presets
m_cwKeyerSettings.deserialize(bytetmp);
}
if (m_channelMarker) {

View File

@ -66,6 +66,8 @@ QByteArray FreeDVModSettings::serialize() const
if (m_cwKeyerGUI) {
s.writeBlob(6, m_cwKeyerGUI->serialize());
} else { // standalone operation with presets
s.writeBlob(6, m_cwKeyerSettings.serialize());
}
s.writeBool(7, m_gaugeInputElseModem);
@ -117,10 +119,12 @@ bool FreeDVModSettings::deserialize(const QByteArray& data)
}
d.readU32(5, &m_rgbColor);
d.readBlob(6, &bytetmp);
if (m_cwKeyerGUI) {
d.readBlob(6, &bytetmp);
m_cwKeyerGUI->deserialize(bytetmp);
} else { // standalone operation with presets
m_cwKeyerSettings.deserialize(bytetmp);
}
d.readBool(7, &m_gaugeInputElseModem, false);

View File

@ -22,6 +22,8 @@
#include <QString>
#include <stdint.h>
#include "dsp/cwkeyersettings.h"
class Serializable;
struct FreeDVModSettings
@ -68,6 +70,8 @@ struct FreeDVModSettings
Serializable *m_spectrumGUI;
Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
FreeDVModSettings();
void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
@ -75,6 +79,8 @@ struct FreeDVModSettings
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
const CWKeyerSettings& getCWKeyerSettings() const { return m_cwKeyerSettings; }
void setCWKeyerSettings(const CWKeyerSettings& cwKeyerSettings) { m_cwKeyerSettings = cwKeyerSettings; }
static int getHiCutoff(FreeDVMode freeDVMode);
static int getLowCutoff(FreeDVMode freeDVMode);

View File

@ -16,7 +16,6 @@
///////////////////////////////////////////////////////////////////////////////////
#include "SWGChannelSettings.h"
#include "settings/serializable.h"
#include "freedvmod.h"
#include "freedvmodwebapiadapter.h"
@ -35,19 +34,11 @@ int FreeDVModWebAPIAdapter::webapiSettingsGet(
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);
}
}
const CWKeyerSettings& cwKeyerSettings = m_settings.getCWKeyerSettings();
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
apiCwKeyerSettings->init();
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
return 200;
}
@ -60,20 +51,14 @@ int FreeDVModWebAPIAdapter::webapiSettingsPutPatch(
{
(void) errorMessage;
FreeDVMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
if (channelSettingsKeys.contains("cwKeyer"))
{
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);
}
CWKeyerSettings newCWKeyerSettings;
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings);
m_settings.setCWKeyerSettings(newCWKeyerSettings);
const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings
}
FreeDVMod::webapiFormatChannelSettings(response, m_settings);

View File

@ -84,6 +84,8 @@ QByteArray NFMModSettings::serialize() const
if (m_cwKeyerGUI) {
s.writeBlob(8, m_cwKeyerGUI->serialize());
} else { // standalone operation with presets
s.writeBlob(6, m_cwKeyerSettings.serialize());
}
if (m_channelMarker) {
@ -131,10 +133,12 @@ bool NFMModSettings::deserialize(const QByteArray& data)
d.readU32(5, &m_rgbColor);
d.readReal(6, &m_toneFrequency, 1000.0);
d.readReal(7, &m_volumeFactor, 1.0);
d.readBlob(8, &bytetmp);
if (m_cwKeyerGUI) {
d.readBlob(8, &bytetmp);
m_cwKeyerGUI->deserialize(bytetmp);
} else { // standalone operation with presets
m_cwKeyerSettings.deserialize(bytetmp);
}
d.readBool(9, &m_ctcssOn, false);

View File

@ -20,6 +20,8 @@
#include <QByteArray>
#include "dsp/cwkeyersettings.h"
class Serializable;
struct NFMModSettings
@ -64,12 +66,16 @@ struct NFMModSettings
Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
NFMModSettings();
void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
const CWKeyerSettings& getCWKeyerSettings() const { return m_cwKeyerSettings; }
void setCWKeyerSettings(const CWKeyerSettings& cwKeyerSettings) { m_cwKeyerSettings = cwKeyerSettings; }
static int getRFBW(int index);
static int getRFBWIndex(int rfbw);

View File

@ -16,7 +16,6 @@
///////////////////////////////////////////////////////////////////////////////////
#include "SWGChannelSettings.h"
#include "settings/serializable.h"
#include "nfmmod.h"
#include "nfmmodwebapiadapter.h"
@ -35,19 +34,11 @@ int NFMModWebAPIAdapter::webapiSettingsGet(
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);
}
}
const CWKeyerSettings& cwKeyerSettings = m_settings.getCWKeyerSettings();
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
apiCwKeyerSettings->init();
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
return 200;
}
@ -60,20 +51,14 @@ int NFMModWebAPIAdapter::webapiSettingsPutPatch(
{
(void) errorMessage;
NFMMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
if (channelSettingsKeys.contains("cwKeyer"))
{
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);
}
CWKeyerSettings newCWKeyerSettings;
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings);
m_settings.setCWKeyerSettings(newCWKeyerSettings);
const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings
}
NFMMod::webapiFormatChannelSettings(response, m_settings);

View File

@ -89,6 +89,8 @@ QByteArray SSBModSettings::serialize() const
if (m_cwKeyerGUI) {
s.writeBlob(6, m_cwKeyerGUI->serialize());
} else { // standalone operation with presets
s.writeBlob(6, m_cwKeyerSettings.serialize());
}
s.writeS32(7, roundf(m_lowCutoff / 100.0));
@ -149,10 +151,12 @@ bool SSBModSettings::deserialize(const QByteArray& data)
}
d.readU32(5, &m_rgbColor);
d.readBlob(6, &bytetmp);
if (m_cwKeyerGUI) {
d.readBlob(6, &bytetmp);
m_cwKeyerGUI->deserialize(bytetmp);
} else { // standalone operation with presets
m_cwKeyerSettings.deserialize(bytetmp);
}
d.readS32(7, &tmp, 3);

View File

@ -22,6 +22,8 @@
#include <QString>
#include <stdint.h>
#include "dsp/cwkeyersettings.h"
class Serializable;
struct SSBModSettings
@ -70,6 +72,8 @@ struct SSBModSettings
Serializable *m_spectrumGUI;
Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
SSBModSettings();
void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
@ -77,6 +81,8 @@ struct SSBModSettings
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
const CWKeyerSettings& getCWKeyerSettings() const { return m_cwKeyerSettings; }
void setCWKeyerSettings(const CWKeyerSettings& cwKeyerSettings) { m_cwKeyerSettings = cwKeyerSettings; }
};

View File

@ -16,7 +16,6 @@
///////////////////////////////////////////////////////////////////////////////////
#include "SWGChannelSettings.h"
#include "settings/serializable.h"
#include "ssbmod.h"
#include "ssbmodwebapiadapter.h"
@ -35,19 +34,11 @@ int SSBModWebAPIAdapter::webapiSettingsGet(
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);
}
}
const CWKeyerSettings& cwKeyerSettings = m_settings.getCWKeyerSettings();
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getSsbModSettings()->getCwKeyer();
apiCwKeyerSettings->init();
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
return 200;
}
@ -60,20 +51,14 @@ int SSBModWebAPIAdapter::webapiSettingsPutPatch(
{
(void) errorMessage;
SSBMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
if (channelSettingsKeys.contains("cwKeyer"))
{
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);
}
CWKeyerSettings newCWKeyerSettings;
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getSsbModSettings()->getCwKeyer();
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings);
m_settings.setCWKeyerSettings(newCWKeyerSettings);
const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings
}
SSBMod::webapiFormatChannelSettings(response, m_settings);

View File

@ -71,6 +71,8 @@ QByteArray WFMModSettings::serialize() const
if (m_cwKeyerGUI) {
s.writeBlob(8, m_cwKeyerGUI->serialize());
} else { // standalone operation with presets
s.writeBlob(6, m_cwKeyerSettings.serialize());
}
if (m_channelMarker) {
@ -113,10 +115,12 @@ bool WFMModSettings::deserialize(const QByteArray& data)
d.readU32(5, &m_rgbColor);
d.readReal(6, &m_toneFrequency, 1000.0);
d.readReal(7, &m_volumeFactor, 1.0);
d.readBlob(8, &bytetmp);
if (m_cwKeyerGUI) {
d.readBlob(8, &bytetmp);
m_cwKeyerGUI->deserialize(bytetmp);
} else { // standalone operation with presets
m_cwKeyerSettings.deserialize(bytetmp);
}
if (m_channelMarker) {

View File

@ -20,6 +20,8 @@
#include <QByteArray>
#include "dsp/cwkeyersettings.h"
class Serializable;
struct WFMModSettings
@ -57,12 +59,16 @@ struct WFMModSettings
Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
WFMModSettings();
void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
const CWKeyerSettings& getCWKeyerSettings() const { return m_cwKeyerSettings; }
void setCWKeyerSettings(const CWKeyerSettings& cwKeyerSettings) { m_cwKeyerSettings = cwKeyerSettings; }
static int getRFBW(int index);
static int getRFBWIndex(int rfbw);

View File

@ -16,7 +16,6 @@
///////////////////////////////////////////////////////////////////////////////////
#include "SWGChannelSettings.h"
#include "settings/serializable.h"
#include "wfmmod.h"
#include "wfmmodwebapiadapter.h"
@ -35,19 +34,11 @@ int WFMModWebAPIAdapter::webapiSettingsGet(
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);
}
}
const CWKeyerSettings& cwKeyerSettings = m_settings.getCWKeyerSettings();
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
apiCwKeyerSettings->init();
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
return 200;
}
@ -60,20 +51,14 @@ int WFMModWebAPIAdapter::webapiSettingsPutPatch(
{
(void) errorMessage;
WFMMod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
Serializable *cwKeyerGUI = m_settings.m_cwKeyerGUI;
if (channelSettingsKeys.contains("cwKeyer") && cwKeyerGUI)
if (channelSettingsKeys.contains("cwKeyer"))
{
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);
}
CWKeyerSettings newCWKeyerSettings;
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings);
m_settings.setCWKeyerSettings(newCWKeyerSettings);
const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings
}
WFMMod::webapiFormatChannelSettings(response, m_settings);