duvc-ctl 2.0.0
USB Video Class Camera Control Library
Loading...
Searching...
No Matches
duvc::Camera Class Reference

RAII camera handle for simplified device management. More...

#include <duvc-ctl/core/camera.h>

Collaboration diagram for duvc::Camera:

Public Member Functions

 Camera (const Device &device)
 Create camera handle for device.
 
 Camera (int device_index)
 Create camera handle by device index.
 
 Camera (const std::wstring &device_path)
 Create camera handle by device path.
 
 ~Camera ()
 Destructor - automatically releases device connection.
 
 Camera (const Camera &)=delete
 
Cameraoperator= (const Camera &)=delete
 
 Camera (Camera &&) noexcept
 
Cameraoperator= (Camera &&) noexcept
 
bool is_valid () const
 Check if camera is valid and connected.
 
const Devicedevice () const
 Get the underlying device information.
 
Result< PropSettingget (CamProp prop)
 Get camera property value.
 
Result< voidset (CamProp prop, const PropSetting &setting)
 Set camera property value.
 
Result< PropRangeget_range (CamProp prop)
 Get camera property range.
 
Result< PropSettingget (VidProp prop)
 Get video processing property value.
 
Result< voidset (VidProp prop, const PropSetting &setting)
 Set video processing property value.
 
Result< PropRangeget_range (VidProp prop)
 Get video processing property range.
 

Detailed Description

RAII camera handle for simplified device management.

This class provides a high-level interface for camera control, automatically managing device connections and providing a clean API.

Definition at line 23 of file camera.h.

Constructor & Destructor Documentation

◆ Camera() [1/5]

duvc::Camera::Camera ( const Device & device)
explicit

Create camera handle for device.

Parameters
deviceDevice to connect to

Definition at line 12 of file camera.cpp.

◆ Camera() [2/5]

duvc::Camera::Camera ( int device_index)
explicit

Create camera handle by device index.

Parameters
device_indexIndex from list_devices()

Definition at line 14 of file camera.cpp.

References duvc::list_devices().

Here is the call graph for this function:

◆ Camera() [3/5]

duvc::Camera::Camera ( const std::wstring & device_path)
explicit

Create camera handle by device path.

Parameters
device_pathWindows device instance path (case-insensitive)

Opens a camera using its unique Windows device path. This is the most precise method for multi-camera setups where firmware variations cause duplicate names or VID/PID combinations.

Exceptions
std::runtime_errorif device not found or invalid
See also
find_device_by_path()

Definition at line 22 of file camera.cpp.

References duvc::find_device_by_path(), and duvc::Device::is_valid().

Here is the call graph for this function:

◆ ~Camera()

duvc::Camera::~Camera ( )
default

Destructor - automatically releases device connection.

◆ Camera() [4/5]

duvc::Camera::Camera ( const Camera & )
delete

◆ Camera() [5/5]

duvc::Camera::Camera ( Camera && )
defaultnoexcept

Member Function Documentation

◆ device()

const Device & duvc::Camera::device ( ) const
inline

Get the underlying device information.

Returns
Device structure

Definition at line 71 of file camera.h.

◆ get() [1/2]

Result< PropSetting > duvc::Camera::get ( CamProp prop)

Get camera property value.

Parameters
propCamera property to query
Returns
Result containing property setting or error

Definition at line 48 of file camera.cpp.

References duvc::DeviceNotFound, duvc::Ok(), and duvc::PropertyNotSupported.

Referenced by duvc_get_multiple_camera_properties(), duvc_get_multiple_video_properties(), duvc_set_multiple_camera_properties(), and duvc_set_multiple_video_properties().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [2/2]

Result< PropSetting > duvc::Camera::get ( VidProp prop)

Get video processing property value.

Parameters
propVideo property to query
Returns
Result containing property setting or error

Definition at line 89 of file camera.cpp.

References duvc::DeviceNotFound, duvc::Ok(), and duvc::PropertyNotSupported.

Here is the call graph for this function:

◆ get_range() [1/2]

Result< PropRange > duvc::Camera::get_range ( CamProp prop)

Get camera property range.

Parameters
propCamera property to query
Returns
Result containing property range or error

Definition at line 75 of file camera.cpp.

References duvc::DeviceNotFound, duvc::Ok(), and duvc::PropertyNotSupported.

Here is the call graph for this function:

◆ get_range() [2/2]

Result< PropRange > duvc::Camera::get_range ( VidProp prop)

Get video processing property range.

Parameters
propVideo property to query
Returns
Result containing property range or error

Definition at line 116 of file camera.cpp.

References duvc::DeviceNotFound, duvc::Ok(), and duvc::PropertyNotSupported.

Here is the call graph for this function:

◆ is_valid()

bool duvc::Camera::is_valid ( ) const

Check if camera is valid and connected.

Returns
true if camera can be used

Definition at line 37 of file camera.cpp.

References duvc::is_device_connected(), and is_valid().

Referenced by is_valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

Camera & duvc::Camera::operator= ( Camera && )
defaultnoexcept

◆ operator=() [2/2]

Camera & duvc::Camera::operator= ( const Camera & )
delete

◆ set() [1/2]

Result< void > duvc::Camera::set ( CamProp prop,
const PropSetting & setting )

Set camera property value.

Parameters
propCamera property to set
settingNew property setting
Returns
Result indicating success or error

Definition at line 62 of file camera.cpp.

References duvc::DeviceNotFound, duvc::Ok(), and duvc::PropertyNotSupported.

Referenced by duvc_set_multiple_camera_properties(), and duvc_set_multiple_video_properties().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [2/2]

Result< void > duvc::Camera::set ( VidProp prop,
const PropSetting & setting )

Set video processing property value.

Parameters
propVideo property to set
settingNew property setting
Returns
Result indicating success or error

Definition at line 103 of file camera.cpp.

References duvc::DeviceNotFound, duvc::Ok(), and duvc::PropertyNotSupported.

Here is the call graph for this function:

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