Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraStreamBehavior.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_CameraStreamBehavior_h_
00003 #define INCLUDED_CameraStreamBehavior_h_
00004 
00005 #include "Behaviors/BehaviorBase.h"
00006 
00007 class Socket;
00008 
00009 //! Base class for camera streaming communication classes, handles upstream communication
00010 /*! This class isn't meant to be run directly -- it just provides common functionality for its subclasses. */
00011 class CameraStreamBehavior : public BehaviorBase {
00012 public:
00013 
00014   virtual void doEvent();
00015 
00016   static std::string getClassDescription() { return "Base class for camera streaming communication classes, handles upstream communication"; }
00017   virtual std::string getDescription() const { return getClassDescription(); }
00018   
00019   int receiveData(char* data, unsigned int len); //!< called when new data is available (currently, only to toggle sensor sending)
00020   
00021   void sendSensors(); //!< causes current sensor values to be sent through #curSocket (along with video data)
00022 
00023 protected:
00024   //! constructor, protected because you're not intended to instantiate this directly
00025   /*! @param name the name of the instance and the class
00026    *  @param s the subclass's socket, a reference is stored so CameraStreamBehavior will always have access to the current socket */
00027   CameraStreamBehavior(const std::string& name, Socket*& s)
00028     : BehaviorBase(name), curSocket(s), sensorListeners(0), lastProcessedTime(0)
00029   {}
00030 
00031   //! the socket over which to send updates
00032   Socket*& curSocket;
00033 
00034   //! number of times startSensors has been sent, minus number of times stopSensors has been sent
00035   unsigned int sensorListeners;
00036 
00037   //! timestamp of last sensor update sent
00038   unsigned int lastProcessedTime;
00039 
00040 private:
00041   // Providing declarations for these functions will avoid a compiler warning if
00042   // you have any class members which are pointers.  However, as it is, an error
00043   // will result if you inadvertantly cause a call to either (which is probably
00044   // a good thing, unless you really intended to copy/assign a behavior, in
00045   // which case simply provide implementations for the functions)
00046   CameraStreamBehavior(const CameraStreamBehavior&); //!< don't call (copy constructor)
00047   CameraStreamBehavior& operator=(const CameraStreamBehavior&); //!< don't call (assignment operator)
00048 };
00049 
00050 /*! @file
00051  * @brief Defines CameraStreamBehavior, which is the base class for camera streaming communication classes, handles upstream communication
00052  * @author ejt (Creator)
00053  */
00054 
00055 #endif

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