1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

CW keyer keyboard input: REST API updates. Make sure that in iambic mode complete dots and dashes are generated

This commit is contained in:
f4exb 2019-07-30 13:12:15 +02:00
parent 11eef9f02e
commit 2c72e885ec
13 changed files with 319 additions and 193 deletions

View File

@ -648,22 +648,7 @@ int AMMod::webapiSettingsPutPatch(
{
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
@ -732,17 +717,7 @@ void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respons
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
if (response.getAmModSettings()->getAudioDeviceName()) {
*response.getAmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
@ -821,11 +796,7 @@ void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -857,11 +828,7 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(m_settings.m_reverseAPIAddress)

View File

@ -913,22 +913,7 @@ int FreeDVMod::webapiSettingsPutPatch(
{
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
@ -1004,17 +989,7 @@ void FreeDVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
response.getFreeDvModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
@ -1090,11 +1065,7 @@ void FreeDVMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
swgFreeDVModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgFreeDVModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -1126,11 +1097,7 @@ void FreeDVMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettin
swgFreeDVModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgFreeDVModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(m_settings.m_reverseAPIAddress)

View File

@ -704,22 +704,7 @@ int NFMMod::webapiSettingsPutPatch(
{
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
@ -791,15 +776,7 @@ void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
if (response.getNfmModSettings()->getAudioDeviceName()) {
*response.getNfmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
@ -889,11 +866,7 @@ void NFMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
swgNFMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFMModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -925,11 +898,7 @@ void NFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
swgNFModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(m_settings.m_reverseAPIAddress)

View File

@ -1000,22 +1000,7 @@ int SSBMod::webapiSettingsPutPatch(
{
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getSsbModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
@ -1096,17 +1081,7 @@ void SSBMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getSsbModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
response.getSsbModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
@ -1197,11 +1172,7 @@ void SSBMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
swgSSBModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgSSBModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -1233,11 +1204,7 @@ void SSBMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
swgSSBModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgSSBModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(m_settings.m_reverseAPIAddress)

View File

@ -677,22 +677,7 @@ int WFMMod::webapiSettingsPutPatch(
{
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
@ -762,17 +747,7 @@ void WFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
if (response.getWfmModSettings()->getAudioDeviceName()) {
*response.getWfmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
@ -854,11 +829,7 @@ void WFMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
swgWFMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgWFMModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -890,11 +861,7 @@ void WFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
swgWFMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgWFMModSettings->getCwKeyer();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode(cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(m_settings.m_reverseAPIAddress)

View File

@ -438,7 +438,6 @@ void CWKeyer::setKeyboardSilence()
{
m_dot = false;
m_dash = false;
m_keyIambicState = KeySilent;
}
CWSmoother::CWSmoother() :
@ -595,4 +594,65 @@ void CWKeyer::applySettings(const CWKeyerSettings& settings, bool force)
}
m_settings = settings;
}
}
void CWKeyer::webapiSettingsPutPatch(
const QStringList& channelSettingsKeys,
CWKeyerSettings& cwKeyerSettings,
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings
)
{
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
if (channelSettingsKeys.contains("cwKeyer.keyboardIambic")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getKeyboardIambic() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.dotKey")) {
cwKeyerSettings.m_dotKey = (Qt::Key) apiCwKeyerSettings->getDotKey();
}
if (channelSettingsKeys.contains("cwKeyer.dotKeyModifiers")) {
cwKeyerSettings.m_dotKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDotKeyModifiers();
}
if (channelSettingsKeys.contains("cwKeyer.dashKey")) {
cwKeyerSettings.m_dashKey = (Qt::Key) apiCwKeyerSettings->getDashKey();
}
if (channelSettingsKeys.contains("cwKeyer.dashKeyModifiers")) {
cwKeyerSettings.m_dashKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDashKeyModifiers();
}
}
void CWKeyer::webapiFormatChannelSettings(
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings,
const CWKeyerSettings& cwKeyerSettings
)
{
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
apiCwKeyerSettings->setKeyboardIambic(cwKeyerSettings.m_keyboardIambic ? 1 : 0);
apiCwKeyerSettings->setDotKey((int) cwKeyerSettings.m_dotKey);
apiCwKeyerSettings->setDotKeyModifiers((unsigned int) cwKeyerSettings.m_dotKeyModifiers);
apiCwKeyerSettings->setDashKey((int) cwKeyerSettings.m_dashKey);
apiCwKeyerSettings->setDashKeyModifiers((unsigned int) cwKeyerSettings.m_dashKeyModifiers);
}

View File

@ -26,6 +26,7 @@
#include "util/message.h"
#include "util/messagequeue.h"
#include "cwkeyersettings.h"
#include "SWGChannelSettings.h"
/**
* Ancillary class to smooth out CW transitions with a sine shape
@ -116,6 +117,17 @@ public:
void setKeyboardDashes();
void setKeyboardSilence();
void webapiSettingsPutPatch(
const QStringList& channelSettingsKeys,
CWKeyerSettings& cwKeyerSettings,
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings
);
void webapiFormatChannelSettings(
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings,
const CWKeyerSettings& cwKeyerSettings
);
private:
QMutex m_mutex;
CWKeyerSettings m_settings;

View File

@ -1693,16 +1693,39 @@ margin-bottom: 20px;
"type" : "integer"
},
"wpm" : {
"type" : "integer"
"type" : "integer",
"description" : "Words Per Minute keying speed"
},
"mode" : {
"type" : "integer"
"type" : "integer",
"description" : "see enum CWKeyerSettings::CWMode"
},
"text" : {
"type" : "string"
},
"loop" : {
"type" : "integer"
"type" : "integer",
"description" : "1 to loop on text keying"
},
"keyboardIambic" : {
"type" : "integer",
"description" : "1 for iambic input 0 for straight input using the keyboard"
},
"dotKey" : {
"type" : "integer",
"description" : "key for dots keyboard input. See enum Qt::Key"
},
"dotKeyModifiers" : {
"type" : "integer",
"description" : "key modifier for dots keyboard input. See flags Qt::KeyboardModifiers"
},
"dashKey" : {
"type" : "integer",
"description" : "key for dashes keyboard input. See enum Qt::Key"
},
"dashKeyModifiers" : {
"type" : "integer",
"description" : "key modifier for dashes keyboard input. See flags Qt::KeyboardModifiers"
}
}
};
@ -26341,7 +26364,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-07-25T13:46:45.997+02:00
Generated 2019-07-30T10:33:29.454+02:00
</div>
</div>
</div>

View File

@ -3,10 +3,28 @@ CWKeyerSettings:
sampleRate:
type: integer
wpm:
description: Words Per Minute keying speed
type: integer
mode:
description: see enum CWKeyerSettings::CWMode
type: integer
text:
type: string
loop:
description: 1 to loop on text keying
type: integer
keyboardIambic:
description: 1 for iambic input 0 for straight input using the keyboard
type: integer
dotKey:
description: key for dots keyboard input. See enum Qt::Key
type: integer
dotKeyModifiers:
description: key modifier for dots keyboard input. See flags Qt::KeyboardModifiers
type: integer
dashKey:
description: key for dashes keyboard input. See enum Qt::Key
type: integer
dashKeyModifiers:
description: key modifier for dashes keyboard input. See flags Qt::KeyboardModifiers
type: integer

View File

@ -3,10 +3,28 @@ CWKeyerSettings:
sampleRate:
type: integer
wpm:
description: Words Per Minute keying speed
type: integer
mode:
description: see enum CWKeyerSettings::CWMode
type: integer
text:
type: string
loop:
description: 1 to loop on text keying
type: integer
keyboardIambic:
description: 1 for iambic input 0 for straight input using the keyboard
type: integer
dotKey:
description: key for dots keyboard input. See enum Qt::Key
type: integer
dotKeyModifiers:
description: key modifier for dots keyboard input. See flags Qt::KeyboardModifiers
type: integer
dashKey:
description: key for dashes keyboard input. See enum Qt::Key
type: integer
dashKeyModifiers:
description: key modifier for dashes keyboard input. See flags Qt::KeyboardModifiers
type: integer

View File

@ -1693,16 +1693,39 @@ margin-bottom: 20px;
"type" : "integer"
},
"wpm" : {
"type" : "integer"
"type" : "integer",
"description" : "Words Per Minute keying speed"
},
"mode" : {
"type" : "integer"
"type" : "integer",
"description" : "see enum CWKeyerSettings::CWMode"
},
"text" : {
"type" : "string"
},
"loop" : {
"type" : "integer"
"type" : "integer",
"description" : "1 to loop on text keying"
},
"keyboardIambic" : {
"type" : "integer",
"description" : "1 for iambic input 0 for straight input using the keyboard"
},
"dotKey" : {
"type" : "integer",
"description" : "key for dots keyboard input. See enum Qt::Key"
},
"dotKeyModifiers" : {
"type" : "integer",
"description" : "key modifier for dots keyboard input. See flags Qt::KeyboardModifiers"
},
"dashKey" : {
"type" : "integer",
"description" : "key for dashes keyboard input. See enum Qt::Key"
},
"dashKeyModifiers" : {
"type" : "integer",
"description" : "key modifier for dashes keyboard input. See flags Qt::KeyboardModifiers"
}
}
};
@ -26341,7 +26364,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-07-25T13:46:45.997+02:00
Generated 2019-07-30T10:33:29.454+02:00
</div>
</div>
</div>

View File

@ -38,6 +38,16 @@ SWGCWKeyerSettings::SWGCWKeyerSettings() {
m_text_isSet = false;
loop = 0;
m_loop_isSet = false;
keyboard_iambic = 0;
m_keyboard_iambic_isSet = false;
dot_key = 0;
m_dot_key_isSet = false;
dot_key_modifiers = 0;
m_dot_key_modifiers_isSet = false;
dash_key = 0;
m_dash_key_isSet = false;
dash_key_modifiers = 0;
m_dash_key_modifiers_isSet = false;
}
SWGCWKeyerSettings::~SWGCWKeyerSettings() {
@ -56,6 +66,16 @@ SWGCWKeyerSettings::init() {
m_text_isSet = false;
loop = 0;
m_loop_isSet = false;
keyboard_iambic = 0;
m_keyboard_iambic_isSet = false;
dot_key = 0;
m_dot_key_isSet = false;
dot_key_modifiers = 0;
m_dot_key_modifiers_isSet = false;
dash_key = 0;
m_dash_key_isSet = false;
dash_key_modifiers = 0;
m_dash_key_modifiers_isSet = false;
}
void
@ -67,6 +87,11 @@ SWGCWKeyerSettings::cleanup() {
delete text;
}
}
SWGCWKeyerSettings*
@ -90,6 +115,16 @@ SWGCWKeyerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&loop, pJson["loop"], "qint32", "");
::SWGSDRangel::setValue(&keyboard_iambic, pJson["keyboardIambic"], "qint32", "");
::SWGSDRangel::setValue(&dot_key, pJson["dotKey"], "qint32", "");
::SWGSDRangel::setValue(&dot_key_modifiers, pJson["dotKeyModifiers"], "qint32", "");
::SWGSDRangel::setValue(&dash_key, pJson["dashKey"], "qint32", "");
::SWGSDRangel::setValue(&dash_key_modifiers, pJson["dashKeyModifiers"], "qint32", "");
}
QString
@ -121,6 +156,21 @@ SWGCWKeyerSettings::asJsonObject() {
if(m_loop_isSet){
obj->insert("loop", QJsonValue(loop));
}
if(m_keyboard_iambic_isSet){
obj->insert("keyboardIambic", QJsonValue(keyboard_iambic));
}
if(m_dot_key_isSet){
obj->insert("dotKey", QJsonValue(dot_key));
}
if(m_dot_key_modifiers_isSet){
obj->insert("dotKeyModifiers", QJsonValue(dot_key_modifiers));
}
if(m_dash_key_isSet){
obj->insert("dashKey", QJsonValue(dash_key));
}
if(m_dash_key_modifiers_isSet){
obj->insert("dashKeyModifiers", QJsonValue(dash_key_modifiers));
}
return obj;
}
@ -175,6 +225,56 @@ SWGCWKeyerSettings::setLoop(qint32 loop) {
this->m_loop_isSet = true;
}
qint32
SWGCWKeyerSettings::getKeyboardIambic() {
return keyboard_iambic;
}
void
SWGCWKeyerSettings::setKeyboardIambic(qint32 keyboard_iambic) {
this->keyboard_iambic = keyboard_iambic;
this->m_keyboard_iambic_isSet = true;
}
qint32
SWGCWKeyerSettings::getDotKey() {
return dot_key;
}
void
SWGCWKeyerSettings::setDotKey(qint32 dot_key) {
this->dot_key = dot_key;
this->m_dot_key_isSet = true;
}
qint32
SWGCWKeyerSettings::getDotKeyModifiers() {
return dot_key_modifiers;
}
void
SWGCWKeyerSettings::setDotKeyModifiers(qint32 dot_key_modifiers) {
this->dot_key_modifiers = dot_key_modifiers;
this->m_dot_key_modifiers_isSet = true;
}
qint32
SWGCWKeyerSettings::getDashKey() {
return dash_key;
}
void
SWGCWKeyerSettings::setDashKey(qint32 dash_key) {
this->dash_key = dash_key;
this->m_dash_key_isSet = true;
}
qint32
SWGCWKeyerSettings::getDashKeyModifiers() {
return dash_key_modifiers;
}
void
SWGCWKeyerSettings::setDashKeyModifiers(qint32 dash_key_modifiers) {
this->dash_key_modifiers = dash_key_modifiers;
this->m_dash_key_modifiers_isSet = true;
}
bool
SWGCWKeyerSettings::isSet(){
@ -185,6 +285,11 @@ SWGCWKeyerSettings::isSet(){
if(m_mode_isSet){ isObjectUpdated = true; break;}
if(text != nullptr && *text != QString("")){ isObjectUpdated = true; break;}
if(m_loop_isSet){ isObjectUpdated = true; break;}
if(m_keyboard_iambic_isSet){ isObjectUpdated = true; break;}
if(m_dot_key_isSet){ isObjectUpdated = true; break;}
if(m_dot_key_modifiers_isSet){ isObjectUpdated = true; break;}
if(m_dash_key_isSet){ isObjectUpdated = true; break;}
if(m_dash_key_modifiers_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}

View File

@ -57,6 +57,21 @@ public:
qint32 getLoop();
void setLoop(qint32 loop);
qint32 getKeyboardIambic();
void setKeyboardIambic(qint32 keyboard_iambic);
qint32 getDotKey();
void setDotKey(qint32 dot_key);
qint32 getDotKeyModifiers();
void setDotKeyModifiers(qint32 dot_key_modifiers);
qint32 getDashKey();
void setDashKey(qint32 dash_key);
qint32 getDashKeyModifiers();
void setDashKeyModifiers(qint32 dash_key_modifiers);
virtual bool isSet() override;
@ -76,6 +91,21 @@ private:
qint32 loop;
bool m_loop_isSet;
qint32 keyboard_iambic;
bool m_keyboard_iambic_isSet;
qint32 dot_key;
bool m_dot_key_isSet;
qint32 dot_key_modifiers;
bool m_dot_key_modifiers_isSet;
qint32 dash_key;
bool m_dash_key_isSet;
qint32 dash_key_modifiers;
bool m_dash_key_modifiers_isSet;
};
}