Fawkes API
Fawkes Development Version
|
#include <netcomm/fawkes/handler.h>
Public Member Functions | |
FawkesNetworkHandler (unsigned short int id) | |
Constructor. More... | |
virtual | ~FawkesNetworkHandler () |
Destructor. More... | |
unsigned short int | id () const |
Get the component ID for this handler. More... | |
virtual void | handle_network_message (FawkesNetworkMessage *msg)=0 |
virtual void | client_connected (unsigned int clid)=0 |
virtual void | client_disconnected (unsigned int clid)=0 |
Network handler abstract base class. This class shall be extended by threads that want to use the Fawkes network connection.
fawkes::FawkesNetworkHandler::FawkesNetworkHandler | ( | unsigned short int | id | ) |
Constructor.
id | the component ID this handlers wants to handle. |
Definition at line 66 of file handler.cpp.
|
virtual |
Destructor.
Definition at line 72 of file handler.cpp.
|
pure virtual |
Called when a new client connected. If any actions need to be taken on your side this is the place to do it.
clid | client ID of new client |
Implemented in fawkes::NetworkLogger, fawkes::PluginNetworkHandler, fawkes::ConfigNetworkHandler, fawkes::BlackBoardNetworkHandler, and ExampleNetworkThread.
|
pure virtual |
Called when a client disconnected. If any actions need to be taken on your side this is the place to do it. Note that you cannot send any further messages to this client!
clid | client ID of disconnected client |
Implemented in fawkes::NetworkLogger, fawkes::PluginNetworkHandler, fawkes::ConfigNetworkHandler, fawkes::BlackBoardNetworkHandler, and ExampleNetworkThread.
|
pure virtual |
Called for incoming messages that are addressed to the correct component ID. Note that this message should be processed really really fast! A good idea is to enqueue the message in an inbound queue (remember to ref() it!) and then process it in the next run of loop() or wakeup a processing thread.
msg | message to handle. If you want to keep this message you have to ref() it! It is guaranteed that the message will not be erased during the handleNetworkMessage() run, but afterwards no guarantee is made. So if you want to store the message internally for example for later processing you have to reference the message. |
Implemented in fawkes::NetworkLogger, fawkes::PluginNetworkHandler, fawkes::ConfigNetworkHandler, fawkes::BlackBoardNetworkHandler, and ExampleNetworkThread.
unsigned short int fawkes::FawkesNetworkHandler::id | ( | ) | const |
Get the component ID for this handler.
Definition at line 80 of file handler.cpp.