2 This file is part of CanFestival, a library implementing CanOpen Stack.
4 Copyright (C): Edouard TISSERANT and Francis DUPIN
6 See COPYING file for copyrights details.
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.
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.
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
30 * values are choosen so, that they can be sent directly
31 * for heartbeat messages...
32 * Must be coded on 7 bits only
34 /* Should not be modified */
36 Initialisation = 0x00,
42 Pre_operational = 0x7F,
46 typedef enum enum_nodeState e_nodeState;
57 } s_state_communication;
59 /** Function that user app can overload
62 typedef void (*initialisation_t)(CO_Data*);
63 typedef void (*preOperational_t)(CO_Data*);
64 typedef void (*operational_t)(CO_Data*);
65 typedef void (*stopped_t)(CO_Data*);
67 void _initialisation(CO_Data*);
68 void _preOperational(CO_Data*);
69 void _operational(CO_Data*);
70 void _stopped(CO_Data*);
74 /************************* prototypes ******************************/
76 /** Called by driver/app when receiving messages
78 void canDispatch(CO_Data* d, Message *m);
80 /** Returns the state of the node
82 e_nodeState getState (CO_Data* d);
84 /** Change the state of the node
86 UNS8 setState (CO_Data* d, e_nodeState newState);
90 UNS8 getNodeId (CO_Data* d);
92 /** Define the node ID. Initialize the object dictionary
94 void setNodeId (CO_Data* d, UNS8 nodeId);
96 /** Some stuff to do when the node enter in reset mode
99 /* void initResetMode (CO_Data* d); */
102 /** Some stuff to do when the node enter in pre-operational mode
105 void initPreOperationalMode (CO_Data* d);