Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

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(wireless->socket(SocketNS::SOCK_STREAM, 256, 256)),
00028       estop_id(estop)
00029   {
00030     theOne=this;
00031   }
00032   //! destructor
00033   virtual ~EStopControllerBehavior() { }
00034 
00035   virtual void DoStart();
00036 
00037   virtual void DoStop();
00038 
00039   virtual void processEvent(const EventBase &);
00040 
00041   virtual std::string getName() const { return "EStop Remote Control"; }
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 
00048   virtual void runCommand(std::string s);
00049 
00050 protected:
00051   //! The input command stream socket
00052   Socket *cmdsock;
00053 
00054   //! The estop to control
00055   MotionManager::MC_ID estop_id;
00056 
00057 private:
00058   EStopControllerBehavior(const EStopControllerBehavior&); //!< don't call
00059   EStopControllerBehavior operator=(const EStopControllerBehavior&); //!< don't call
00060 
00061 };
00062 
00063 /*! @file
00064  * @brief Describes EStopControllerBehavior, listens to control commands coming in from the command port for remotely toggling the estop
00065  * @author tss (Creator)
00066  * 
00067  * $Author: ejt $
00068  * $Name: tekkotsu-1_4_1 $
00069  * $Revision: 1.1 $
00070  * $State: Exp $
00071  * $Date: 2003/07/07 07:08:27 $
00072  */
00073 
00074 #endif 

Tekkotsu v1.4
Generated Sat Jul 19 00:06:30 2003 by Doxygen 1.3.2