Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
EStopControllerBehavior.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_EStopControllerBehavior_h_ 00003 #define INCLUDED_EStopControllerBehavior_h_ 00004 00005 #include <iostream> 00006 #include "Wireless/Wireless.h" 00007 #include "Behaviors/BehaviorBase.h" 00008 #include "Motion/MotionManager.h" 00009 #include "Events/EventRouter.h" 00010 #include "Events/EventBase.h" 00011 #include "Shared/Config.h" 00012 00013 //! Listens to control commands coming in from the command port for remotely controlling the head 00014 class EStopControllerBehavior : public BehaviorBase { 00015 00016 public: 00017 //! Points to the one EStopControllerBehavior object that the input command stream is talking to. 00018 /*! A kludge. Dunno how you're gonna make sure you're not using this uninitialized. */ 00019 static EStopControllerBehavior * theOne; 00020 static int callback(char *buf, int bytes); //!< called by wireless when there's new data 00021 00022 public: 00023 //! constructor 00024 EStopControllerBehavior(MotionManager::MC_ID estop) 00025 : BehaviorBase("EStopControllerBehavior"), 00026 cmdsock(NULL), 00027 estop_id(estop) 00028 { 00029 theOne=this; 00030 } 00031 //! destructor 00032 virtual ~EStopControllerBehavior() { 00033 theOne=NULL; 00034 } 00035 00036 virtual void DoStart(); 00037 00038 virtual void DoStop(); 00039 00040 virtual void processEvent(const EventBase &); 00041 00042 static std::string getClassDescription() { 00043 char tmp[20]; 00044 sprintf(tmp,"%d",config->main.estopControl_port); 00045 return std::string("Listens to estop commands coming in from port ")+tmp; 00046 } 00047 virtual std::string getDescription() const { return getClassDescription(); } 00048 00049 virtual void runCommand(const std::string& s); //!< processes a string received from wireless 00050 00051 protected: 00052 //! The input command stream socket 00053 Socket *cmdsock; 00054 00055 //! The estop to control 00056 MotionManager::MC_ID estop_id; 00057 00058 private: 00059 EStopControllerBehavior(const EStopControllerBehavior&); //!< don't call 00060 EStopControllerBehavior operator=(const EStopControllerBehavior&); //!< don't call 00061 00062 }; 00063 00064 /*! @file 00065 * @brief Describes EStopControllerBehavior, listens to control commands coming in from the command port for remotely toggling the estop 00066 * @author tss (Creator) 00067 * 00068 * $Author: ejt $ 00069 * $Name: tekkotsu-2_4_1 $ 00070 * $Revision: 1.5 $ 00071 * $State: Exp $ 00072 * $Date: 2004/12/10 23:18:10 $ 00073 */ 00074 00075 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:46 2005 by Doxygen 1.4.4 |