00001 // $Id: ethercat_router.h,v 1.14 2006/02/20 15:57:33 kgad Exp $ 00002 //=========================================================================== 00003 // This file is part of "EtherCAT Master Library". 00004 // Copyright (C) 2005 FMTC vzw, Diamant Building, A. Reyerslaan 80, 00005 // B-1030 Brussels, Belgium. 00006 // 00007 // EtherCAT Master Library is free software; you can redistribute it 00008 // and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 or 00010 // (at your option) any later version. 00011 // 00012 // EtherCAT Master Code is distributed in the hope that it will be 00013 // useful, but WITHOUT ANY WARRANTY; without even the implied 00014 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00015 // PURPOSE. See the GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with the EtherCAT Master Library; if not, write to the Free 00019 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00020 // 02111-1307 USA. 00021 // 00022 // EtherCAT, the EtherCAT trade name and logo are the intellectual 00023 // property of, and protected by Beckhoff. You can use "EtherCAT 00024 // Master Library" for creating and/or selling or otherwise 00025 // distributing an EtherCAT network master under the terms of the 00026 // EtherCAT Master License. 00027 // 00028 // You should have received a copy of the EtherCAT Master License 00029 // along with the EtherCAT Master Library; if not, write to Beckhoff 00030 // Automation GmbH, Eiserstrasse 5, D-33415 Verl, Germany. 00031 //=========================================================================== 00032 00033 00034 #ifndef __ethercat_router__ 00035 #define __ethercat_router__ 00036 00037 // forward declaration 00038 class EtherCAT_AL; 00039 class EC_Logic; 00040 class EtherCAT_DataLinkLayer; 00041 class EtherCAT_SlaveHandler; 00042 class EtherCAT_MbxMsg; 00043 00045 00046 class EtherCAT_Router 00047 { 00048 public: 00049 EtherCAT_Router(EtherCAT_AL *_m_al_instance, 00050 EC_Logic *_m_logic_instance, 00051 EtherCAT_DataLinkLayer *_m_dll_instance); 00053 void start(); 00055 void stop(); 00057 bool is_running() const 00058 { 00059 return m_is_running; 00060 } 00061 00063 00076 void route(void) const; 00077 00079 EtherCAT_AL * m_al_instance; 00080 private: 00082 EC_Logic * m_logic_instance; 00084 EtherCAT_DataLinkLayer * m_dll_instance; 00086 bool m_is_running; 00087 00089 00095 bool check_mbx(const EtherCAT_SlaveHandler * sh) const; 00096 00098 00103 bool post_mbxmsg(EtherCAT_MbxMsg * msg, const EtherCAT_SlaveHandler * from_sh) const; 00104 00105 }; 00106 00107 #endif