Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraDriverV4L2 Class Reference

description of CameraDriverV4L2 More...

#include <CameraDriverV4L2.h>

Inheritance diagram for CameraDriverV4L2:

Detailed Description

description of CameraDriverV4L2

Definition at line 20 of file CameraDriverV4L2.h.

List of all members.

Classes

struct  MemoryMapping

Public Member Functions

 CameraDriverV4L2 (const std::string &name)
 ~CameraDriverV4L2 ()
virtual std::string getClassName () const
 Returns the name of the class (aka its type).
virtual void getImageSources (std::map< std::string, DataSource * > &sources)
virtual unsigned int nextTimestamp ()
 Returns the simulator time of the next data segment.
virtual const std::string & nextName ()
 Returns a descriptive name of the next data segment for user feedback (e.g. a filename for logged data).
virtual bool advance ()
 Called when the simulator is stepping while paused or advancing a frozen data source, return true if successful, or false if no more data is available.
virtual void registerSource ()
 User hook, called when the data source should claim which outputs it provides feedback (providingOuput()).
virtual void deregisterSource ()
 User hook, called when the data source should release its claim on outputs with feedback (ignoringOuput()).
virtual void plistValueChanged (const plist::PrimitiveBase &pl)
 watches path, triggers a close() and re-open() if it changes
virtual void plistCollectionEntryAdded (plist::Collection &col, plist::ObjectBase &obj)
 watches userOptions to sync when settings are added or removed
virtual void plistCollectionEntryRemoved (plist::Collection &col, plist::ObjectBase &obj)
 watches userOptions to sync when settings are added or removed
virtual void plistCollectionEntriesChanged (plist::Collection &col)
 watches userOptions to sync when settings are added or removed

Public Attributes

plist::Primitive< std::string > path
plist::Primitive< std::string > resolution
plist::Primitive< boolqueryOptions
plist::DictionaryOf
< plist::Primitive< int > > 
userOptions
std::map< std::string, struct
v4l2_queryctrl > 
options

Protected Member Functions

void close_cam ()
void open_cam ()
bool setControl (const std::string &name, int value, bool verbose=false)
int video_enable ()
int video_disable ()
int select_format ()
int add_control (struct v4l2_queryctrl &queryctrl, bool verbose)
int query_options (bool verbose)
int dequeue_buffer ()
std::string v4l2_fourcc_inv (__u32 f)
void doFreeze ()
 user hook for when frozen is set to true; advance() will be called by simulator at user discretion.
void doUnfreeze ()
 user hook for when frozen is set to false; if enteringRealtime() has been called then you should resume sending data.
void downsample_yuyv ()
void upsample_yuyv ()
void threadrun ()

Protected Attributes

CallbackThread thread
int camfd
struct v4l2_capability v_cap
struct v4l2_format v_fmt
struct v4l2_buffer v_buf
std::vector< MemoryMappingv_mem
bool streaming
bool downsample
unsigned int frameCount
unsigned int timestamp
std::vector< unsigned char > captureBuf
 the buffer to capture the frame into (unconverted)
Thread::Lock lock

Static Private Attributes

static const std::string autoRegisterCameraDriverV4L2
 holds the class name, set via registration with the DeviceDriver registry

Constructor & Destructor Documentation

CameraDriverV4L2 ( const std::string &  name  )  [explicit]

Definition at line 23 of file CameraDriverV4L2.h.

~CameraDriverV4L2 (  ) 

Definition at line 40 of file CameraDriverV4L2.h.


Member Function Documentation

int add_control ( struct v4l2_queryctrl &  queryctrl,
bool  verbose 
) [protected]
virtual bool advance (  )  [virtual]

Called when the simulator is stepping while paused or advancing a frozen data source, return true if successful, or false if no more data is available.

Implements DataSource.

void close_cam (  )  [protected]
int dequeue_buffer (  )  [protected]
virtual void deregisterSource (  )  [virtual]

User hook, called when the data source should release its claim on outputs with feedback (ignoringOuput()).

It would be wise to call this from your destructor as well.

Reimplemented from DataSource.

Referenced by ~CameraDriverV4L2().

void doFreeze (  )  [protected, virtual]

user hook for when frozen is set to true; advance() will be called by simulator at user discretion.

Reimplemented from DataSource.

void doUnfreeze (  )  [protected, virtual]

user hook for when frozen is set to false; if enteringRealtime() has been called then you should resume sending data.

Reimplemented from DataSource.

void downsample_yuyv (  )  [protected]
virtual std::string getClassName (  )  const [virtual]

