Sam Grove / Mbed 2 deprecated canopen_masternode

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lifegrd.h Source File

lifegrd.h

00001 /*
00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
00003 
00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
00005 
00006 See COPYING file for copyrights details.
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Lesser General Public
00010 License as published by the Free Software Foundation; either
00011 version 2.1 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public
00019 License along with this library; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 /** @defgroup heartbeato Heartbeat Object
00024  *  The heartbeat mechanism for a device is established through cyclically transmitting a message by a
00025  *    heartbeat producer. One or more devices in the network are aware of this heartbeat message. If the
00026  *    heartbeat cycle fails for the heartbeat producer the local application on the heartbeat consumer will be
00027  *    informed about that event.
00028  *  @ingroup comobj
00029  */
00030                      
00031 #ifndef __lifegrd_h__
00032 #define __lifegrd_h__
00033 
00034 
00035 #include <applicfg.h>
00036 
00037 typedef void (*heartbeatError_t)(CO_Data*, UNS8);
00038 void _heartbeatError (CO_Data* d, UNS8 heartbeatID);
00039 
00040 typedef void (*post_SlaveBootup_t)(CO_Data*, UNS8);
00041 void _post_SlaveBootup(CO_Data* d, UNS8 SlaveID);
00042 
00043 typedef void (*post_SlaveStateChange_t)(CO_Data*, UNS8, e_nodeState);
00044 void _post_SlaveStateChange(CO_Data* d, UNS8 nodeId, e_nodeState newNodeState);
00045 
00046 #include "data.h"
00047 
00048 /*************************************************************************
00049  * Functions
00050  *************************************************************************/
00051 
00052 /** 
00053  * @ingroup statemachine
00054  * @brief To read the state of a node
00055  * This can be used by the master after having sent a life guard request,
00056  * of by any node if it is waiting for heartbeat.
00057  * @param *d Pointer on a CAN object data structure
00058  * @param nodeId Id of a node
00059  * @return e_nodeState State of the node corresponding to the nodeId
00060  */
00061 e_nodeState getNodeState (CO_Data* d, UNS8 nodeId);
00062 
00063 /** 
00064  * @brief Start heartbeat consumer and producer
00065  * with respect to 0x1016 and 0x1017
00066  * object dictionary entries
00067  * @param *d Pointer on a CAN object data structure
00068  */
00069 void heartbeatInit(CO_Data* d);
00070 
00071 /** 
00072  * @brief Stop heartbeat consumer and producer
00073  * @param *d Pointer on a CAN object data structure
00074  */
00075 void heartbeatStop(CO_Data* d);
00076 
00077 /** 
00078  * @brief This function is responsible to process a canopen-message which seams to be an NMT Error Control
00079  * Messages. At them moment we assume that every NMT error control message
00080  * is a heartbeat message.
00081  * If a BootUp message is detected, it will return the nodeId of the Slave who booted up
00082  * @param *d Pointer on a CAN object data structure 
00083  * @param *m Pointer on the CAN-message which has to be analysed.
00084  */
00085 void proceedNODE_GUARD (CO_Data* d, Message* m);
00086 
00087 #endif /*__lifegrd_h__ */