Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraStreamBehavior Class Reference

Base class for camera streaming communication classes, handles upstream communication. More...

#include <CameraStreamBehavior.h>

Inheritance diagram for CameraStreamBehavior:

Detailed Description

Base class for camera streaming communication classes, handles upstream communication.

This class isn't meant to be run directly -- it just provides common functionality for its subclasses.

Definition at line 11 of file CameraStreamBehavior.h.

List of all members.

Public Member Functions

virtual void doEvent ()
 Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.
virtual std::string getDescription () const
 Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).
int receiveData (char *data, unsigned int len)
 called when new data is available (currently, only to toggle sensor sending)
void sendSensors ()
 causes current sensor values to be sent through curSocket (along with video data)

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Protected Member Functions

 CameraStreamBehavior (const std::string &name, Socket *&s)
 constructor, protected because you're not intended to instantiate this directly

Protected Attributes

Socket *& curSocket
 the socket over which to send updates
unsigned int sensorListeners
 number of times startSensors has been sent, minus number of times stopSensors has been sent
unsigned int lastProcessedTime
 timestamp of last sensor update sent

Private Member Functions

 CameraStreamBehavior (const CameraStreamBehavior &)
 don't call (copy constructor)
CameraStreamBehavioroperator= (const CameraStreamBehavior &)
 don't call (assignment operator)

Constructor & Destructor Documentation

CameraStreamBehavior::CameraStreamBehavior ( const std::string &  name,
Socket *&  s 
) [protected]

constructor, protected because you're not intended to instantiate this directly

Parameters:
name the name of the instance and the class
s the subclass's socket, a reference is stored so CameraStreamBehavior will always have access to the current socket

Definition at line 27 of file CameraStreamBehavior.h.

CameraStreamBehavior::CameraStreamBehavior ( const CameraStreamBehavior  )  [private]

don't call (copy constructor)


Member Function Documentation

void CameraStreamBehavior::doEvent (  )  [virtual]

Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.

Default implementation watches for 'private' text message events (those forwarded by a BehaviorSwitchControl from ControllerGUI input) and will publically rebroadcast them. The idea is that your own processEvent gets first dibs, but if the behavior doesn't handle the text message, it will be handed off for others.

Reimplemented from BehaviorBase.

Reimplemented in DepthCam, RawCam, and SegCam.

Definition at line 12 of file CameraStreamBehavior.cc.

static std::string CameraStreamBehavior::getClassDescription (  )  [static]

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Reimplemented in DepthCam, RawCam, and SegCam.

Definition at line 16 of file CameraStreamBehavior.h.

Referenced by getDescription().

virtual std::string CameraStreamBehavior::getDescription (  )  const [virtual]

Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~getClassDescription(), because static functions can't be virtual in C++ (doh!)

This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so.

Reimplemented from BehaviorBase.

Reimplemented in DepthCam, RawCam, and SegCam.

Definition at line 17 of file CameraStreamBehavior.h.

CameraStreamBehavior& CameraStreamBehavior::operator= ( const CameraStreamBehavior  )  [private]

don't call (assignment operator)

int CameraStreamBehavior::receiveData ( char *  data,
unsigned int  len 
)

called when new data is available (currently, only to toggle sensor sending)

Definition at line 17 of file CameraStreamBehavior.cc.

Referenced by SegCam::networkCallback(), RawCam::networkCallback(), and DepthCam::networkCallback().

void CameraStreamBehavior::sendSensors (  ) 

causes current sensor values to be sent through curSocket (along with video data)

Definition at line 55 of file CameraStreamBehavior.cc.

Referenced by doEvent(), and receiveData().


Member Data Documentation

the socket over which to send updates

Definition at line 32 of file CameraStreamBehavior.h.

Referenced by sendSensors().

unsigned int CameraStreamBehavior::lastProcessedTime [protected]

timestamp of last sensor update sent

Reimplemented in DepthCam, RawCam, and SegCam.

Definition at line 38 of file CameraStreamBehavior.h.

Referenced by sendSensors().

unsigned int CameraStreamBehavior::sensorListeners [protected]

number of times startSensors has been sent, minus number of times stopSensors has been sent

Definition at line 35 of file CameraStreamBehavior.h.

Referenced by receiveData().


The documentation for this class was generated from the following files:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:05 2016 by Doxygen 1.6.3