SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SoDa::CWTX Class Reference

#include <CWTX.hxx>

Inheritance diagram for SoDa::CWTX:
SoDa::Thread SoDa::Base SoDa::Debug

Public Member Functions

void subscribeToMailBoxes (const std::vector< MailBoxBasePtr > &mailboxes)
 implement the subscription method
void run ()
 CWTX run loop: translate text to CW envelopes, handle incoming commands.
Public Member Functions inherited from SoDa::Thread
void registerThread (SoDa::ThreadPtr me)
void operator() ()
void start ()
 Execute the thread's run loop.
void join ()
 more properly "Wait for this thread to exit its run loop".
void execCommand (CommandPtr cmd)
 Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions.
virtual void shutDown ()
 optional method that performs cleanup – may not delete.
void sleep_ms (unsigned int milliseconds)
void sleep_us (unsigned int microseconds)
uint32_t getID ()
 Get the process/thread ID for this thread – helps with figuring out who caused a segfault.
Public Member Functions inherited from SoDa::Base
 Base (const std::string &oname)
 The constructor – pass a name for the object.
void registerSelf (BasePtr ptr)
std::string & getObjName ()
 get the name of this object
BasePtr findSoDaObject (const std::string &oname)
 find a SoDa Object by name.
double getTime ()
 Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS).
BasePtr getSelfPtr ()
 get a pointer to myself.
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 SoDa::Format &fmt, unsigned int threshold=1)
void debugMsg (const char *msg, unsigned int threshold=1)
void setDebugLevel (unsigned int v)
unsigned int getDebugLevel ()

Static Public Member Functions

static CWTXPtr make (ParamsPtr params)
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 ()

Protected Member Functions

 CWTX (ParamsPtr params)
 Constructor.
Protected Member Functions inherited from SoDa::Thread
 Thread (const std::string &oname, const std::string &version=std::string("12.2.0"))
 make the thread object.
Protected Member Functions inherited from SoDa::Debug
std::string curDateTime ()

Private Member Functions

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

Private Attributes

int sent_char_count
std::shared_ptr< CWGeneratorcwgen
 Pointer to a text-to-morse translator.
CmdMBoxPtr cwtxt_stream
 stream of characters to be encoded (from UI or elsewhere)
CmdMBoxPtr cmd_stream
 stream of commands to modify radio state
FDatMBoxPtr cw_env_stream
 stream carrying cw envelope buffers to USRPTX
CmdMBox::Subscription cwtxt_subs
 subscription for text stream
CmdMBox::Subscription cmd_subs
 subscription for command stream
bool txmode_is_cw
 if true, we're transmitting a CW stream
bool old_txmode_is_cw
 remember the mode we were in
bool tx_on
 if true, we're transmitting a CW stream or a beacon
double rf_sample_rate
 samples/sec for generating the envelope
unsigned int rf_buffer_size
 the size of the envelope buffer
std::queue< char > text_queue
 characters waiting to be sent
std::mutex text_mutex
 mutex for text_queue
std::queue< int > break_notification_id_queue
 tags inserted into text stream – send tag when the CW envelope generator gets to this character.
std::mutex break_id_mutex
 mutex for break_notification queue

Additional Inherited Members

Static Public Attributes inherited from SoDa::Debug
static std::mutex debug_msg_mutex
Protected Attributes inherited from SoDa::Thread
std::weak_ptr< Threadself
 A pointer to ourself.
Protected Attributes inherited from SoDa::Debug
std::string unit_name
 the name of the unit reporting status
unsigned int debug_level
 the debug level (threshold) for messages
Static Protected Attributes inherited from SoDa::Debug
static unsigned int default_debug_level
static unsigned int global_debug_level

Detailed Description

Definition at line 57 of file CWTX.hxx.

Constructor & Destructor Documentation

◆ CWTX()

SoDa::CWTX::CWTX ( ParamsPtr params)
protected

Constructor.

Parameters
paramsblock describing intial setup of the radio

Referenced by make().

Member Function Documentation

◆ clearTextQueue()

void SoDa::CWTX::clearTextQueue ( )
private

forget all enqueued text

◆ enqueueText()

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

add text to the outbound text queue

Parameters
bufzero terminated sequence of ASCII characters

◆ execGetCommand()

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

execute GET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

◆ execRepCommand()

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

handle Report commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

◆ execSetCommand()

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

handle SET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

◆ make()

CWTXPtr SoDa::CWTX::make ( ParamsPtr params)
inlinestatic

Definition at line 66 of file CWTX.hxx.

References CWTX().

◆ run()

void SoDa::CWTX::run ( )
virtual

CWTX run loop: translate text to CW envelopes, handle incoming commands.

Reimplemented from SoDa::Thread.

◆ sendAvailChar()

bool SoDa::CWTX::sendAvailChar ( )
private

if a character is available, encode it into an envelope

◆ subscribeToMailBoxes()

void SoDa::CWTX::subscribeToMailBoxes ( const std::vector< MailBoxBasePtr > & mailboxes)
virtual

implement the subscription method

Implements SoDa::Thread.

Member Data Documentation

◆ break_id_mutex

std::mutex SoDa::CWTX::break_id_mutex
private

mutex for break_notification queue

Definition at line 134 of file CWTX.hxx.

◆ 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 133 of file CWTX.hxx.

◆ cmd_stream

CmdMBoxPtr SoDa::CWTX::cmd_stream
private

stream of commands to modify radio state

Definition at line 118 of file CWTX.hxx.

◆ cmd_subs

CmdMBox::Subscription SoDa::CWTX::cmd_subs
private

subscription for command stream

Definition at line 121 of file CWTX.hxx.

◆ cw_env_stream

FDatMBoxPtr SoDa::CWTX::cw_env_stream
private

stream carrying cw envelope buffers to USRPTX

Definition at line 119 of file CWTX.hxx.

◆ cwgen

std::shared_ptr<CWGenerator> SoDa::CWTX::cwgen
private

Pointer to a text-to-morse translator.

Definition at line 115 of file CWTX.hxx.

◆ cwtxt_stream

CmdMBoxPtr SoDa::CWTX::cwtxt_stream
private

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

Definition at line 117 of file CWTX.hxx.

◆ cwtxt_subs

CmdMBox::Subscription SoDa::CWTX::cwtxt_subs
private

subscription for text stream

Definition at line 120 of file CWTX.hxx.

◆ old_txmode_is_cw

bool SoDa::CWTX::old_txmode_is_cw
private

remember the mode we were in

Definition at line 124 of file CWTX.hxx.

◆ rf_buffer_size

unsigned int SoDa::CWTX::rf_buffer_size
private

the size of the envelope buffer

Definition at line 128 of file CWTX.hxx.

◆ rf_sample_rate

double SoDa::CWTX::rf_sample_rate
private

samples/sec for generating the envelope

Definition at line 127 of file CWTX.hxx.

◆ sent_char_count

int SoDa::CWTX::sent_char_count
private

Definition at line 113 of file CWTX.hxx.

◆ text_mutex

std::mutex SoDa::CWTX::text_mutex
private

mutex for text_queue

Definition at line 131 of file CWTX.hxx.

◆ text_queue

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

characters waiting to be sent

Definition at line 130 of file CWTX.hxx.

◆ tx_on

bool SoDa::CWTX::tx_on
private

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

Definition at line 125 of file CWTX.hxx.

◆ txmode_is_cw

bool SoDa::CWTX::txmode_is_cw
private

if true, we're transmitting a CW stream

Definition at line 123 of file CWTX.hxx.


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