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

#include <SimpleAccessory.hxx>

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

Public Member Functions

void subscribeToMailBoxes (const std::vector< SoDa::MailBoxBasePtr > &mailboxes)
 connect to useful mailboxes.
void run ()
 Each thread object must define its "run" loop.
void execGetCommand (SoDa::CommandPtr cmd)
 execute GET commands from the command channel
void execSetCommand (SoDa::CommandPtr cmd)
 handle SET commands from the command channel
void execRepCommand (SoDa::CommandPtr cmd)
 handle Report commands from the command channel
void shutDown ()
 optional method that performs cleanup – may not delete.
void printReport ()
Public Member Functions inherited from SoDa::Thread
void registerThread (SoDa::ThreadPtr me)
virtual void subscribeToMailBoxes (const std::vector< MailBoxBasePtr > &mailboxes)=0
 the creator of this thread may offer one or more mailboxes to this object.
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.
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 SimpleAccessoryPtr make (const std::string &name)
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 ()

Public Attributes

SoDa::CmdMBox::Subscription cmd_subs
 mailbox subscription ID for command stream
SoDa::CmdMBoxPtr cmd_stream
 mailbox producing command stream from user
unsigned int get_count
unsigned int set_count
unsigned int rep_count

Private Member Functions

 SimpleAccessory (const std::string &name)

Additional Inherited Members

Static Public Attributes inherited from SoDa::Debug
static std::mutex debug_msg_mutex
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 ()
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 54 of file SimpleAccessory.hxx.

Constructor & Destructor Documentation

◆ SimpleAccessory()

SimpleAccessory::SimpleAccessory ( const std::string & name)
private

Referenced by make().

Member Function Documentation

◆ execGetCommand()

void SimpleAccessory::execGetCommand ( SoDa::CommandPtr cmd)
inlinevirtual

execute GET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

Definition at line 80 of file SimpleAccessory.hxx.

References get_count.

◆ execRepCommand()

void SimpleAccessory::execRepCommand ( SoDa::CommandPtr cmd)
inlinevirtual

handle Report commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

Definition at line 94 of file SimpleAccessory.hxx.

References rep_count.

◆ execSetCommand()

void SimpleAccessory::execSetCommand ( SoDa::CommandPtr cmd)
inlinevirtual

handle SET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

Definition at line 87 of file SimpleAccessory.hxx.

References set_count.

◆ make()

SimpleAccessoryPtr SimpleAccessory::make ( const std::string & name)
inlinestatic

Definition at line 60 of file SimpleAccessory.hxx.

References SimpleAccessory().

◆ printReport()

void SimpleAccessory::printReport ( )

Referenced by shutDown().

◆ run()

void SimpleAccessory::run ( )
virtual

Each thread object must define its "run" loop.

This loop exits only when the thread has received a STOP command on one of its command mailboxes.

Reimplemented from SoDa::Thread.

◆ shutDown()

void SimpleAccessory::shutDown ( )
inlinevirtual

optional method that performs cleanup – may not delete.

Reimplemented from SoDa::Thread.

Definition at line 98 of file SimpleAccessory.hxx.

References printReport().

◆ subscribeToMailBoxes()

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

connect to useful mailboxes.

Parameters
mailboxeslist of mailboxes to which we might subscribe.

Member Data Documentation

◆ cmd_stream

SoDa::CmdMBoxPtr SimpleAccessory::cmd_stream

mailbox producing command stream from user

Definition at line 105 of file SimpleAccessory.hxx.

◆ cmd_subs

SoDa::CmdMBox::Subscription SimpleAccessory::cmd_subs

mailbox subscription ID for command stream

Definition at line 104 of file SimpleAccessory.hxx.

◆ get_count

unsigned int SimpleAccessory::get_count

Definition at line 107 of file SimpleAccessory.hxx.

Referenced by execGetCommand().

◆ rep_count

unsigned int SimpleAccessory::rep_count

Definition at line 107 of file SimpleAccessory.hxx.

Referenced by execRepCommand().

◆ set_count

unsigned int SimpleAccessory::set_count

Definition at line 107 of file SimpleAccessory.hxx.

Referenced by execSetCommand().


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