Fawkes API Fawkes Development Version
handler.cpp
1
2/***************************************************************************
3 * handler.cpp - Fawkes network traffic handler
4 *
5 * Created: Mon Nov 20 15:07:01 2006
6 * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#include <netcomm/fawkes/handler.h>
25
26namespace fawkes {
27
28/** @class FawkesNetworkHandler handler.h <netcomm/fawkes/handler.h>
29 * Network handler abstract base class.
30 * This class shall be extended by threads that want to use the Fawkes
31 * network connection.
32 *
33 * @ingroup NetComm
34 * @author Tim Niemueller
35 *
36 *
37 * @fn void FawkesNetworkHandler::handle_network_message(FawkesNetworkMessage *msg) = 0
38 * Called for incoming messages that are addressed to the correct component ID.
39 * Note that this message should be processed really really fast! A good idea is to enqueue
40 * the message in an inbound queue (remember to ref() it!) and then process it in the next
41 * run of loop() or wakeup a processing thread.
42 * @param msg message to handle. If you want to keep this message you have to ref() it!
43 * It is guaranteed that the message will not be erased during the handleNetworkMessage()
44 * run, but afterwards no guarantee is made. So if you want to store the message internally
45 * for example for later processing you have to reference the message.
46 *
47 * @fn void FawkesNetworkHandler::client_connected(unsigned int clid) = 0
48 * Called when a new client connected. If any actions need to be taken on your side this
49 * is the place to do it.
50 * @param clid client ID of new client
51 *
52 * @fn void FawkesNetworkHandler::client_disconnected(unsigned int clid) = 0
53 * Called when a client disconnected. If any actions need to be taken on your side this
54 * is the place to do it. Note that you cannot send any further messages to this client!
55 * @param clid client ID of disconnected client
56 *
57 */
58
59/** Constructor.
60 * @param id the component ID this handlers wants to handle.
61 */
63{
64 _id = id;
65}
66
67/** Destructor. */
69{
70}
71
72/** Get the component ID for this handler.
73 * @return component ID
74 */
75unsigned short int
77{
78 return _id;
79}
80
81} // end namespace fawkes
FawkesNetworkHandler(unsigned short int id)
Constructor.
Definition: handler.cpp:62
virtual ~FawkesNetworkHandler()
Destructor.
Definition: handler.cpp:68
unsigned short int id() const
Get the component ID for this handler.
Definition: handler.cpp:76
Fawkes library namespace.