Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

EStopController.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_EStopController_h_
00003 #define INCLUDED_EStopController_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 #include "Shared/ProjectInterface.h"
00013 
00014 //! Listens to control commands coming in from the command port for remotely controlling the head
00015 class EStopController : public BehaviorBase {
00016 
00017 public: 
00018   //! Points to the one EStopController object that the input command stream is talking to.
00019   /*! A kludge. Dunno how you're gonna make sure you're not using this uninitialized. */
00020   static EStopController * theOne;
00021   static int callback(char *buf, int bytes); //!< called by wireless when there's new data
00022 
00023 public:
00024   //! constructor
00025   EStopController()
00026     : BehaviorBase("EStopController"),
00027       cmdsock(NULL)
00028   {
00029     theOne=this;
00030   }
00031   //! destructor
00032   virtual ~EStopController() {
00033     theOne=NULL;
00034   }
00035 
00036   virtual void doStart();
00037 
00038   virtual void doStop();
00039 
00040   virtual void doEvent();
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 private:
00056   EStopController(const EStopController&); //!< don't call
00057   EStopController operator=(const EStopController&); //!< don't call
00058 
00059 };
00060 
00061 /*! @file
00062  * @brief Describes EStopController, listens to control commands coming in from the command port for remotely toggling the estop
00063  * @author tss (Creator)
00064  */
00065 
00066 #endif 

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:38 2016 by Doxygen 1.6.3