32 #ifndef MESSAGE_MANAGER_H 33 #define MESSAGE_MANAGER_H 52 namespace message_manager
264 this->connection_ = connection;
286 this->num_handlers_ = num_handlers;
295 #endif //MESSAGE_MANAGER industrial::comms_fault_handler::CommsFaultHandler * getCommsFaultHandler()
Gets communications fault handler.
Interface definition for communications fault handler. Defines the type of communcations faults that ...
Interface definition for message handlers. The interface defines the callback function that should ex...
industrial::message_handler::MessageHandler * getHandler(int msg_type)
Gets message handler for specific message type.
Defines an interface and common methods for sending simple messages (see simple_message). This interface makes a bare minimum of assumptions:
void setConnection(industrial::smpl_msg_connection::SmplMsgConnection *connection)
Sets connection manager.
industrial::simple_comms_fault_handler::SimpleCommsFaultHandler & getDefaultCommsFaultHandler()
Gets default communications fault handler.
industrial::message_handler::MessageHandler * handlers_[MAX_NUM_HANDLERS]
buffer of handlers
unsigned int getNumHandlers()
Gets number of handlers.
void spinOnce()
Perform an single execution of the message manager (a single receive and send (if required) ...
MessageManager()
Constructor.
void spin()
Perform a indefinite execution of the message manager.
bool add(industrial::message_handler::MessageHandler *handler, bool allow_replace=false)
Adds a message handler to the manager.
Message handler that handles ping messages.
The message manager handles communications for a simple server.
unsigned int num_handlers_
Number of handlers.
Default implementation of comms fault handler. This class attempts to reconnect if the connection is ...
industrial::smpl_msg_connection::SmplMsgConnection * getConnection()
Gets connection for manager.
industrial::simple_comms_fault_handler::SimpleCommsFaultHandler def_comms_hndlr_
Internal default comms handler (this is used if a communications fault handler is not specified as pa...
void setNumHandlers(unsigned int num_handlers)
Sets message type that callback expects.
industrial::ping_handler::PingHandler ping_hndlr_
Internal ping handle (by default every message manager can handle pings)
~MessageManager()
Destructor.
static const unsigned int MAX_NUM_HANDLERS
Maximum number of handlers.
int getHandlerIdx(int msg_type)
Gets index of message handler for specific message type.
unsigned int getMaxNumHandlers()
Gets maximumn number of handlers.
industrial::smpl_msg_connection::SmplMsgConnection * connection_
Reference to reply connection (called if incoming message requires a reply)
void setCommsFaultHandler(industrial::comms_fault_handler::CommsFaultHandler *handler)
Gets communications fault handler.
bool init(industrial::smpl_msg_connection::SmplMsgConnection *connection)
Class initializer.
industrial::comms_fault_handler::CommsFaultHandler * comms_hndlr_
Reference to comms handler.
industrial::ping_handler::PingHandler & getPingHandler()
Gets ping handler.