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
26
namespace
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
*/
62
FawkesNetworkHandler::FawkesNetworkHandler
(
unsigned
short
int
id
)
63
{
64
_id =
id
;
65
}
66
67
68
/** Destructor. */
69
FawkesNetworkHandler::~FawkesNetworkHandler
()
70
{
71
}
72
73
74
/** Get the component ID for this handler.
75
* @return component ID
76
*/
77
unsigned
short
int
78
FawkesNetworkHandler::id
()
const
79
{
80
return
_id;
81
}
82
83
}
// end namespace fawkes
fawkes::FawkesNetworkHandler::FawkesNetworkHandler
FawkesNetworkHandler(unsigned short int id)
Constructor.
Definition:
handler.cpp:62
fawkes
Fawkes library namespace.
fawkes::FawkesNetworkHandler::id
unsigned short int id() const
Get the component ID for this handler.
Definition:
handler.cpp:78
fawkes::FawkesNetworkHandler::~FawkesNetworkHandler
virtual ~FawkesNetworkHandler()
Destructor.
Definition:
handler.cpp:69
src
libs
netcomm
fawkes
handler.cpp
Generated by
1.8.13