Fawkes API  Fawkes Development Version
fawkes::OpenPRSComm Class Reference

#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 42 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 77 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 64 of file openprs_comm.cpp.

◆ ~OpenPRSComm()

fawkes::OpenPRSComm::~OpenPRSComm ( )
virtual

Destructor.

Definition at line 87 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 110 of file openprs_comm.cpp.

◆ 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 183 of file openprs_comm.cpp.

◆ multicast_message() [1/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 149 of file openprs_comm.cpp.

◆ multicast_message() [2/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 120 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 202 of file openprs_comm.cpp.

◆ name()

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

Get OpenPRS local name.

Returns
OpenPRS local name

Definition at line 55 of file openprs_comm.h.

◆ 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 101 of file openprs_comm.cpp.

◆ 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 130 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 165 of file openprs_comm.cpp.

◆ 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 83 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 229 of file openprs_comm.cpp.

References fawkes::OpenPRSServerProxy::transmit_command().

◆ 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 240 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::OpenPRSServerProxy::transmit_command_v().


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