Fawkes API  Fawkes Development Version
fawkes::OpenPRSComm Class Reference

OpenPRS communication wrapper. More...

#include <>>

Public Types

typedef boost::signals2::signal< void(std::string, std::string)> signal_msg_rcvd_type
 Boost signal for a received message. More...
 

Public Member Functions

 OpenPRSComm (const char *local_name, const char *hostname, unsigned short port, OpenPRSServerProxy *server_proxy, Logger *logger=NULL)
 Constructor. More...
 
virtual ~OpenPRSComm ()
 Destructor. More...
 
const std::string & name () const
 Get OpenPRS local name. More...
 
void send_message (const char *recipient, const char *message)
 Send a message to an OpenPRS kernel. More...
 
void broadcast_message (const char *message)
 Send a message to all OpenPRS kernels. More...
 
void multicast_message (std::vector< const char *> &recipients, const char *message)
 Send a message to multiple OpenPRS kernel. More...
 
void send_message (const std::string &recipient, const std::string &message)
 Send a message to an OpenPRS kernel. More...
 
void broadcast_message (const std::string &message)
 Send a message to all OpenPRS kernels. More...
 
void multicast_message (const std::vector< std::string > &recipients, const std::string &message)
 Send a message to multiple OpenPRS kernel. More...
 
void send_message_f (const std::string &recipient, const char *format,...)
 Send a formatted message to an OpenPRS kernel. More...
 
void broadcast_message_f (const char *format,...)
 Send a formatted message to all OpenPRS kernels. More...
 
void multicast_message_f (const std::vector< std::string > &recipients, const char *format,...)
 Send a message to multiple OpenPRS kernel. More...
 
void transmit_command (const char *recipient, const char *message)
 Transmit a command to an OpenPRS kernel. More...
 
void transmit_command (const std::string &recipient, const std::string &message)
 Transmit a command to an OpenPRS kernel. More...
 
void transmit_command_f (const std::string &recipient, const char *format,...)
 Transmit a command to an OpenPRS kernel. More...
 
signal_msg_rcvd_typesignal_msg_rcvd ()
 Signal that is invoked when a message has been received. More...
 

Detailed Description

OpenPRS communication wrapper.

This class provides communication facilities via the OpenPRS message passer as well as through the OpenPRS server proxy.

Author
Tim Niemueller

Definition at line 41 of file openprs_comm.h.

Member Typedef Documentation

◆ signal_msg_rcvd_type

typedef boost::signals2::signal<void (std::string, std::string)> fawkes::OpenPRSComm::signal_msg_rcvd_type

Boost signal for a received message.

Definition at line 72 of file openprs_comm.h.

Constructor & Destructor Documentation

◆ OpenPRSComm()

fawkes::OpenPRSComm::OpenPRSComm ( const char *  local_name,
const char *  hostname,
unsigned short  port,
OpenPRSServerProxy server_proxy,
Logger logger = NULL 
)

Constructor.

Parameters
local_namethe local name with which the communication wrapper will be registered to the message parser. This can be used to send messages from the kernel.
hostnamehost where the message passer runs
portTCP port where the message passer listens
server_proxyserver proxy to use to send commands to kernels
loggerlogger for informational messages (optional)

Definition at line 63 of file openprs_comm.cpp.

◆ ~OpenPRSComm()

fawkes::OpenPRSComm::~OpenPRSComm ( )
virtual

Destructor.

Definition at line 82 of file openprs_comm.cpp.

Member Function Documentation

◆ broadcast_message() [1/2]

void fawkes::OpenPRSComm::broadcast_message ( const char *  message)

Send a message to all OpenPRS kernels.

Parameters
messagemessage to send, cf. OpenPRS manual for valid messages

Definition at line 107 of file openprs_comm.cpp.

Referenced by name().

◆ broadcast_message() [2/2]

void fawkes::OpenPRSComm::broadcast_message ( const std::string &  message)

Send a message to all OpenPRS kernels.

Parameters
messagemessage to send, cf. OpenPRS manual for valid messages

Definition at line 139 of file openprs_comm.cpp.

◆ broadcast_message_f()

void fawkes::OpenPRSComm::broadcast_message_f ( const char *  format,
  ... 
)

Send a formatted message to all OpenPRS kernels.

Parameters
formatformat for message to send according to sprintf()

Definition at line 184 of file openprs_comm.cpp.

Referenced by name().

◆ multicast_message() [1/2]

void fawkes::OpenPRSComm::multicast_message ( std::vector< const char *> &  recipients,
const char *  message 
)

