SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CWKeyer Class Reference

#include <cwkeyer.h>

Inherits QObject.

+ Collaboration diagram for CWKeyer:

Classes

class  MsgConfigureCWKeyer
 

Public Types

enum  CWKeyIambicState { KeySilent, KeyDot, KeyDash }
 
enum  CWTextState {
  TextStart, TextStartChar, TextStartElement, TextElement,
  TextCharSpace, TextWordSpace, TextEnd, TextStop
}
 

Public Member Functions

 CWKeyer ()
 
 ~CWKeyer ()
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
MessageQueuegetInputMessageQueue ()
 Get the queue for asynchronous inbound communication. More...
 
void setSampleRate (int sampleRate)
 
const CWKeyerSettingsgetSettings () const
 
void reset ()
 
CWSmoothergetCWSmoother ()
 
int getSample ()
 
bool eom ()
 
void resetText ()
 
void stopText ()
 
void setKeyboardDots ()
 
void setKeyboardDashes ()
 
void setKeyboardSilence ()
 

Static Public Member Functions

static void webapiSettingsPutPatch (const QStringList &channelSettingsKeys, CWKeyerSettings &cwKeyerSettings, SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings)
 
static void webapiFormatChannelSettings (SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
 

Private Slots

void handleInputMessages ()
 

Private Member Functions

void applySettings (const CWKeyerSettings &settings, bool force=false)
 
bool handleMessage (const Message &cmd)
 
void nextStateIambic ()
 
void nextStateText ()
 

Private Attributes

QMutex m_mutex
 
CWKeyerSettings m_settings
 
MessageQueue m_inputMessageQueue
 
int m_dotLength
 dot length in samples More...
 
int m_textPointer
 
int m_elementPointer
 
int m_samplePointer
 
bool m_elementSpace
 
bool m_characterSpace
 
bool m_key
 
bool m_dot
 
bool m_dash
 
bool m_elementOn
 
signed char m_asciiChar
 
CWKeyIambicState m_keyIambicState
 
CWTextState m_textState
 
CWSmoother m_cwSmoother
 

Static Private Attributes

static const signed char m_asciiToMorse [128][7]
 

Detailed Description

Definition at line 52 of file cwkeyer.h.

Member Enumeration Documentation

◆ CWKeyIambicState

Enumerator
KeySilent 
KeyDot 
KeyDash 

Definition at line 79 of file cwkeyer.h.

80  {
81  KeySilent,
82  KeyDot,
83  KeyDash
84  };

◆ CWTextState

Enumerator
TextStart 
TextStartChar 
TextStartElement 
TextElement 
TextCharSpace 
TextWordSpace 
TextEnd 
TextStop 

Definition at line 86 of file cwkeyer.h.

Constructor & Destructor Documentation

◆ CWKeyer()

CWKeyer::CWKeyer ( )

Definition at line 163 of file cwkeyer.cpp.

References applySettings(), handleInputMessages(), m_inputMessageQueue, and m_settings.

163  :
164  m_mutex(QMutex::Recursive),
165  m_textPointer(0),
166  m_elementPointer(0),
167  m_samplePointer(0),
168  m_elementSpace(false),
169  m_characterSpace(false),
170  m_key(false),
171  m_dot(false),
172  m_dash(false),
173  m_elementOn(false),
174  m_asciiChar('\0'),
177 {
178  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
179  applySettings(m_settings, true);
180 }
bool m_dash
Definition: cwkeyer.h:143
signed char m_asciiChar
Definition: cwkeyer.h:145
void handleInputMessages()
Definition: cwkeyer.cpp:540
bool m_key
Definition: cwkeyer.h:141
bool m_elementSpace
Definition: cwkeyer.h:139
int m_elementPointer
Definition: cwkeyer.h:137
bool m_characterSpace
Definition: cwkeyer.h:140
int m_samplePointer
Definition: cwkeyer.h:138
QMutex m_mutex
Definition: cwkeyer.h:132
bool m_elementOn
Definition: cwkeyer.h:144
CWTextState m_textState
Definition: cwkeyer.h:147
MessageQueue m_inputMessageQueue
Definition: cwkeyer.h:134
void applySettings(const CWKeyerSettings &settings, bool force=false)
Definition: cwkeyer.cpp:552
CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
bool m_dot
Definition: cwkeyer.h:142
CWKeyerSettings m_settings
Definition: cwkeyer.h:133
int m_textPointer
Definition: cwkeyer.h:136
+ Here is the call graph for this function:

◆ ~CWKeyer()

CWKeyer::~CWKeyer ( )

Definition at line 182 of file cwkeyer.cpp.

183 {
184 }

Member Function Documentation

◆ applySettings()

void CWKeyer::applySettings ( const CWKeyerSettings settings,
bool  force = false 
)
private

Definition at line 552 of file cwkeyer.cpp.

References CWKeyerSettings::CWDashes, CWKeyerSettings::CWDots, CWKeyerSettings::CWKeyboard, CWKeyerSettings::CWText, CWKeyerSettings::m_mode, CWSmoother::m_mutex, CWKeyerSettings::m_sampleRate, CWKeyerSettings::m_text, and CWKeyerSettings::m_wpm.

Referenced by CWKeyer().

553 {
554  if ((m_settings.m_wpm != settings.m_wpm)
555  || (m_settings.m_sampleRate != settings.m_sampleRate) || force)
556  {
557  QMutexLocker mutexLocker(&m_mutex);
558  m_dotLength = (int) (0.24f * settings.m_sampleRate * (5.0f / settings.m_wpm));
559  m_cwSmoother.setNbFadeSamples(m_dotLength/5); // 20% the dot time
560  }
561 
562  if ((m_settings.m_mode != settings.m_mode) || force)
563  {
564  QMutexLocker mutexLocker(&m_mutex);
565 
566  if (settings.m_mode == CWKeyerSettings::CWText)
567  {
569  }
570  else if (settings.m_mode == CWKeyerSettings::CWDots)
571  {
572  m_dot = true;
573  m_dash = false;
575  }
576  else if (settings.m_mode == CWKeyerSettings::CWDashes)
577  {
578  m_dot = false;
579  m_dash = true;
581  }
582  else if (settings.m_mode == CWKeyerSettings::CWKeyboard)
583  {
584  m_dot = false;
585  m_dash = false;
587  }
588  }
589 
590  if ((m_settings.m_text != settings.m_text) || force)
591  {
592  QMutexLocker mutexLocker(&m_mutex);
594  }
595 
596  m_settings = settings;
597 }
bool m_dash
Definition: cwkeyer.h:143
int m_dotLength
dot length in samples
Definition: cwkeyer.h:135
QMutex m_mutex
Definition: cwkeyer.h:132
void setNbFadeSamples(unsigned int nbFadeSamples)
Definition: cwkeyer.cpp:459
CWTextState m_textState
Definition: cwkeyer.h:147
CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
bool m_dot
Definition: cwkeyer.h:142
CWSmoother m_cwSmoother
Definition: cwkeyer.h:148
CWKeyerSettings m_settings
Definition: cwkeyer.h:133
+ Here is the caller graph for this function:

◆ deserialize()

bool CWKeyer::deserialize ( const QByteArray &  data)

◆ eom()

bool CWKeyer::eom ( )

Definition at line 418 of file cwkeyer.cpp.

References m_settings, CWKeyerSettings::m_text, and m_textPointer.

419 {
420  return !(m_textPointer < m_settings.m_text.length());
421 }
CWKeyerSettings m_settings
Definition: cwkeyer.h:133
int m_textPointer
Definition: cwkeyer.h:136

◆ getCWSmoother()

CWSmoother& CWKeyer::getCWSmoother ( )
inline

Definition at line 111 of file cwkeyer.h.

Referenced by WFMMod::pullAF(), AMMod::pullAF(), NFMMod::pullAF(), FreeDVMod::pullAF(), and SSBMod::pullAF().

111 { return m_cwSmoother; }
CWSmoother m_cwSmoother
Definition: cwkeyer.h:148
+ Here is the caller graph for this function:

◆ getInputMessageQueue()

MessageQueue* CWKeyer::getInputMessageQueue ( )
inline

Get the queue for asynchronous inbound communication.

Definition at line 104 of file cwkeyer.h.

Referenced by CWKeyerGUI::applySettings(), AMMod::webapiSettingsPutPatch(), WFMMod::webapiSettingsPutPatch(), NFMMod::webapiSettingsPutPatch(), SSBMod::webapiSettingsPutPatch(), and FreeDVMod::webapiSettingsPutPatch().

+ Here is the caller graph for this function:

◆ getSample()

int CWKeyer::getSample ( )

Definition at line 194 of file cwkeyer.cpp.

References CWKeyerSettings::CWDashes, CWKeyerSettings::CWDots, CWKeyerSettings::CWKeyboard, CWKeyerSettings::CWText, m_dash, m_dot, m_key, CWKeyerSettings::m_keyboardIambic, CWKeyerSettings::m_mode, m_mutex, m_settings, nextStateIambic(), and nextStateText().

Referenced by WFMMod::pullAF(), AMMod::pullAF(), NFMMod::pullAF(), FreeDVMod::pullAF(), and SSBMod::pullAF().

195 {
196  QMutexLocker mutexLocker(&m_mutex);
197 
199  {
200  nextStateText();
201  return m_key ? 1 : 0;
202  }
204  {
205  nextStateIambic();
206  return m_key ? 1 : 0;
207  }
209  {
211  {
212  nextStateIambic();
213  return m_key ? 1 : 0;
214  }
215  else
216  {
217  return (m_dot || m_dash) ? 1 : 0;
218  }
219  }
220  else
221  {
222  return 0;
223  }
224 }
bool m_dash
Definition: cwkeyer.h:143
bool m_key
Definition: cwkeyer.h:141
void nextStateText()
Definition: cwkeyer.cpp:303
void nextStateIambic()
Definition: cwkeyer.cpp:226
QMutex m_mutex
Definition: cwkeyer.h:132
bool m_dot
Definition: cwkeyer.h:142
CWKeyerSettings m_settings
Definition: cwkeyer.h:133
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSettings()

const CWKeyerSettings& CWKeyer::getSettings ( ) const
inline

◆ handleInputMessages

void CWKeyer::handleInputMessages ( )
privateslot

Definition at line 540 of file cwkeyer.cpp.

Referenced by CWKeyer().

541 {
542  Message* message;
543 
544  while ((message = m_inputMessageQueue.pop()) != 0)
545  {
546  if (handleMessage(*message)) {
547  delete message;
548  }
549  }
550 }
Message * pop()
Pop message from queue.
bool handleMessage(const Message &cmd)
Definition: cwkeyer.cpp:525
MessageQueue m_inputMessageQueue
Definition: cwkeyer.h:134
+ Here is the caller graph for this function:

◆ handleMessage()

bool CWKeyer::handleMessage ( const Message cmd)
private

Definition at line 525 of file cwkeyer.cpp.

References CWKeyer::MsgConfigureCWKeyer::getForce(), and CWKeyer::MsgConfigureCWKeyer::getSettings().

526 {
528  {
529  MsgConfigureCWKeyer& cfg = (MsgConfigureCWKeyer&) cmd;
530  qDebug() << "CWKeyer::handleMessage: MsgConfigureCWKeyer";
531 
532  applySettings(cfg.getSettings(), cfg.getForce());
533 
534  return true;
535  }
536 
537  return true;
538 }
static bool match(const Message *message)
Definition: message.cpp:45
void applySettings(const CWKeyerSettings &settings, bool force=false)
Definition: cwkeyer.cpp:552
+ Here is the call graph for this function:

◆ nextStateIambic()

void CWKeyer::nextStateIambic ( )
private

Definition at line 226 of file cwkeyer.cpp.

References KeyDash, KeyDot, KeySilent, m_dash, m_dot, m_dotLength, m_key, m_keyIambicState, and m_samplePointer.

Referenced by getSample(), and nextStateText().

227 {
228  switch (m_keyIambicState)
229  {
230  case KeySilent:
231  if (m_dot)
232  {
234  m_samplePointer = 0;
235  }
236  else if (m_dash)
237  {
239  m_samplePointer = 0;
240  }
241 
242  m_key = false;
243  break;
244  case KeyDot:
245  if (m_samplePointer < m_dotLength) // dot key
246  {
247  m_key = true;
248  m_samplePointer++;
249  }
250  else if (m_samplePointer < 2*m_dotLength) // dot silence (+1 dot length)
251  {
252  m_key = false;
253  m_samplePointer++;
254  }
255  else // end
256  {
257  if (m_dash)
258  {
260  }
261  else if (!m_dot)
262  {
264  }
265 
266  m_samplePointer = 0;
267  m_key = false;
268  }
269  break;
270  case KeyDash:
271  if (m_samplePointer < 3*m_dotLength) // dash key
272  {
273  m_key = true;
274  m_samplePointer++;
275  }
276  else if (m_samplePointer < 4*m_dotLength) // dash silence (+1 dot length)
277  {
278  m_key = false;
279  m_samplePointer++;
280  }
281  else // end
282  {
283  if (m_dot)
284  {
286  }
287  else if (!m_dash)
288  {
290  }
291 
292  m_samplePointer = 0;
293  m_key = false;
294  }
295  break;
296  default:
297  m_samplePointer = 0;
298  m_key = false;
299  break;
300  }
301 }
bool m_dash
Definition: cwkeyer.h:143
bool m_key
Definition: cwkeyer.h:141
int m_samplePointer
Definition: cwkeyer.h:138
int m_dotLength
dot length in samples
Definition: cwkeyer.h:135
CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
bool m_dot
Definition: cwkeyer.h:142
+ Here is the caller graph for this function:

◆ nextStateText()

void CWKeyer::nextStateText ( )
private

Definition at line 303 of file cwkeyer.cpp.

References KeySilent, m_asciiChar, m_asciiToMorse, m_dash, m_dot, m_dotLength, m_elementPointer, m_key, m_keyIambicState, CWKeyerSettings::m_loop, m_samplePointer, m_settings, CWKeyerSettings::m_text, m_textPointer, m_textState, nextStateIambic(), TextCharSpace, TextElement, TextEnd, TextStart, TextStartChar, TextStartElement, TextStop, and TextWordSpace.

Referenced by getSample().

304 {
305  switch (m_textState)
306  {
307  case TextStart:
308  m_samplePointer = 0;
309  m_elementPointer = 0;
310  m_textPointer = 0;
312  m_key = false;
313  m_dot = false;
314  m_dash = false;
315  break;
316  case TextStartChar:
317  m_samplePointer = 0;
318  m_elementPointer = 0;
319  if (m_textPointer < m_settings.m_text.length())
320  {
321  m_asciiChar = (m_settings.m_text.at(m_textPointer)).toLatin1();
322 // qDebug() << "CWKeyer::nextStateText: TextStartChar: " << m_asciiChar;
323 
324  if (m_asciiChar < 0) { // non ASCII
325  m_asciiChar = 0;
326  }
327 
328  if (m_asciiChar == ' ')
329  {
331  }
332  else
333  {
335  }
336  m_textPointer++;
337  }
338  else // end of text
339  {
341  }
342  break;
343  case TextStartElement:
344  m_samplePointer = 0;
345 // qDebug() << "CWKeyer::nextStateText: TextStartElement: " << (int) m_asciiToMorse[m_asciiChar][m_elementPointer];
346  if (m_asciiToMorse[(uint8_t)(m_asciiChar&0x7F)][m_elementPointer] == -1) // end of morse character
347  {
348  m_elementPointer = 0;
350  }
351  else
352  {
353  if (m_asciiToMorse[(uint8_t)(m_asciiChar&0x7F)][m_elementPointer] == 0) // dot
354  {
355  m_dot = true;
356  m_dash = false;
357  }
358  else // dash
359  {
360  m_dot = false;
361  m_dash = true;
362  }
363  m_keyIambicState = KeySilent; // reset iambic state
364  nextStateIambic(); // init dash or dot
365  m_dot = false; // release keys
366  m_dash = false;
369  }
370  break;
371  case TextElement:
372  nextStateIambic(); // dash or dot
373  if (m_keyIambicState == KeySilent) // done
374  {
375  m_textState = TextStartElement; // next element
376  }
377  break;
378  case TextCharSpace:
379  if (m_samplePointer < 2*m_dotLength) // - 1 dot length space from element
380  {
381  m_samplePointer++;
382  m_key = false;
383  }
384  else
385  {
387  }
388  break;
389  case TextWordSpace:
390  if (m_samplePointer < 4*m_dotLength) // - 3 dot length space from character
391  {
392  m_samplePointer++;
393  m_key = false;
394  }
395  else
396  {
398  }
399  break;
400  case TextEnd:
401  if (m_settings.m_loop)
402  {
404  }
405  m_key = false;
406  m_dot = false;
407  m_dash = false;
408  break;
409  case TextStop:
410  default:
411  m_key = false;
412  m_dot = false;
413  m_dash = false;
414  break;
415  }
416 }
bool m_dash
Definition: cwkeyer.h:143
signed char m_asciiChar
Definition: cwkeyer.h:145
bool m_key
Definition: cwkeyer.h:141
int m_elementPointer
Definition: cwkeyer.h:137
static const signed char m_asciiToMorse[128][7]
Definition: cwkeyer.h:150
int m_samplePointer
Definition: cwkeyer.h:138
unsigned char uint8_t
Definition: rtptypes_win.h:42
void nextStateIambic()
Definition: cwkeyer.cpp:226
int m_dotLength
dot length in samples
Definition: cwkeyer.h:135
CWTextState m_textState
Definition: cwkeyer.h:147
CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
bool m_dot
Definition: cwkeyer.h:142
CWKeyerSettings m_settings
Definition: cwkeyer.h:133
int m_textPointer
Definition: cwkeyer.h:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

void CWKeyer::reset ( )
inline

Definition at line 109 of file cwkeyer.h.

Referenced by AMMod::AMMod(), WFMMod::applyChannelSettings(), FreeDVMod::FreeDVMod(), NFMMod::NFMMod(), SSBMod::SSBMod(), and WFMMod::WFMMod().

CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
+ Here is the caller graph for this function:

◆ resetText()

void CWKeyer::resetText ( )
inline

Definition at line 114 of file cwkeyer.h.

Referenced by CWKeyerGUI::on_playStop_toggled().

114 { m_textState = TextStart; }
CWTextState m_textState
Definition: cwkeyer.h:147
+ Here is the caller graph for this function:

◆ resetToDefaults()

void CWKeyer::resetToDefaults ( )

◆ serialize()

QByteArray CWKeyer::serialize ( ) const

◆ setKeyboardDashes()

void CWKeyer::setKeyboardDashes ( )

Definition at line 430 of file cwkeyer.cpp.

References KeySilent, m_dash, m_dot, and m_keyIambicState.

Referenced by CWKeyerGUI::keyboardKeyPressed().

431 {
432  m_dot = false;
433  m_dash = true;
435 }
bool m_dash
Definition: cwkeyer.h:143
CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
bool m_dot
Definition: cwkeyer.h:142
+ Here is the caller graph for this function:

◆ setKeyboardDots()

void CWKeyer::setKeyboardDots ( )

Definition at line 423 of file cwkeyer.cpp.

References KeySilent, m_dash, m_dot, and m_keyIambicState.

Referenced by CWKeyerGUI::keyboardKeyPressed().

424 {
425  m_dot = true;
426  m_dash = false;
428 }
bool m_dash
Definition: cwkeyer.h:143
CWKeyIambicState m_keyIambicState
Definition: cwkeyer.h:146
bool m_dot
Definition: cwkeyer.h:142
+ Here is the caller graph for this function:

◆ setKeyboardSilence()

void CWKeyer::setKeyboardSilence ( )

Definition at line 437 of file cwkeyer.cpp.

References m_dash, and m_dot.

Referenced by CWKeyerGUI::keyboardKeyPressed().

438 {
439  m_dot = false;
440  m_dash = false;
441 }
bool m_dash
Definition: cwkeyer.h:143
bool m_dot
Definition: cwkeyer.h:142
+ Here is the caller graph for this function:

◆ setSampleRate()

void CWKeyer::setSampleRate ( int  sampleRate)

Definition at line 186 of file cwkeyer.cpp.

References CWKeyer::MsgConfigureCWKeyer::create(), m_inputMessageQueue, CWKeyerSettings::m_sampleRate, m_settings, and MessageQueue::push().

Referenced by AMMod::AMMod(), AMMod::applyAudioSampleRate(), NFMMod::applyAudioSampleRate(), SSBMod::applyAudioSampleRate(), WFMMod::applyChannelSettings(), FreeDVMod::FreeDVMod(), NFMMod::NFMMod(), SSBMod::SSBMod(), and WFMMod::WFMMod().

187 {
188  CWKeyerSettings settings = m_settings;
189  settings.m_sampleRate = sampleRate;
190  MsgConfigureCWKeyer *msg = MsgConfigureCWKeyer::create(settings, false);
192 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgConfigureCWKeyer * create(const CWKeyerSettings &settings, bool force)
Definition: cwkeyer.h:63
MessageQueue m_inputMessageQueue
Definition: cwkeyer.h:134
CWKeyerSettings m_settings
Definition: cwkeyer.h:133
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stopText()

void CWKeyer::stopText ( )
inline

Definition at line 115 of file cwkeyer.h.

Referenced by CWKeyerGUI::on_playStop_toggled().

115 { m_textState = TextStop; }
CWTextState m_textState
Definition: cwkeyer.h:147
+ Here is the caller graph for this function:

◆ webapiFormatChannelSettings()

void CWKeyer::webapiFormatChannelSettings ( SWGSDRangel::SWGCWKeyerSettings apiCwKeyerSettings,
const CWKeyerSettings cwKeyerSettings 
)
static

Definition at line 637 of file cwkeyer.cpp.

References SWGSDRangel::SWGCWKeyerSettings::getText(), CWKeyerSettings::m_dashKey, CWKeyerSettings::m_dashKeyModifiers, CWKeyerSettings::m_dotKey, CWKeyerSettings::m_dotKeyModifiers, CWKeyerSettings::m_keyboardIambic, CWKeyerSettings::m_loop, CWKeyerSettings::m_mode, CWKeyerSettings::m_sampleRate, CWKeyerSettings::m_text, CWKeyerSettings::m_wpm, SWGSDRangel::SWGCWKeyerSettings::setDashKey(), SWGSDRangel::SWGCWKeyerSettings::setDashKeyModifiers(), SWGSDRangel::SWGCWKeyerSettings::setDotKey(), SWGSDRangel::SWGCWKeyerSettings::setDotKeyModifiers(), SWGSDRangel::SWGCWKeyerSettings::setKeyboardIambic(), SWGSDRangel::SWGCWKeyerSettings::setLoop(), SWGSDRangel::SWGCWKeyerSettings::setMode(), SWGSDRangel::SWGCWKeyerSettings::setSampleRate(), SWGSDRangel::SWGCWKeyerSettings::setText(), and SWGSDRangel::SWGCWKeyerSettings::setWpm().

Referenced by WFMMod::webapiFormatChannelSettings(), AMMod::webapiFormatChannelSettings(), NFMMod::webapiFormatChannelSettings(), FreeDVMod::webapiFormatChannelSettings(), SSBMod::webapiFormatChannelSettings(), WFMMod::webapiReverseSendCWSettings(), AMMod::webapiReverseSendCWSettings(), NFMMod::webapiReverseSendCWSettings(), FreeDVMod::webapiReverseSendCWSettings(), SSBMod::webapiReverseSendCWSettings(), WFMMod::webapiReverseSendSettings(), AMMod::webapiReverseSendSettings(), NFMMod::webapiReverseSendSettings(), FreeDVMod::webapiReverseSendSettings(), and SSBMod::webapiReverseSendSettings().

641 {
642  apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
643  apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
644  apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
645 
646  if (apiCwKeyerSettings->getText()) {
647  *apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
648  } else {
649  apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
650  }
651 
652  apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
653  apiCwKeyerSettings->setKeyboardIambic(cwKeyerSettings.m_keyboardIambic ? 1 : 0);
654  apiCwKeyerSettings->setDotKey((int) cwKeyerSettings.m_dotKey);
655  apiCwKeyerSettings->setDotKeyModifiers((unsigned int) cwKeyerSettings.m_dotKeyModifiers);
656  apiCwKeyerSettings->setDashKey((int) cwKeyerSettings.m_dashKey);
657  apiCwKeyerSettings->setDashKeyModifiers((unsigned int) cwKeyerSettings.m_dashKeyModifiers);
658 }
void setKeyboardIambic(qint32 keyboard_iambic)
Qt::KeyboardModifiers m_dotKeyModifiers
Qt::KeyboardModifiers m_dashKeyModifiers
void setSampleRate(qint32 sample_rate)
void setDashKeyModifiers(qint32 dash_key_modifiers)
void setDotKeyModifiers(qint32 dot_key_modifiers)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

void CWKeyer::webapiSettingsPutPatch ( const QStringList &  channelSettingsKeys,
CWKeyerSettings cwKeyerSettings,
SWGSDRangel::SWGCWKeyerSettings apiCwKeyerSettings 
)
static

Definition at line 599 of file cwkeyer.cpp.

References SWGSDRangel::SWGCWKeyerSettings::getDashKey(), SWGSDRangel::SWGCWKeyerSettings::getDashKeyModifiers(), SWGSDRangel::SWGCWKeyerSettings::getDotKey(), SWGSDRangel::SWGCWKeyerSettings::getDotKeyModifiers(), SWGSDRangel::SWGCWKeyerSettings::getKeyboardIambic(), SWGSDRangel::SWGCWKeyerSettings::getLoop(), SWGSDRangel::SWGCWKeyerSettings::getMode(), SWGSDRangel::SWGCWKeyerSettings::getSampleRate(), SWGSDRangel::SWGCWKeyerSettings::getText(), SWGSDRangel::SWGCWKeyerSettings::getWpm(), CWKeyerSettings::m_dashKey, CWKeyerSettings::m_dashKeyModifiers, CWKeyerSettings::m_dotKey, CWKeyerSettings::m_dotKeyModifiers, CWKeyerSettings::m_loop, CWKeyerSettings::m_mode, CWKeyerSettings::m_sampleRate, CWKeyerSettings::m_text, and CWKeyerSettings::m_wpm.

Referenced by AMMod::webapiSettingsPutPatch(), WFMMod::webapiSettingsPutPatch(), NFMMod::webapiSettingsPutPatch(), SSBMod::webapiSettingsPutPatch(), and FreeDVMod::webapiSettingsPutPatch().

604 {
605  if (channelSettingsKeys.contains("cwKeyer.loop")) {
606  cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
607  }
608  if (channelSettingsKeys.contains("cwKeyer.mode")) {
609  cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
610  }
611  if (channelSettingsKeys.contains("cwKeyer.text")) {
612  cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
613  }
614  if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
615  cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
616  }
617  if (channelSettingsKeys.contains("cwKeyer.wpm")) {
618  cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
619  }
620  if (channelSettingsKeys.contains("cwKeyer.keyboardIambic")) {
621  cwKeyerSettings.m_wpm = apiCwKeyerSettings->getKeyboardIambic() != 0;
622  }
623  if (channelSettingsKeys.contains("cwKeyer.dotKey")) {
624  cwKeyerSettings.m_dotKey = (Qt::Key) apiCwKeyerSettings->getDotKey();
625  }
626  if (channelSettingsKeys.contains("cwKeyer.dotKeyModifiers")) {
627  cwKeyerSettings.m_dotKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDotKeyModifiers();
628  }
629  if (channelSettingsKeys.contains("cwKeyer.dashKey")) {
630  cwKeyerSettings.m_dashKey = (Qt::Key) apiCwKeyerSettings->getDashKey();
631  }
632  if (channelSettingsKeys.contains("cwKeyer.dashKeyModifiers")) {
633  cwKeyerSettings.m_dashKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDashKeyModifiers();
634  }
635 }
Qt::KeyboardModifiers m_dotKeyModifiers
Qt::KeyboardModifiers m_dashKeyModifiers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_asciiChar

signed char CWKeyer::m_asciiChar
private

Definition at line 145 of file cwkeyer.h.

Referenced by nextStateText().

◆ m_asciiToMorse

const signed char CWKeyer::m_asciiToMorse
staticprivate

0: dot 1: dash -1: end of sequence

Definition at line 150 of file cwkeyer.h.

Referenced by nextStateText().

◆ m_characterSpace

bool CWKeyer::m_characterSpace
private

Definition at line 140 of file cwkeyer.h.

◆ m_cwSmoother

CWSmoother CWKeyer::m_cwSmoother
private

Definition at line 148 of file cwkeyer.h.

◆ m_dash

bool CWKeyer::m_dash
private

◆ m_dot

bool CWKeyer::m_dot
private

◆ m_dotLength

int CWKeyer::m_dotLength
private

dot length in samples

Definition at line 135 of file cwkeyer.h.

Referenced by nextStateIambic(), and nextStateText().

◆ m_elementOn

bool CWKeyer::m_elementOn
private

Definition at line 144 of file cwkeyer.h.

◆ m_elementPointer

int CWKeyer::m_elementPointer
private

Definition at line 137 of file cwkeyer.h.

Referenced by nextStateText().

◆ m_elementSpace

bool CWKeyer::m_elementSpace
private

Definition at line 139 of file cwkeyer.h.

◆ m_inputMessageQueue

MessageQueue CWKeyer::m_inputMessageQueue
private

Definition at line 134 of file cwkeyer.h.

Referenced by CWKeyer(), and setSampleRate().

◆ m_key

bool CWKeyer::m_key
private

Definition at line 141 of file cwkeyer.h.

Referenced by getSample(), nextStateIambic(), and nextStateText().

◆ m_keyIambicState

CWKeyIambicState CWKeyer::m_keyIambicState
private

Definition at line 146 of file cwkeyer.h.

Referenced by nextStateIambic(), nextStateText(), setKeyboardDashes(), and setKeyboardDots().

◆ m_mutex

QMutex CWKeyer::m_mutex
private

Definition at line 132 of file cwkeyer.h.

Referenced by getSample().

◆ m_samplePointer

int CWKeyer::m_samplePointer
private

Definition at line 138 of file cwkeyer.h.

Referenced by nextStateIambic(), and nextStateText().

◆ m_settings

CWKeyerSettings CWKeyer::m_settings
private

Definition at line 133 of file cwkeyer.h.

Referenced by CWKeyer(), eom(), getSample(), nextStateText(), and setSampleRate().

◆ m_textPointer

int CWKeyer::m_textPointer
private

Definition at line 136 of file cwkeyer.h.

Referenced by eom(), and nextStateText().

◆ m_textState

CWTextState CWKeyer::m_textState
private

Definition at line 147 of file cwkeyer.h.

Referenced by nextStateText().


The documentation for this class was generated from the following files: