Homepage Demos Overview Downloads Tutorials Reference
Credits

SegCamBehavior.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_SegCamBehavior_h_
00003 #define INCLUDED_SegCamBehavior_h_
00004 
00005 #include "Behaviors/BehaviorBase.h"
00006 
00007 class Socket;
00008 class FilterBankGenerator;
00009 class FilterBankEvent;
00010 
00011 //! Forwards segmented images from camera over wireless
00012 class SegCamBehavior : public BehaviorBase {
00013 public:
00014   //! constructor
00015   SegCamBehavior();
00016 
00017   static const unsigned int WIRELESS_BUFFER_SIZE=85000; //!< 85000 bytes for use up to 416x320 pixels / 8 min expected runs * 5 bytes per run + some padding
00018 
00019   virtual void DoStart();
00020 
00021   virtual void DoStop();
00022 
00023   virtual void processEvent(const EventBase& e);
00024 
00025   virtual std::string getName() const { return "SegCamServer"; }
00026 
00027   static std::string getClassDescription() { return "Forwards segmented images from camera over wireless"; }
00028   
00029 protected:
00030   bool openPacket(FilterBankGenerator& fbkgen, unsigned int time, unsigned int layer); //!< opens a new packet, writes header info; returns true if open, false if otherwise open (check cur==NULL for error)
00031   bool writeRLE(const FilterBankEvent& fbke); //!< writes a color image
00032   bool writeSeg(const FilterBankEvent& fbke); //!< writes a color image
00033   void closePacket(); //!< closes and sends a packet, does nothing if no packet open
00034 
00035   Socket * visRLE; //!< socket to send image stream over
00036   char * packet; //!< buffer being filled out to be sent
00037   char * cur; //!< current location in #packet
00038   unsigned int avail; //!< number of bytes remaining in #packet
00039 
00040 private:
00041   SegCamBehavior(const SegCamBehavior&); //!< don't call
00042   SegCamBehavior& operator=(const SegCamBehavior&); //!< don't call
00043 };
00044 
00045 /*! @file
00046  * @brief Describes SegCamBehavior, which forwards segmented images from camera over wireless
00047  * @author ejt (Creator)
00048  *
00049  * $Author: ejt $
00050  * $Name: tekkotsu-2_0 $
00051  * $Revision: 1.3 $
00052  * $State: Exp $
00053  * $Date: 2004/01/18 10:16:57 $
00054  */
00055 
00056 #endif

Tekkotsu v2.0
Generated Wed Jan 21 03:20:29 2004 by Doxygen 1.3.4