Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
FlashIPAddrBehavior.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_FlashIPAddrBehavior_h_ 00003 #define INCLUDED_FlashIPAddrBehavior_h_ 00004 00005 #include "Behaviors/BehaviorBase.h" 00006 #include "Motion/MotionManager.h" 00007 #include "Motion/MotionSequenceMC.h" 00008 00009 //! Displays IP address by speaking the digits and flashing a series of numbers on the LED face panel 00010 /*! Will only run the display on DoStart() if the flash_on_start 00011 * config variable is set. Otherwise you will need to hold down the 00012 * buttons specified by #button1 and #button2 to trigger the display. 00013 * Note that if the e-stop is active it will intercept the button 00014 * events, so turn off e-stop first. */ 00015 class FlashIPAddrBehavior : public BehaviorBase { 00016 public: 00017 //! constructor 00018 FlashIPAddrBehavior() 00019 : BehaviorBase("FlashIPAddrBehavior"), sounds(), ms(), ms_id(MotionManager::invalid_MC_ID) 00020 {} 00021 00022 virtual void DoStart(); //!< if the Config::behavior_config::flash_on_start flag is set, will setup and run 00023 virtual void DoStop(); //!< halts any display which may be in progress 00024 00025 //! Receives button events, timers, and motman manager pruning notifications 00026 virtual void processEvent(const EventBase& e); 00027 00028 static std::string getClassDescription() { 00029 std::string pre="Displays IP address by flashing a series of numbers on the LED face panel; Hold down "; 00030 pre+=buttonNames[button1]; 00031 pre+=" and "; 00032 pre+=buttonNames[button2]; 00033 pre+=" to trigger any time while running"; 00034 return pre; 00035 } 00036 virtual std::string getDescription() const { return getClassDescription(); } 00037 00038 protected: 00039 typedef XLargeMotionSequenceMC MSMC_t; //!< used to flash the LEDs to report the IP address 00040 00041 void loadSounds(); //!< loads the numeric sounds into memory 00042 void releaseSounds(); //!< releases the numeric sounds 00043 void setupSequence(); //!< construct the motion sequence for flashing leds, request timers to play corresponding sound file 00044 00045 static const unsigned int button1=ChinButOffset; //!< one of two buttons which must be pressed together to trigger the report without using the Controller 00046 static const unsigned int button2=HeadFrButOffset; //!< one of two buttons which must be pressed together to trigger the report without using the Controller 00047 00048 static const unsigned int ACTIVATE_TIMER=-1U; //!< timer id to specify both trigger buttons have been down long enough 00049 std::vector<std::string> sounds; //!< sound to play, corresponding to timers to coincide with corresponding digit on the LEDs (could be done with chained sounds, but this is cooler) 00050 static const unsigned int delay=64; //!< time (in milliseconds) to expect #ms to be delayed before it actually starts 00051 00052 SharedObject<MSMC_t> ms; //!< motion sequence used to control the LEDs 00053 MotionManager::MC_ID ms_id; //!< id number of #ms 00054 }; 00055 00056 /*! @file 00057 * @brief Describes FlashIPAddrBehavior, which displays IP address by flashing a series of numbers on the LED face panel 00058 * @author ejt (Creator) 00059 * 00060 * $Author: ejt $ 00061 * $Name: tekkotsu-2_4_1 $ 00062 * $Revision: 1.4 $ 00063 * $State: Exp $ 00064 * $Date: 2005/08/07 04:11:03 $ 00065 */ 00066 00067 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4 |