Fawkes API
Fawkes Development Version
|
Fawkes Network Hub. More...
#include <netcomm/fawkes/hub.h>
Public Member Functions | |
virtual | ~FawkesNetworkHub () |
Virtual empty destructor. More... | |
virtual void | broadcast (FawkesNetworkMessage *msg)=0 |
Method to broadcast a message to all connected clients. More... | |
virtual void | broadcast (unsigned short int component_id, unsigned short int msg_id, void *payload, unsigned int payload_size)=0 |
This is an overloaded member function, provided for convenience. More... | |
virtual void | broadcast (unsigned short int component_id, unsigned short int msg_id)=0 |
This is an overloaded member function, provided for convenience. More... | |
virtual void | send (FawkesNetworkMessage *msg)=0 |
Method to send a message to a specific client. More... | |
virtual void | send (unsigned int to_clid, unsigned short int component_id, unsigned short int msg_id)=0 |
This is an overloaded member function, provided for convenience. More... | |
virtual void | send (unsigned int to_clid, unsigned short int component_id, unsigned short int msg_id, void *payload, unsigned int payload_size)=0 |
This is an overloaded member function, provided for convenience. More... | |
virtual void | send (unsigned int to_clid, unsigned short int component_id, unsigned short int msg_id, FawkesNetworkMessageContent *content)=0 |
This is an overloaded member function, provided for convenience. More... | |
virtual void | add_handler (FawkesNetworkHandler *handler)=0 |
Add a message handler. More... | |
virtual void | remove_handler (FawkesNetworkHandler *handler)=0 |
Remove a message handler. More... | |
virtual void | force_send ()=0 |
Force sending of all pending messages. More... | |
Fawkes Network Hub.
This interface is the main entry point for applications, plugins and threads that use the Fawkes network protocol. The hub provides means for broadcasting messages to all connected clients, for sending messages to a specific connected client and to add and remove handlers to process incoming messages.
|
virtual |
|
pure virtual |
Add a message handler.
This message handler is called for incoming messages that have an appropriate component ID (which is supplied by the handler).
handler | handler to add |
Implemented in fawkes::FawkesNetworkServerThread.
Referenced by fawkes::BlackBoardNetworkHandler::BlackBoardNetworkHandler(), fawkes::ConfigNetworkHandler::ConfigNetworkHandler(), ExampleNetworkThread::init(), fawkes::NetworkLogger::NetworkLogger(), and fawkes::PluginNetworkHandler::PluginNetworkHandler().
|
pure virtual |
Method to broadcast a message to all connected clients.
This method shall be implemented thus that the message is sent to all connected clients.
msg | message to send. |
Implemented in fawkes::FawkesNetworkServerThread.
Referenced by fawkes::BlackBoardNetHandlerInterfaceObserver::~BlackBoardNetHandlerInterfaceObserver().
|
pure virtual |
This is an overloaded member function, provided for convenience.
It differs from the above function only in what arguments it accepts. A FawkesNetworkMessage will be created transparently and broadcasted.
component_id | component id |
msg_id | message id |
payload | buffer with payload |
payload_size | payload size |
Implemented in fawkes::FawkesNetworkServerThread.
|
pure virtual |
This is an overloaded member function, provided for convenience.
It differs from the above function only in what arguments it accepts. A FawkesNetworkMessage will be created transparently and broadcasted. This can be used for messages without payload.
component_id | component id |
msg_id | message id |
Implemented in fawkes::FawkesNetworkServerThread.
|
pure virtual |
Force sending of all pending messages.
This will order the sending of all pending outbound messages that are currently enqueued for clients. The method will block until this is done. It is not ensured that no messages are added during that time. Make sure that the call constraints guarantee this.
Implemented in fawkes::FawkesNetworkServerThread.
|
pure virtual |
Remove a message handler.
The message handler is removed from the list of handlers and is no longer called for incoming data.
handler | handler to remove |
Implemented in fawkes::FawkesNetworkServerThread.
Referenced by ExampleNetworkThread::finalize(), fawkes::BlackBoardNetworkHandler::~BlackBoardNetworkHandler(), fawkes::ConfigNetworkHandler::~ConfigNetworkHandler(), fawkes::NetworkLogger::~NetworkLogger(), and fawkes::PluginNetworkHandler::~PluginNetworkHandler().
|
pure virtual |
Method to send a message to a specific client.
The recipient has to be specified in the message or sending the message will fail.
msg | message to send |
Implemented in fawkes::FawkesNetworkServerThread.
Referenced by fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_data_changed(), fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_message_received(), fawkes::ConfigNetworkHandler::config_value_erased(), ExampleNetworkThread::handle_network_message(), fawkes::BlackBoardNetworkHandler::loop(), fawkes::ConfigNetworkHandler::loop(), fawkes::PluginNetworkHandler::loop(), fawkes::ConfigNetworkHandler::~ConfigNetworkHandler(), fawkes::NetworkLogger::~NetworkLogger(), and fawkes::PluginNetworkHandler::~PluginNetworkHandler().
|
pure virtual |
This is an overloaded member function, provided for convenience.
It differs from the above function only in what arguments it accepts. A FawkesNetworkMessage will be created transparently and send to the client with the given ID. This can be used for messages without payload.
to_clid | client ID of recipient |
component_id | component id |
msg_id | message ID |
Implemented in fawkes::FawkesNetworkServerThread.
|
pure virtual |
This is an overloaded member function, provided for convenience.
It differs from the above function only in what arguments it accepts. A FawkesNetworkMessage will be created transparently and send to the client with the given ID.
to_clid | client ID of recipient |
component_id | component id |
msg_id | message id |
payload | buffer with payload |
payload_size | payload size |
Implemented in fawkes::FawkesNetworkServerThread.
|
pure virtual |
This is an overloaded member function, provided for convenience.
It differs from the above function only in what arguments it accepts. A FawkesNetworkMessage will be created transparently and send to the client with the given ID.
to_clid | client ID of recipient |
component_id | component id |
msg_id | message id |
content | complex message content |
Implemented in fawkes::FawkesNetworkServerThread.