Homepage Demos Overview Downloads Tutorials Reference
Credits

EStopControllerBehavior.h

Go 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
00018   //! command stream is talking to. A kludge. Dunno how you're gonna
00019   //! make sure you're not using this uninitialized.
00020   static EStopControllerBehavior * theOne;
00021   static int callback(char *buf, int bytes); //!< called by wireless when there's new data
00022 
00023 public:
00024   //! constructor
00025   EStopControllerBehavior(MotionManager::MC_ID estop)
00026     : BehaviorBase(),
00027       cmdsock(NULL),
00028       estop_id(estop)
00029   {
00030     theOne=this;
00031   }
00032   //! destructor
00033   virtual ~EStopControllerBehavior() {
00034     theOne=NULL;
00035   }
00036 
00037   virtual void DoStart();
00038 
00039   virtual void DoStop();
00040 
00041   virtual void processEvent(const EventBase &);
00042 
00043   virtual std::string getName() const { return "EStop Remote Control"; }
00044   static std::string getClassDescription() {
00045     char tmp[20];
00046     sprintf(tmp,"%d",config->main.estopControl_port);
00047     return std::string("Listens to estop commands coming in from port ")+tmp;
00048   }
00049 
00050   virtual void runCommand(const std::string& s); //!< processes a string received from wireless
00051 
00052 protected:
00053   //! The input command stream socket
00054   Socket *cmdsock;
00055 
00056   //! The estop to control
00057   MotionManager::MC_ID estop_id;
00058 
00059 private:
00060   EStopControllerBehavior(const EStopControllerBehavior&); //!< don't call
00061   EStopControllerBehavior operator=(const EStopControllerBehavior&); //!< don't call
00062 
00063 };
00064 
00065 /*! @file
00066  * @brief Describes EStopControllerBehavior, listens to control commands coming in from the command port for remotely toggling the estop
00067  * @author tss (Creator)
00068  * 
00069  * $Author: ejt $
00070  * $Name: tekkotsu-2_2 $
00071  * $Revision: 1.3 $
00072  * $State: Exp $
00073  * $Date: 2004/01/14 20:44:31 $
00074  */
00075 
00076 #endif 

Tekkotsu v2.2
Generated Tue Oct 19 14:19:14 2004 by Doxygen 1.3.9.1