]> rtime.felk.cvut.cz Git - CanFestival-3.git/blob - include/lifegrd.h
Updated SVG drawing to reflect recent changes in API.
[CanFestival-3.git] / include / lifegrd.h
1 /*
2 This file is part of CanFestival, a library implementing CanOpen Stack. 
3
4 Copyright (C): Edouard TISSERANT and Francis DUPIN
5
6 See COPYING file for copyrights details.
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 */
22
23 #ifndef __lifegrd_h__
24 #define __lifegrd_h__
25
26
27 #include <applicfg.h>
28
29 typedef void (*heartbeatError_t)(CO_Data*, UNS8);
30 void _heartbeatError(CO_Data* d, UNS8 heartbeatID);
31
32 typedef void (*post_SlaveBootup_t)(CO_Data*, UNS8);
33 void _post_SlaveBootup(CO_Data* d, UNS8 SlaveID);
34
35 #include "data.h"
36
37 /*************************************************************************
38  * Functions
39  *************************************************************************/
40
41
42 /** To read the state of a node
43  *  This can be used by the master after having sent a life guard request,
44  *  of by any node if it is waiting for heartbeat.
45  */
46 e_nodeState getNodeState (CO_Data* d, UNS8 nodeId);
47
48 /** Start heartbeat consumer and producer
49  *  with respect to 0x1016 and 0x1017
50  *  object dictionary entries
51  */
52 void heartbeatInit(CO_Data* d);
53
54 /** Stop heartbeat consumer and producer
55  */
56 void heartbeatStop(CO_Data* d);
57
58 /** This function is responsible to process a canopen-message which seams to be an NMT Error Control
59  *  Messages. At them moment we assume that every NMT error control message
60  *  is a heartbeat message.
61  *  \param Message The CAN-message which has to be analysed.
62  *  If a BootUp message is detected, it will return the nodeId of the Slave who booted up
63  */
64 void proceedNODE_GUARD (CO_Data* d, Message* m);
65
66 #endif /*__lifegrd_h__ */