Returns the name of the class (aka its type).

Suggested implementation is to declare a static string member, set it to the result of calling the registry's registerType, and then return that member here

Implements DeviceDriver.

Definition at line 42 of file CameraDriverV4L2.h.

virtual void getImageSources ( std::map< std::string, DataSource * > &  sources  )  [virtual]

Reimplemented from DeviceDriver.

Definition at line 44 of file CameraDriverV4L2.h.

virtual const std::string& nextName (  )  [virtual]

Returns a descriptive name of the next data segment for user feedback (e.g. a filename for logged data).

Just use your class name if you don't have a useful name for individual samples.

Implements DataSource.

Definition at line 49 of file CameraDriverV4L2.h.

virtual unsigned int nextTimestamp (  )  [virtual]

Returns the simulator time of the next data segment.

Should be in the future if nothing new since last data segment, otherwise should be the timestamp of the most recent data segment (older segments are skipped), return -1U if there is no more data

Implements DataSource.

Definition at line 48 of file CameraDriverV4L2.h.

void open_cam (  )  [protected]
virtual void plistCollectionEntriesChanged ( plist::Collection col  )  [virtual]

watches userOptions to sync when settings are added or removed

Reimplemented from CollectionListener.

virtual void plistCollectionEntryAdded ( plist::Collection col,
plist::ObjectBase obj 
) [virtual]

watches userOptions to sync when settings are added or removed

Reimplemented from CollectionListener.

virtual void plistCollectionEntryRemoved ( plist::Collection col,
plist::ObjectBase obj 
) [virtual]

watches userOptions to sync when settings are added or removed

Reimplemented from CollectionListener.

virtual void plistValueChanged ( const plist::PrimitiveBase pl  )  [virtual]

watches path, triggers a close() and re-open() if it changes

Implements PrimitiveListener.

int query_options ( bool  verbose  )  [protected]
virtual void registerSource (  )  [virtual]

User hook, called when the data source should claim which outputs it provides feedback (providingOuput()).

Does not indicate the data source should start sending updates yet — wait for enteringRealtime() or advance() to be called

Reimplemented from DataSource.

int select_format (  )  [protected]
bool setControl ( const std::string &  name,
int  value,
bool  verbose = false 
) [protected]
void threadrun (  )  [protected]
void upsample_yuyv (  )  [protected]
std::string v4l2_fourcc_inv ( __u32  f  )  [protected]
int video_disable (  )  [protected]
int video_enable (  )  [protected]

Member Data Documentation

const std::string autoRegisterCameraDriverV4L2 [static, private]

holds the class name, set via registration with the DeviceDriver registry

Definition at line 118 of file CameraDriverV4L2.h.

Referenced by getClassName().

int camfd [protected]

Definition at line 93 of file CameraDriverV4L2.h.

std::vector<unsigned char> captureBuf [protected]

the buffer to capture the frame into (unconverted)

Definition at line 113 of file CameraDriverV4L2.h.

bool downsample [protected]

Definition at line 108 of file CameraDriverV4L2.h.

unsigned int frameCount [protected]

Definition at line 110 of file CameraDriverV4L2.h.

Thread::Lock lock [protected]

Definition at line 114 of file CameraDriverV4L2.h.

std::map<std::string, struct v4l2_queryctrl> options

Definition at line 69 of file CameraDriverV4L2.h.

plist::Primitive<std::string> path

Definition at line 65 of file CameraDriverV4L2.h.

Referenced by CameraDriverV4L2().

Definition at line 67 of file CameraDriverV4L2.h.

Referenced by CameraDriverV4L2().

Definition at line 66 of file CameraDriverV4L2.h.

Referenced by CameraDriverV4L2().

bool streaming [protected]

Definition at line 107 of file CameraDriverV4L2.h.

CallbackThread thread [protected]

Definition at line 91 of file CameraDriverV4L2.h.

unsigned int timestamp [protected]

Definition at line 111 of file CameraDriverV4L2.h.

Definition at line 68 of file CameraDriverV4L2.h.

Referenced by CameraDriverV4L2().

struct v4l2_buffer v_buf [protected]

Definition at line 97 of file CameraDriverV4L2.h.

struct v4l2_capability v_cap [protected]

Definition at line 95 of file CameraDriverV4L2.h.

struct v4l2_format v_fmt [protected]

Definition at line 96 of file CameraDriverV4L2.h.

std::vector<MemoryMapping> v_mem [protected]

Definition at line 105 of file CameraDriverV4L2.h.


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

Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:40 2016 by Doxygen 1.6.3