etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: greg@529: /** @defgroup heartbeato Heartbeat Object greg@529: * The heartbeat mechanism for a device is established through cyclically transmitting a message by a greg@529: * heartbeat producer. One or more devices in the network are aware of this heartbeat message. If the greg@529: * heartbeat cycle fails for the heartbeat producer the local application on the heartbeat consumer will be greg@529: * informed about that event. greg@529: * @ingroup comobj greg@529: */ greg@529: etisserant@0: #ifndef __lifegrd_h__ etisserant@0: #define __lifegrd_h__ etisserant@0: etisserant@0: etisserant@0: #include etisserant@0: etisserant@378: typedef void (*heartbeatError_t)(CO_Data*, UNS8); etisserant@378: void _heartbeatError(CO_Data* d, UNS8 heartbeatID); etisserant@0: etisserant@378: typedef void (*post_SlaveBootup_t)(CO_Data*, UNS8); etisserant@378: void _post_SlaveBootup(CO_Data* d, UNS8 SlaveID); etisserant@343: Christian@635: typedef void (*post_SlaveStateChange_t)(CO_Data*, UNS8, e_nodeState); Christian@635: void _post_SlaveStateChange(CO_Data* d, UNS8 nodeId, e_nodeState newNodeState); Christian@635: etisserant@0: #include "data.h" etisserant@0: frdupin@71: /************************************************************************* frdupin@71: * Functions frdupin@74: *************************************************************************/ etisserant@0: greg@528: /** greg@529: * @ingroup statemachine greg@528: * @brief To read the state of a node greg@528: * This can be used by the master after having sent a life guard request, greg@528: * of by any node if it is waiting for heartbeat. greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param nodeId Id of a node greg@528: * @return e_nodeState State of the node corresponding to the nodeId etisserant@0: */ etisserant@0: e_nodeState getNodeState (CO_Data* d, UNS8 nodeId); etisserant@0: greg@528: /** greg@528: * @brief Start heartbeat consumer and producer greg@528: * with respect to 0x1016 and 0x1017 greg@528: * object dictionary entries greg@528: * @param *d Pointer on a CAN object data structure etisserant@0: */ etisserant@0: void heartbeatInit(CO_Data* d); etisserant@0: greg@528: /** greg@528: * @brief Stop heartbeat consumer and producer greg@528: * @param *d Pointer on a CAN object data structure etisserant@0: */ etisserant@0: void heartbeatStop(CO_Data* d); etisserant@0: greg@528: /** greg@528: * @brief This function is responsible to process a canopen-message which seams to be an NMT Error Control greg@528: * Messages. At them moment we assume that every NMT error control message greg@528: * is a heartbeat message. greg@528: * If a BootUp message is detected, it will return the nodeId of the Slave who booted up greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param *m Pointer on the CAN-message which has to be analysed. etisserant@0: */ etisserant@0: void proceedNODE_GUARD (CO_Data* d, Message* m); etisserant@0: frdupin@71: #endif /*__lifegrd_h__ */