Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
RegionCamBehavior.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_RegionCamBehavior_h_ 00003 #define INCLUDED_RegionCamBehavior_h_ 00004 00005 #include "Behaviors/BehaviorBase.h" 00006 #include "Shared/Config.h" 00007 00008 class Socket; 00009 class FilterBankGenerator; 00010 class FilterBankEvent; 00011 00012 //! Forwards segmented images from camera over wireless 00013 00014 class RegionCamBehavior : public BehaviorBase { 00015 public: 00016 //! constructor 00017 RegionCamBehavior(); 00018 00019 static const unsigned int TCP_WIRELESS_BUFFER_SIZE=85000; //!< 85000 bytes for use up to 416x320 pixels / 8 min expected runs * 5 bytes per run + some padding 00020 static const unsigned int UDP_WIRELESS_BUFFER_SIZE=64*1024; //!< 64KB is the max udp packet size 00021 00022 virtual void DoStart(); 00023 00024 virtual void DoStop(); 00025 00026 virtual void processEvent(const EventBase& e); 00027 00028 static std::string getClassDescription() { 00029 char tmp[20]; 00030 sprintf(tmp,"%d",config->vision.rle_port); 00031 return std::string("Forwards regions calculated out of images from camera over port ")+tmp; 00032 } 00033 virtual std::string getDescription() const { return getClassDescription(); } 00034 00035 protected: 00036 //! opens a new packet, writes header info; returns true if open, false if otherwise open (check cur==NULL for error) 00037 /*! see the class documentation for RegionCamBehavior for the protocol documentation */ 00038 bool openPacket(FilterBankGenerator& fbkgen, unsigned int time, unsigned int layer); 00039 bool writeRegions(const FilterBankEvent& fbke); //!< writes the region information 00040 void closePacket(); //!< closes and sends a packet, does nothing if no packet open 00041 00042 Socket * visRegion; //!< socket to send image stream over 00043 char * packet; //!< buffer being filled out to be sent 00044 char * cur; //!< current location in #packet 00045 unsigned int avail; //!< number of bytes remaining in #packet 00046 unsigned int max_buf; //!< the buffer size requested from Wireless when the socket was allocated 00047 00048 private: 00049 RegionCamBehavior(const RegionCamBehavior&); //!< don't call 00050 RegionCamBehavior& operator=(const RegionCamBehavior&); //!< don't call 00051 }; 00052 00053 /*! @file 00054 * @brief Implements RegionCamBehavior, which forwards the regions from RegionGenerator over wireless 00055 * @author harm & niels (Creators) 00056 * 00057 * $Author: ejt $ 00058 * $Name: tekkotsu-2_4_1 $ 00059 * $Revision: 1.1 $ 00060 * $State: Exp $ 00061 * $Date: 2005/08/05 19:44:22 $ 00062 */ 00063 00064 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:48 2005 by Doxygen 1.4.4 |