libcamera: libcamera::Control< T > Class Template Reference

libcamera v0.7.0 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::Control< T > Class Template Reference

Describe a control and its intrinsic properties. More...

Inheritance diagram for libcamera::Control< T >:
[legend]
Collaboration diagram for libcamera::Control< T >:
[legend]

## Public Types
using | type = T
| The Control template type T.
Public Types inherited from libcamera::ControlId
enum class | Direction { In = (1 << 0) , Out = (1 << 1) }
| The direction the control is capable of being passed from/to. More...
using | DirectionFlags = Flags<Direction>
| A wrapper for ControlId::Direction so that it can be used as flags.

## Public Member Functions
| Control (unsigned int id, const char *name, const char *vendor, ControlId::DirectionFlags direction, const std::map< std::string, int32_t > &enumStrMap={})
| Construct a Control instance.
Public Member Functions inherited from libcamera::ControlId
| ControlId (unsigned int id, const std::string &name, const std::string &vendor, ControlType type, DirectionFlags direction, std::size_t size=0, const std::map< std::string, int32_t > &enumStrMap={})
| Construct a ControlId instance.
unsigned int | id () const
| Retrieve the control numerical ID.
const std::string & | name () const
| Retrieve the control name.
const std::string & | vendor () const
| Retrieve the vendor name.
ControlType | type () const
| Retrieve the control data type.
DirectionFlags | direction () const
| Return the direction that the control can be used in.
bool | isInput () const
| Determine if the control is available to be used as an input control.
bool | isOutput () const
| Determine if the control is available to be used in output metadata.
bool | isArray () const
| Determine if the control is an array control.
std::size_t | size () const
| Retrieve the size of the control if it is an array control.
const std::map< int32_t, std::string > & | enumerators () const
| Retrieve the map of enum values to enum names.

## Detailed Description

template<typename T>
class libcamera::Control< T >

Describe a control and its intrinsic properties.

The Control class models a control exposed by an object. Its template type name T refers to the control data type, and allows functions that operate on control values to be defined as template functions using the same type T for the control value. See for instance how the ControlList::get() function returns a value corresponding to the type of the requested control.

While this class is the main means to refer to a control, the control identifying information is stored in the non-template base ControlId class. This allows code that operates on a set of controls of different types to reference those controls through a ControlId instead of a Control. For instance, the list of controls supported by a camera is exposed as ControlId instead of Control.

Controls of any type can be defined through template specialisation, but libcamera only supports the bool, uint8_t, int32_t, int64_t and float types natively (this includes types that are equivalent to the supported types, such as int and long int).

Controls IDs shall be unique. While nothing prevents multiple instances of the Control class to be created with the same ID for the same object, doing so may cause undefined behaviour.

## Constructor & Destructor Documentation

## ◆ Control()

template<typename T>

libcamera::Control< T >::Control | ( | unsigned int | id,
|  | const char * | name,
|  | const char * | vendor,
|  | ControlId::DirectionFlags | direction,
|  | const std::map< std::string, int32_t > & | enumStrMap = {} )
| inline

Construct a Control instance.

Parameters

  [in] | id | The control numerical ID
  [in] | name | The control name
  [in] | vendor | The vendor name
  [in] | direction | The direction of the control, if it can be used in Controls or Metadata
  [in] | enumStrMap | The map from enum names to values (optional)

The control data type is automatically deduced from the template type T.

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

- include/libcamera/controls.h
- src/libcamera/controls.cpp