SoDaRadio-5.0.3-master:8901fb5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SoDa::CWTX Class Reference

The CW text-to-envelope converter run loop. More...

#include <CWTX.hxx>

Inheritance diagram for SoDa::CWTX:
SoDa::SoDaThread SoDa::SoDaBase SoDa::Debug

Public Member Functions

 CWTX (Params *params, CmdMBox *cwtxt_stream, DatMBox *cw_env_stream, CmdMBox *cmd_stream)
 Constructor. More...
 
void run ()
 CWTX run loop: translate text to CW envelopes, handle incoming commands. More...
 
- Public Member Functions inherited from SoDa::SoDaThread
 SoDaThread (const std::string &oname)
 
void start ()
 Execute the threads run loop. More...
 
void join ()
 more properly "Wait for this thread to exit its run loop". More...
 
bool waitForJoin (unsigned int m)
 wait for the thread to stop running, or the specified time to pass. More...
 
void execCommand (Command *cmd)
 Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions. More...
 
- Public Member Functions inherited from SoDa::SoDaBase
 SoDaBase (const std::string &oname)
 The constructor – pass a name for the object. More...
 
std::string & getObjName ()
 get the name of this object More...
 
SoDaBasefindSoDaObject (const std::string &oname)
 find a SoDa Object by name. More...
 
double getTime ()
 Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS). More...
 
- Public Member Functions inherited from SoDa::Debug
 Debug (std::string _unit_name=std::string("UNKNOWN"))
 
 Debug (const char *_unit_name_cstr)
 
 Debug (unsigned int _debug_level, std::string _unit_name=std::string("UNKNOWN"))
 
 Debug (unsigned int _debug_level, const char *_unit_name_cstr)
 
void debugMsg (const std::string &msg, unsigned int threshold=1)
 
void debugMsg (const boost::format &fmt, unsigned int threshold=1)
 
void debugMsg (const char *msg, unsigned int threshold=1)
 
void setDebugLevel (unsigned int v)
 
unsigned int getDebugLevel ()
 

Private Member Functions

void execGetCommand (Command *cmd)
 execute GET commands from the command channel More...
 
void execSetCommand (Command *cmd)
 handle SET commands from the command channel More...
 
void execRepCommand (Command *cmd)
 handle Report commands from the command channel More...
 
void enqueueText (const char *buf)
 add text to the outbound text queue More...
 
void clearTextQueue ()
 forget all enqueued text More...
 
bool sendAvailChar ()
 if a character is available, encode it into an envelope More...
 

Private Attributes

int sent_char_count
 
CWGeneratorcwgen
 Pointer to a text-to-morse translator. More...
 
CmdMBoxcwtxt_stream
 stream of characters to be encoded (from UI or elsewhere) More...
 
CmdMBoxcmd_stream
 stream of commands to modify radio state More...
 
DatMBoxcw_env_stream
 stream carrying cw envelope buffers to USRPTX More...
 
unsigned int cwtxt_subs
 subscription for text stream More...
 
unsigned int cmd_subs
 subscription for command stream More...
 
bool txmode_is_cw
 if true, we're transmitting a CW stream More...
 
bool old_txmode_is_cw
 remember the mode we were in More...
 
bool tx_on
 if true, we're transmitting a CW stream or a beacon More...
 
double rf_sample_rate
 samples/sec for generating the envelope More...
 
unsigned int rf_buffer_size
 the size of the envelope buffer More...
 
float * beacon_envelope
 the currently generated envelope More...
 
std::queue< char > text_queue
 characters waiting to be sent More...
 
boost::mutex text_lock
 lock for text_queue More...
 
std::queue< int > break_notification_id_queue
 tags inserted into text stream – send tag when the CW envelope generator gets to this character. More...
 
boost::mutex break_id_lock
 lock for break_notification queue More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SoDa::Debug
static void setDefaultLevel (unsigned int v)
 
static unsigned int getDefaultLevel ()
 
static void setGlobalLevel (unsigned int v)
 
static unsigned int getGlobalLevel ()
 
- Static Public Attributes inherited from SoDa::Debug
static boost::mutex debug_msg_mutex
 
- Protected Member Functions inherited from SoDa::Debug
std::string curDateTime ()
 
- Protected Attributes inherited from SoDa::Debug
std::string unit_name
 the name of the unit reporting status More...
 
unsigned int debug_level
 the debug level (threshold) for messages More...
 
- Static Protected Attributes inherited from SoDa::Debug
static unsigned int default_debug_level = 0
 
static unsigned int global_debug_level = 0
 

Detailed Description

The CW text-to-envelope converter run loop.

This block uses the CWGenerator object to convert text to a CW envelope.

Definition at line 48 of file CWTX.hxx.

Constructor & Destructor Documentation

◆ CWTX()

SoDa::CWTX::CWTX ( Params params,
CmdMBox cwtxt_stream,
DatMBox cw_env_stream,
CmdMBox cmd_stream 
)

Constructor.

Parameters
paramsblock describing intial setup of the radio
cwtxt_streamstream carrying text strings to be converted to morse code
cw_env_streamenvelope stream from text-to-CW converter
cmd_streamcommand stream

Definition at line 32 of file CWTX.cxx.

References beacon_envelope, cmd_stream, cmd_subs, cw_env_stream, cwgen, cwtxt_stream, cwtxt_subs, SoDa::Params::getRFBufferSize(), SoDa::Params::getTXRate(), rf_buffer_size, rf_sample_rate, sent_char_count, and SoDa::MultiMBox< T >::subscribe().

Member Function Documentation

◆ clearTextQueue()

void SoDa::CWTX::clearTextQueue ( )
private

forget all enqueued text

