libcvd
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CVD::V4LControl Class Reference

exposes the V4L2 API to set parameters on a capture device. More...

#include <v4lcontrol.h>

Collaboration diagram for CVD::V4LControl:
Collaboration graph
[legend]

Public Member Functions

 V4LControl (int fd, bool report=true)
 
 V4LControl (const std::string &name, bool report=true)
 
int getFile (void) const
 return file descriptor for the opened device
 
const std::string & getDevice (void) const
 return file name of the opened device
 
void setReportErrors (bool report)
 set error reporting
 
bool getReportErrors (void) const
 
HighLevel

High level interface to set specific parameters without much hassle.

These might fail if the parameter is not supported by the device and do not throw exceptions. Moreover ranges of parameter values are abstracted to lie within the intervall [0,1]. If you want to have more control, use the lower level interface described in Generic .

void exposure (int)
 
int exposure (void)
 
void autoexposure (bool)
 
bool autoexposure ()
 
void gain (double)
 
double gain (void)
 
void autogain (bool)
 
bool autogain (void)
 
void brightness (double)
 
double brightness (void)
 
void contrast (double)
 
double contrast (void)
 
void saturation (double)
 
double saturation (void)
 
Generic

generic high level interface abstracting the v4l2 structs

unsigned int getId (const std::string &name) const
 
std::string getName (unsigned int id) const
 
std::vector< unsigned int > supportedParameters (void) const
 
std::vector< std::string > supportedParameterNames (void) const
 
bool isSupported (const std::string &name) const
 
void set (const std::string &name, int value)
 
int get (const std::string &name)
 
int type (const std::string &name)
 
std::map< unsigned int, std::string > menuValues (const std::string &name)
 
int defaultValue (const std::string &name)
 
int min (const std::string &name)
 
int max (const std::string &name)
 
int step (const std::string &name)
 
bool isSupported (unsigned int id) const
 
void set (unsigned int id, int value)
 
int get (unsigned int id)
 
int type (unsigned int id)
 
std::map< unsigned int, std::string > menuValues (unsigned int id) const
 
int defaultValue (unsigned int id) const
 
int min (unsigned int id) const
 
int max (unsigned int id) const
 
int step (unsigned int id) const
 
LowLevel

low level interface using v4l2 structs

int getQueryStruct (v4l2_queryctrl &query) const
 
void getMenuStruct (unsigned int id, std::vector< v4l2_querymenu > &menu) const
 
int setControlStruct (v4l2_control &value)
 
int getControlStruct (v4l2_control &value) const
 

Protected Member Functions

void queryControls (void)
 

Protected Attributes

int device
 
std::string deviceName
 
struct v4l2_control control
 
bool reportErrors
 
std::map< std::string, unsigned int > controlNames
 
std::map< unsigned int, v4l2_queryctrl > controlData
 
std::map< unsigned int, std::vector< v4l2_querymenu > > menuData
 

Detailed Description

exposes the V4L2 API to set parameters on a capture device.

It can be used in parallel to a v4lbuffer object to control and query all parameters supported. Several abstraction levels are supported. On the highest there are individual member functions for various fixed parameters. The next level supports querying and setting/getting values for all parameters supported by the driver. Finally, low-level access using V4L2 structs is supported as well.


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