fawkes::FawkesNetworkHandler Class Reference
[Fawkes Network Communication]

Network handler abstract base class. More...

#include <netcomm/fawkes/handler.h>

Inheritance diagram for fawkes::FawkesNetworkHandler:

[legend]
List of all members.

Public Member Functions

 FawkesNetworkHandler (unsigned short int id)
 Constructor.
virtual ~FawkesNetworkHandler ()
 Destructor.
unsigned short int id () const
 Get the component ID for this handler.
virtual void handle_network_message (FawkesNetworkMessage *msg)=0
 Called for incoming messages that are addressed to the correct component ID.
virtual void client_connected (unsigned int clid)=0
 Called when a new client connected.
virtual void client_disconnected (unsigned int clid)=0
 Called when a client disconnected.

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 31 of file handler.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
id the component ID this handlers wants to handle.

Definition at line 62 of file handler.cpp.

fawkes::FawkesNetworkHandler::~FawkesNetworkHandler (  )  [virtual]

Destructor.

Definition at line 69 of file handler.cpp.


Member Function Documentation

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:
clid client ID of new client

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

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:
clid client ID of disconnected client

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

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:
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::BlackBoardNetworkHandler, fawkes::ConfigNetworkHandler, fawkes::NetworkLogger, fawkes::PluginNetworkHandler, and ExampleNetworkThread.

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

Get the component ID for this handler.

Returns:
component ID

Definition at line 78 of file handler.cpp.

Referenced by fawkes::FawkesNetworkServerThread::add_handler(), and fawkes::FawkesNetworkServerThread::remove_handler().


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:32:52 2011 for Fawkes API by  doxygen 1.4.7