SegCamBehavior Class Reference#include <SegCamBehavior.h>
Inheritance diagram for SegCamBehavior:
[legend]List of all members.
Detailed Description
Forwards segmented images from camera over wireless.
The format used for serialization is basically defined by the subclass of FilterBankGenerator being used. I suggest looking at that classes's documentation to determine the format used.
However, SegCamBehavior will add a few fields at the beginning of each packet to assist in processing the image stream.
I emphasize: beginning of each Vision packet, before the FilterBankGenerator header.
This is exactly the same protocol that is followed by the RawCamBehavior as well - the same code can parse either stream.
However, odd bit - since the RLEGenerator doesn't save the color information itself, SegCamBehavior will do it instead. So, if SegCamBehavior is using RLE compression, it will tack a footer at the end of the packet: (from SegmentedColorGenerator::encodeColors())
- <
unsigned int: num_cols> (number of different colors available) - for each of num_col:
- <
char: red> red color to use for display of this index - <
char: green> green color to use for display of this index - <
char: blue> blue color to use for display of this index
Definition at line 42 of file SegCamBehavior.h.
|
Public Member Functions |
| SegCamBehavior () |
| constructor
|
virtual void | DoStart () |
| By default, merely adds to the reference counter (through AddReference()); Note you should still call this from your overriding methods.
|
virtual void | DoStop () |
| By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).
|
virtual void | processEvent (const EventBase &e) |
| By defining here, allows you to get away with not supplying a processEvent() function for the EventListener interface. By default, does nothing.
|
virtual std::string | getName () const |
| Identifies the behavior in menus and such.
|
Static Public Member Functions |
std::string | getClassDescription () |
| Gives a short description of what this class of behaviors does... you should override this (but don't have to).
|
Static Public Attributes |
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
|
const unsigned int | UDP_WIRELESS_BUFFER_SIZE = 64*1024 |
| 64KB is the max udp packet size
|
Protected Member Functions |
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)
|
bool | writeRLE (const FilterBankEvent &fbke) |
| writes a color image
|
bool | writeSeg (const FilterBankEvent &fbke) |
| writes a color image
|
void | closePacket () |
| closes and sends a packet, does nothing if no packet open
|
Protected Attributes |
Socket * | visRLE |
| socket to send image stream over
|
char * | packet |
| buffer being filled out to be sent
|
char * | cur |
| current location in packet
|
unsigned int | avail |
| number of bytes remaining in packet
|
unsigned int | max_buf |
| the buffer size requested from Wireless when the socket was allocated
|
Private Member Functions |
| SegCamBehavior (const SegCamBehavior &) |
| don't call
|
SegCamBehavior & | operator= (const SegCamBehavior &) |
| don't call
|
Constructor & Destructor Documentation
SegCamBehavior::SegCamBehavior |
( |
|
) |
|
|
Member Function Documentation
void SegCamBehavior::closePacket |
( |
|
) |
[protected] |
|
void SegCamBehavior::DoStart |
( |
|
) |
[virtual] |
|
void SegCamBehavior::DoStop |
( |
|
) |
[virtual] |
|
|
By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).
Reimplemented from BehaviorBase.
Definition at line 42 of file SegCamBehavior.cc. |
std::string SegCamBehavior::getClassDescription |
( |
|
) |
[inline, static] |
|
|
Gives a short description of what this class of behaviors does... you should override this (but don't have to).
Reimplemented from BehaviorBase.
Definition at line 58 of file SegCamBehavior.h. |
virtual std::string SegCamBehavior::getName |
( |
|
) |
const [inline, virtual] |
|
bool SegCamBehavior::openPacket |
( |
FilterBankGenerator & |
fbkgen, |
|
|
unsigned int |
time, |
|
|
unsigned int |
layer |
|
) |
[protected] |
|
|
opens a new packet, writes header info; returns true if open, false if otherwise open (check cur==NULL for error)
see the class documentation for SegCamBehavior for the protocol documentation
Definition at line 70 of file SegCamBehavior.cc.
Referenced by writeRLE(), and writeSeg(). |
void SegCamBehavior::processEvent |
( |
const EventBase & |
e |
) |
[virtual] |
|
Member Data Documentation
|
85000 bytes for use up to 416x320 pixels / 8 min expected runs * 5 bytes per run + some padding
Definition at line 47 of file SegCamBehavior.h. |
The documentation for this class was generated from the following files:
|