Fawkes API  Fawkes Development Version
fawkes::FawkesNetworkHandler Class Referenceabstract

#include <netcomm/fawkes/handler.h>

Inheritance diagram for fawkes::FawkesNetworkHandler:

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
 

Detailed Description

Network handler abstract base class. This class shall be extended by threads that want to use the Fawkes network connection.

Author
Tim Niemueller

Definition at line 35 of file handler.h.

Constructor & Destructor Documentation

◆ FawkesNetworkHandler()

fawkes::FawkesNetworkHandler::FawkesNetworkHandler ( unsigned short int  id)

Constructor.

Parameters
idthe component ID this handlers wants to handle.

Definition at line 66 of file handler.cpp.

◆ ~FawkesNetworkHandler()

fawkes::FawkesNetworkHandler::~FawkesNetworkHandler ( )
virtual

Destructor.

Definition at line 72 of file handler.cpp.

Member Function Documentation

◆ client_connected()

void fawkes::FawkesNetworkHandler::client_connected ( unsigned int  clid)
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.

Parameters
clidclient ID of new client

Implemented in fawkes::NetworkLogger, fawkes::PluginNetworkHandler, fawkes::ConfigNetworkHandler, fawkes::BlackBoardNetworkHandler, and ExampleNetworkThread.

◆ client_disconnected()

void fawkes::FawkesNetworkHandler::client_disconnected ( unsigned int  clid)
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!

Parameters
clidclient ID of disconnected client

Implemented in fawkes::NetworkLogger, fawkes::PluginNetworkHandler, fawkes::ConfigNetworkHandler, fawkes::BlackBoardNetworkHandler, and ExampleNetworkThread.

◆ handle_network_message()

void fawkes::FawkesNetworkHandler::handle_network_message ( FawkesNetworkMessage msg)
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.

Parameters
msgmessage 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.

◆ id()

unsigned short int fawkes::FawkesNetworkHandler::id ( ) const

Get the component ID for this handler.

Returns
component ID

Definition at line 80 of file handler.cpp.


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