Send a message to multiple OpenPRS kernel.

Parameters
recipientsVector of OpenPRS kernel names to send to
messagemessage to send, cf. OpenPRS manual for valid messages

Definition at line 118 of file openprs_comm.cpp.

Referenced by name().

◆ multicast_message() [2/2]

void fawkes::OpenPRSComm::multicast_message ( const std::vector< std::string > &  recipients,
const std::string &  message 
)

Send a message to multiple OpenPRS kernel.

Parameters
recipientsVector of OpenPRS kernel names to send to
messagemessage to send, cf. OpenPRS manual for valid messages

Definition at line 150 of file openprs_comm.cpp.

◆ multicast_message_f()

void fawkes::OpenPRSComm::multicast_message_f ( const std::vector< std::string > &  recipients,
const char *  format,
  ... 
)

Send a message to multiple OpenPRS kernel.

Parameters
recipientsVector of OpenPRS kernel names to send to
formatformat for message to send according to sprintf()

Definition at line 203 of file openprs_comm.cpp.

Referenced by name().

◆ name()

const std::string& fawkes::OpenPRSComm::name ( ) const
inline

Get OpenPRS local name.

Returns
OpenPRS local name

Definition at line 50 of file openprs_comm.h.

References broadcast_message(), broadcast_message_f(), multicast_message(), multicast_message_f(), send_message(), send_message_f(), transmit_command(), and transmit_command_f().

◆ send_message() [1/2]

void fawkes::OpenPRSComm::send_message ( const char *  recipient,
const char *  message 
)

Send a message to an OpenPRS kernel.

Parameters
recipientOpenPRS kernel name to send to
messagemessage to send, cf. OpenPRS manual for valid messages

Definition at line 97 of file openprs_comm.cpp.

Referenced by name().

◆ send_message() [2/2]

void fawkes::OpenPRSComm::send_message ( const std::string &  recipient,
const std::string &  message 
)

Send a message to an OpenPRS kernel.

Parameters
recipientOpenPRS kernel name to send to
messagemessage to send, cf. OpenPRS manual for valid messages

Definition at line 129 of file openprs_comm.cpp.

◆ send_message_f()

void fawkes::OpenPRSComm::send_message_f ( const std::string &  recipient,
const char *  format,
  ... 
)

Send a formatted message to an OpenPRS kernel.

Parameters
recipientOpenPRS kernel name to send to
formatformat for message to send according to sprintf()

Definition at line 166 of file openprs_comm.cpp.

Referenced by name().

◆ signal_msg_rcvd()

signal_msg_rcvd_type& fawkes::OpenPRSComm::signal_msg_rcvd ( )
inline

Signal that is invoked when a message has been received.

Returns
signal

Definition at line 77 of file openprs_comm.h.

◆ transmit_command() [1/2]

void fawkes::OpenPRSComm::transmit_command ( const char *  recipient,
const char *  message 
)

Transmit a command to an OpenPRS kernel.

This works equivalent to the transmit oprs-server console command.

Parameters
recipientOpenPRS kernel name to send to
messagecommand to send, cf. OpenPRS manual for valid commands

Definition at line 228 of file openprs_comm.cpp.

References fawkes::OpenPRSServerProxy::transmit_command().

Referenced by name().

◆ transmit_command() [2/2]

void fawkes::OpenPRSComm::transmit_command ( const std::string &  recipient,
const std::string &  message 
)

Transmit a command to an OpenPRS kernel.

This works equivalent to the transmit oprs-server console command.

Parameters
recipientOpenPRS kernel name to send to
messagecommand to send, cf. OpenPRS manual for valid commands

Definition at line 239 of file openprs_comm.cpp.

References fawkes::OpenPRSServerProxy::transmit_command().

◆ transmit_command_f()

void fawkes::OpenPRSComm::transmit_command_f ( const std::string &  recipient,
const char *  format,
  ... 
)

Transmit a command to an OpenPRS kernel.

This works equivalent to the transmit oprs-server console command. This function allows to pass a format according to the sprintf() format and its arguments.

Parameters
recipientOpenPRS kernel name to send to
formatformat string for the command, must be followed by the appropriate number and types of arguments.

Definition at line 254 of file openprs_comm.cpp.

References fawkes::Logger::log_warn(), fawkes::OpenPRSServerProxy::transmit_command_v(), and fawkes::Exception::what_no_backtrace().

Referenced by fawkes::OpenPRSAspectIniFin::init(), and name().


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