Definition at line 222 of file CWTX.cxx.

References cmd_stream, SoDa::MultiMBox< T >::put(), SoDa::Command::REP, sent_char_count, text_lock, text_queue, and SoDa::Command::TX_CW_FLUSHTEXT.

Referenced by execSetCommand().

◆ enqueueText()

void SoDa::CWTX::enqueueText ( const char *  buf)
private

add text to the outbound text queue

Parameters
bufzero terminated sequence of ASCII characters

Definition at line 208 of file CWTX.cxx.

References SoDa::Command::getMaxStringLen(), text_lock, and text_queue.

Referenced by execSetCommand().

◆ execGetCommand()

void SoDa::CWTX::execGetCommand ( Command cmd)
privatevirtual

execute GET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::SoDaThread.

Definition at line 136 of file CWTX.cxx.

References SoDa::Command::target, SoDa::Command::TX_BEACON, SoDa::Command::TX_CW_FLUSHTEXT, SoDa::Command::TX_CW_SPEED, SoDa::Command::TX_CW_TEXT, SoDa::Command::TX_MODE, and SoDa::Command::TX_STATE.

◆ execRepCommand()

void SoDa::CWTX::execRepCommand ( Command cmd)
privatevirtual

handle Report commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::SoDaThread.

Definition at line 240 of file CWTX.cxx.

References break_id_lock, break_notification_id_queue, cmd_stream, SoDa::MultiMBox< T >::put(), SoDa::Command::REP, SoDa::Command::target, SoDa::Command::TX_CW_EMPTY, and SoDa::Command::TX_CW_MARKER.

◆ execSetCommand()

void SoDa::CWTX::execSetCommand ( Command cmd)
privatevirtual

◆ run()

void SoDa::CWTX::run ( )
virtual

◆ sendAvailChar()

bool SoDa::CWTX::sendAvailChar ( )
private

Member Data Documentation

◆ beacon_envelope

float* SoDa::CWTX::beacon_envelope
private

the currently generated envelope

Definition at line 112 of file CWTX.hxx.

Referenced by CWTX().

◆ break_id_lock

boost::mutex SoDa::CWTX::break_id_lock
private

lock for break_notification queue

Definition at line 118 of file CWTX.hxx.

Referenced by execRepCommand(), and execSetCommand().

◆ break_notification_id_queue

std::queue<int> SoDa::CWTX::break_notification_id_queue
private

tags inserted into text stream – send tag when the CW envelope generator gets to this character.

Definition at line 117 of file CWTX.hxx.

Referenced by execRepCommand(), and execSetCommand().

◆ cmd_stream

CmdMBox* SoDa::CWTX::cmd_stream
private

stream of commands to modify radio state

Definition at line 100 of file CWTX.hxx.

Referenced by clearTextQueue(), CWTX(), execRepCommand(), run(), and sendAvailChar().

◆ cmd_subs

unsigned int SoDa::CWTX::cmd_subs
private

subscription for command stream

Definition at line 103 of file CWTX.hxx.

Referenced by CWTX(), and run().

◆ cw_env_stream

DatMBox* SoDa::CWTX::cw_env_stream
private

stream carrying cw envelope buffers to USRPTX

Definition at line 101 of file CWTX.hxx.

Referenced by CWTX().

◆ cwgen

CWGenerator* SoDa::CWTX::cwgen
private

Pointer to a text-to-morse translator.

Definition at line 97 of file CWTX.hxx.

Referenced by CWTX(), execSetCommand(), run(), and sendAvailChar().

◆ cwtxt_stream

CmdMBox* SoDa::CWTX::cwtxt_stream
private

stream of characters to be encoded (from UI or elsewhere)

Definition at line 99 of file CWTX.hxx.

Referenced by CWTX(), and run().

◆ cwtxt_subs

unsigned int SoDa::CWTX::cwtxt_subs
private

subscription for text stream

Definition at line 102 of file CWTX.hxx.

Referenced by CWTX(), and run().

◆ old_txmode_is_cw

bool SoDa::CWTX::old_txmode_is_cw
private

remember the mode we were in

Definition at line 106 of file CWTX.hxx.

Referenced by execSetCommand().

◆ rf_buffer_size

unsigned int SoDa::CWTX::rf_buffer_size
private

the size of the envelope buffer

Definition at line 110 of file CWTX.hxx.

Referenced by CWTX().

◆ rf_sample_rate

double SoDa::CWTX::rf_sample_rate
private

samples/sec for generating the envelope

Definition at line 109 of file CWTX.hxx.

Referenced by CWTX().

◆ sent_char_count

int SoDa::CWTX::sent_char_count
private

Definition at line 95 of file CWTX.hxx.

Referenced by clearTextQueue(), CWTX(), and sendAvailChar().

◆ text_lock

boost::mutex SoDa::CWTX::text_lock
private

lock for text_queue

Definition at line 115 of file CWTX.hxx.

Referenced by clearTextQueue(), enqueueText(), and sendAvailChar().

◆ text_queue

std::queue<char> SoDa::CWTX::text_queue
private

characters waiting to be sent

Definition at line 114 of file CWTX.hxx.

Referenced by clearTextQueue(), enqueueText(), and sendAvailChar().

◆ tx_on

bool SoDa::CWTX::tx_on
private

if true, we're transmitting a CW stream or a beacon

Definition at line 107 of file CWTX.hxx.

Referenced by execSetCommand(), and sendAvailChar().

◆ txmode_is_cw

bool SoDa::CWTX::txmode_is_cw
private

if true, we're transmitting a CW stream

Definition at line 105 of file CWTX.hxx.

Referenced by execSetCommand(), and sendAvailChar().


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