Fawkes API
Fawkes Development Version
|
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_type & | signal_msg_rcvd () |
Signal that is invoked when a message has been received. More... | |
OpenPRS communication wrapper.
This class provides communication facilities via the OpenPRS message passer as well as through the OpenPRS server proxy.
Definition at line 41 of file openprs_comm.h.
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.
fawkes::OpenPRSComm::OpenPRSComm | ( | const char * | local_name, |
const char * | hostname, | ||
unsigned short | port, | ||
OpenPRSServerProxy * | server_proxy, | ||
Logger * | logger = NULL |
||
) |
Constructor.
local_name | the local name with which the communication wrapper will be registered to the message parser. This can be used to send messages from the kernel. |
hostname | host where the message passer runs |
port | TCP port where the message passer listens |
server_proxy | server proxy to use to send commands to kernels |
logger | logger for informational messages (optional) |
Definition at line 63 of file openprs_comm.cpp.
|
virtual |
Destructor.
Definition at line 82 of file openprs_comm.cpp.
void fawkes::OpenPRSComm::broadcast_message | ( | const char * | message | ) |
Send a message to all OpenPRS kernels.
message | message to send, cf. OpenPRS manual for valid messages |
Definition at line 107 of file openprs_comm.cpp.
Referenced by name().
void fawkes::OpenPRSComm::broadcast_message | ( | const std::string & | message | ) |
Send a message to all OpenPRS kernels.
message | message to send, cf. OpenPRS manual for valid messages |
Definition at line 139 of file openprs_comm.cpp.
void fawkes::OpenPRSComm::broadcast_message_f | ( | const char * | format, |
... | |||
) |
Send a formatted message to all OpenPRS kernels.
format | format for message to send according to sprintf() |
Definition at line 184 of file openprs_comm.cpp.
Referenced by name().
void fawkes::OpenPRSComm::multicast_message | ( | std::vector< const char *> & | recipients, |
const char * | message | ||
) |
Send a message to multiple OpenPRS kernel.
recipients | Vector of OpenPRS kernel names to send to |
message | message to send, cf. OpenPRS manual for valid messages |
Definition at line 118 of file openprs_comm.cpp.
Referenced by name().
void fawkes::OpenPRSComm::multicast_message | ( | const std::vector< std::string > & | recipients, |
const std::string & | message | ||
) |
Send a message to multiple OpenPRS kernel.
recipients | Vector of OpenPRS kernel names to send to |
message | message to send, cf. OpenPRS manual for valid messages |
Definition at line 150 of file openprs_comm.cpp.
void fawkes::OpenPRSComm::multicast_message_f | ( | const std::vector< std::string > & | recipients, |
const char * | format, | ||
... | |||
) |
Send a message to multiple OpenPRS kernel.
recipients | Vector of OpenPRS kernel names to send to |
format | format for message to send according to sprintf() |
Definition at line 203 of file openprs_comm.cpp.
Referenced by name().
|
inline |
Get 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().
void fawkes::OpenPRSComm::send_message | ( | const char * | recipient, |
const char * | message | ||
) |
Send a message to an OpenPRS kernel.
recipient | OpenPRS kernel name to send to |
message | message to send, cf. OpenPRS manual for valid messages |
Definition at line 97 of file openprs_comm.cpp.
Referenced by name().
void fawkes::OpenPRSComm::send_message | ( | const std::string & | recipient, |
const std::string & | message | ||
) |
Send a message to an OpenPRS kernel.
recipient | OpenPRS kernel name to send to |
message | message to send, cf. OpenPRS manual for valid messages |
Definition at line 129 of file openprs_comm.cpp.
void fawkes::OpenPRSComm::send_message_f | ( | const std::string & | recipient, |
const char * | format, | ||
... | |||
) |
Send a formatted message to an OpenPRS kernel.
recipient | OpenPRS kernel name to send to |
format | format for message to send according to sprintf() |
Definition at line 166 of file openprs_comm.cpp.
Referenced by name().
|
inline |
Signal that is invoked when a message has been received.
Definition at line 77 of file openprs_comm.h.
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.
recipient | OpenPRS kernel name to send to |
message | command 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().
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.
recipient | OpenPRS kernel name to send to |
message | command to send, cf. OpenPRS manual for valid commands |
Definition at line 239 of file openprs_comm.cpp.
References fawkes::OpenPRSServerProxy::transmit_command().
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.
recipient | OpenPRS kernel name to send to |
format | format 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().