SoDaRadio-5.0.3-master:8901fb5
|
The CW text-to-envelope converter run loop. More...
#include <CWTX.hxx>
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... | |
SoDaBase * | findSoDaObject (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 |
CWGenerator * | cwgen |
Pointer to a text-to-morse translator. More... | |
CmdMBox * | cwtxt_stream |
stream of characters to be encoded (from UI or elsewhere) More... | |
CmdMBox * | cmd_stream |
stream of commands to modify radio state More... | |
DatMBox * | cw_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 |
The CW text-to-envelope converter run loop.
This block uses the CWGenerator object to convert text to a CW envelope.
SoDa::CWTX::CWTX | ( | Params * | params, |
CmdMBox * | cwtxt_stream, | ||
DatMBox * | cw_env_stream, | ||
CmdMBox * | cmd_stream | ||
) |
Constructor.
params | block describing intial setup of the radio |
cwtxt_stream | stream carrying text strings to be converted to morse code |
cw_env_stream | envelope stream from text-to-CW converter |
cmd_stream | command 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().
|
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().
|
private |
add text to the outbound text queue
buf | zero 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().
|
privatevirtual |
execute GET commands from the command channel
cmd | the 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.
|
privatevirtual |
handle Report commands from the command channel
cmd | the 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.
|
privatevirtual |
handle SET commands from the command channel
cmd | the incoming command |
Reimplemented from SoDa::SoDaThread.
Definition at line 156 of file CWTX.cxx.
References break_id_lock, break_notification_id_queue, clearTextQueue(), SoDa::Command::CW_L, SoDa::Command::CW_U, cwgen, enqueueText(), SoDa::Command::iparms, old_txmode_is_cw, SoDa::CWGenerator::setCWSpeed(), SoDa::Command::sparm, SoDa::Command::target, SoDa::Command::TX_BEACON, SoDa::Command::TX_CW_FLUSHTEXT, SoDa::Command::TX_CW_MARKER, SoDa::Command::TX_CW_SPEED, SoDa::Command::TX_CW_TEXT, SoDa::Command::TX_MODE, tx_on, SoDa::Command::TX_STATE, and txmode_is_cw.
|
virtual |
CWTX run loop: translate text to CW envelopes, handle incoming commands.
Implements SoDa::SoDaThread.
Definition at line 60 of file CWTX.cxx.
References cmd_stream, cmd_subs, cwgen, cwtxt_stream, cwtxt_subs, SoDa::SoDaThread::execCommand(), SoDa::MultiMBox< T >::free(), SoDa::MultiMBox< T >::get(), SoDa::CWGenerator::readyForMore(), sendAvailChar(), SoDa::Command::STOP, and SoDa::Command::target.
|
private |
if a character is available, encode it into an envelope
Definition at line 97 of file CWTX.cxx.
References cmd_stream, SoDa::Command::CW_CHAR_SENT, cwgen, SoDa::MultiMBox< T >::put(), SoDa::CWGenerator::readyForMore(), SoDa::Command::REP, SoDa::CWGenerator::sendChar(), sent_char_count, SoDa::Command::SET, text_lock, text_queue, SoDa::Command::TX_CW_EMPTY, tx_on, and txmode_is_cw.
Referenced by run().
|
private |
|
private |
lock for break_notification queue
Definition at line 118 of file CWTX.hxx.
Referenced by execRepCommand(), and execSetCommand().
|
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().
|
private |
stream of commands to modify radio state
Definition at line 100 of file CWTX.hxx.
Referenced by clearTextQueue(), CWTX(), execRepCommand(), run(), and sendAvailChar().
|
private |
|
private |
|
private |
Pointer to a text-to-morse translator.
Definition at line 97 of file CWTX.hxx.
Referenced by CWTX(), execSetCommand(), run(), and sendAvailChar().
|
private |
|
private |
|
private |
remember the mode we were in
Definition at line 106 of file CWTX.hxx.
Referenced by execSetCommand().
|
private |
|
private |
|
private |
Definition at line 95 of file CWTX.hxx.
Referenced by clearTextQueue(), CWTX(), and sendAvailChar().
|
private |
lock for text_queue
Definition at line 115 of file CWTX.hxx.
Referenced by clearTextQueue(), enqueueText(), and sendAvailChar().
|
private |
characters waiting to be sent
Definition at line 114 of file CWTX.hxx.
Referenced by clearTextQueue(), enqueueText(), and sendAvailChar().
|
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().
|
private |
if true, we're transmitting a CW stream
Definition at line 105 of file CWTX.hxx.
Referenced by execSetCommand(), and sendAvailChar().