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.readU32(5, &m_rgbColor);
d.readReal(6, &m_volumeFactor, 1.0); d.readReal(6, &m_volumeFactor, 1.0);
d.readBlob(7, &bytetmp); d.readBlob(7, &bytetmp);
m_cwKeyerSettings.deserialize(bytetmp);
if (m_cwKeyerGUI) { if (m_cwKeyerGUI) {
m_cwKeyerGUI->deserialize(bytetmp); m_cwKeyerGUI->deserialize(bytetmp);
} else { // standalone operation with presets
m_cwKeyerSettings.deserialize(bytetmp);
} }
if (m_channelMarker) { if (m_channelMarker) {

View File

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

View File

@ -22,6 +22,8 @@
#include <QString> #include <QString>
#include <stdint.h> #include <stdint.h>
#include "dsp/cwkeyersettings.h"
class Serializable; class Serializable;
struct FreeDVModSettings struct FreeDVModSettings
@ -68,6 +70,8 @@ struct FreeDVModSettings
Serializable *m_spectrumGUI; Serializable *m_spectrumGUI;
Serializable *m_cwKeyerGUI; Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
FreeDVModSettings(); FreeDVModSettings();
void resetToDefaults(); void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; } void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
@ -75,6 +79,8 @@ struct FreeDVModSettings
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; }
static int getHiCutoff(FreeDVMode freeDVMode); static int getHiCutoff(FreeDVMode freeDVMode);
static int getLowCutoff(FreeDVMode freeDVMode); static int getLowCutoff(FreeDVMode freeDVMode);

View File

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

View File

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

View File

@ -20,6 +20,8 @@
#include <QByteArray> #include <QByteArray>
#include "dsp/cwkeyersettings.h"
class Serializable; class Serializable;
struct NFMModSettings struct NFMModSettings
@ -64,12 +66,16 @@ struct NFMModSettings
Serializable *m_channelMarker; Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI; Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
NFMModSettings(); NFMModSettings();
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; }
static int getRFBW(int index); static int getRFBW(int index);
static int getRFBWIndex(int rfbw); static int getRFBWIndex(int rfbw);

View File

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

View File

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

View File

@ -22,6 +22,8 @@
#include <QString> #include <QString>
#include <stdint.h> #include <stdint.h>
#include "dsp/cwkeyersettings.h"
class Serializable; class Serializable;
struct SSBModSettings struct SSBModSettings
@ -70,6 +72,8 @@ struct SSBModSettings
Serializable *m_spectrumGUI; Serializable *m_spectrumGUI;
Serializable *m_cwKeyerGUI; Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
SSBModSettings(); SSBModSettings();
void resetToDefaults(); void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; } void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
@ -77,6 +81,8 @@ struct SSBModSettings
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; }
}; };

View File

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

View File

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

View File

@ -20,6 +20,8 @@
#include <QByteArray> #include <QByteArray>
#include "dsp/cwkeyersettings.h"
class Serializable; class Serializable;
struct WFMModSettings struct WFMModSettings
@ -57,12 +59,16 @@ struct WFMModSettings
Serializable *m_channelMarker; Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI; Serializable *m_cwKeyerGUI;
CWKeyerSettings m_cwKeyerSettings; //!< For standalone deserialize operation (without m_cwKeyerGUI)
WFMModSettings(); WFMModSettings();
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; }
static int getRFBW(int index); static int getRFBW(int index);
static int getRFBWIndex(int rfbw); static int getRFBWIndex(int rfbw);

View File

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