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@528: /** @defgroup networkmanagement Network Management greg@528: * @ingroup userapi greg@528: */ greg@528: /** @defgroup nmtmaster NMT Master greg@529: * @brief NMT master provides mechanisms that control and monitor the state of nodes and their behavior in the network. greg@528: * @ingroup networkmanagement greg@528: */ greg@528: etisserant@0: #ifndef __nmtMaster_h__ etisserant@0: #define __nmtMaster_h__ etisserant@0: etisserant@0: #include "data.h" etisserant@0: greg@528: /** greg@528: * @ingroup nmtmaster greg@561: * @brief Transmit a NMT message on the network to the slave whose nodeId is node ID. greg@528: * greg@561: * @param *d Pointer to a CAN object data structure greg@561: * @param nodeId Id of the slave node greg@561: * @param cs The order of state changement \n\n greg@561: * greg@561: * Allowed states : greg@561: * - cs = NMT_Start_Node // Put the node in operational mode greg@561: * - cs = NMT_Stop_Node // Put the node in stopped mode greg@561: * - cs = NMT_Enter_PreOperational // Put the node in pre_operational mode greg@561: * - cs = NMT_Reset_Node // Put the node in initialization mode greg@561: * - cs = NMT_Reset_Comunication // Put the node in initialization mode greg@561: * etisserant@0: * The mode is changed according to the slave state machine mode : greg@528: * - initialisation ---> pre-operational (Automatic transition) greg@528: * - pre-operational <--> operational greg@528: * - pre-operational <--> stopped greg@561: * - pre-operational, operational, stopped -> initialisation greg@561: * \n\n greg@561: * @return errorcode greg@561: * - 0 if the NMT message was send greg@561: * - 1 if an error occurs etisserant@0: */ greg@561: UNS8 masterSendNMTstateChange (CO_Data* d, UNS8 nodeId, UNS8 cs); etisserant@0: greg@528: /** greg@528: * @ingroup nmtmaster greg@561: * @brief Transmit a NodeGuard message on the network to the slave whose nodeId is node ID greg@528: * greg@561: * @param *d Pointer to a CAN object data structure greg@528: * @param nodeId Id of the slave node greg@561: * @return greg@561: * - 0 is returned if the NodeGuard message was send. greg@561: * - 1 is returned if an error occurs. etisserant@0: */ etisserant@0: UNS8 masterSendNMTnodeguard (CO_Data* d, UNS8 nodeId); etisserant@0: greg@528: /** greg@528: * @ingroup nmtmaster greg@561: * @brief Ask the state of the slave node whose nodeId is node Id. greg@528: * greg@561: * To ask states of all nodes on the network (NMT broadcast), nodeId must be equal to 0 greg@561: * @param *d Pointer to a CAN object data structure greg@528: * @param nodeId Id of the slave node etisserant@0: */ edouard@631: UNS8 masterRequestNodeState (CO_Data* d, UNS8 nodeId); etisserant@0: etisserant@0: frdupin@71: #endif /* __nmtMaster_h__ */