Imaging Control 4 C++ Library 1.0.0
Loading...
Searching...
No Matches
DeviceInfo Class Reference

Contains information about a video capture device. More...

Public Member Functions

 DeviceInfo ()=default
 Creates an invalid object.
 
bool is_valid () const noexcept
 Checks whether this device information is a valid object.
 
bool operator== (const DeviceInfo &other) const
 Checks whether two device information objects refer to the same video capture device.
 
bool operator!= (const DeviceInfo &other) const
 Checks whether two device information objects refer to different devices.
 
std::string modelName (Error &err=Error::Default()) const
 Gets the model name for this device.
 
std::string uniqueName (Error &err=Error::Default()) const
 Gets the unique name for this device.
 
std::string serial (Error &err=Error::Default()) const
 Gets the serial of this device.
 
std::string version (Error &err=Error::Default()) const
 Gets the version of this device.
 
std::string userID (Error &err=Error::Default()) const
 Gets the user-defined identifier of this device.
 
Interface getInterface (Error &err=Error::Default()) const
 Returns the interface this device is attached to.
 

Detailed Description

Contains information about a video capture device.

The information provided includes the device's model name, serial number and firmware version.

Instances of this class are created by calling DeviceEnum::enumDevices(), Interface::enumDevices(), or Grabber::deviceInfo().

Objects returned from Grabber::deviceInfo() are potentially invalid, for example if no device was opened. Check the err output parameter or DeviceInfo::is_valid(). Default-constructed DeviceInfo objects are also invalid.

DeviceInfo objects are copyable and comparable using operator== and operator!=.

Member Function Documentation

◆ getInterface()

Interface getInterface ( Error err = Error::Default()) const
inline

Returns the interface this device is attached to.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
An Interface object representing the interface this device is attached to.

◆ is_valid()

bool is_valid ( ) const
inlinenoexcept

Checks whether this device information is a valid object.

If ic4::Grabber::deviceInfo() could not create a valid device information object, and the passed err was not set to ic4::Error::Throw(), an invalid object is created. All member function calls will fail.

Returns
true, if this device information object was constructed successfully, otherwise false.
In case of an error, check the error parameter of the source function for details.
See also
Error Handling

◆ modelName()

std::string modelName ( Error err = Error::Default()) const
inline

Gets the model name for this device.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The device's model name, or an empty string if an error occurred.

◆ operator!=()

bool operator!= ( const DeviceInfo other) const
inline

Checks whether two device information objects refer to different devices.

Parameters
[in]otherA second device information object.
Returns
true if the two device information objects refer to different devices, otherwise false.

◆ operator==()

bool operator== ( const DeviceInfo other) const
inline

Checks whether two device information objects refer to the same video capture device.

Parameters
[in]otherA second device information object.
Returns
true if the two device information objects refer to the same device, otherwise false.

◆ serial()

std::string serial ( Error err = Error::Default()) const
inline

Gets the serial of this device.

The serial is a string uniquely identifying the device. Usually this is a number that is also printed on the device's housing.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The device's serial, or an empty string if an error occurred.

◆ uniqueName()

std::string uniqueName ( Error err = Error::Default()) const
inline

Gets the unique name for this device.

The unique name consists of an identifier for the device driver and the device's serial number, allowing devices to be uniquely identified by a single string.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The device's unique name, or an empty string if an error occurred.

◆ userID()

std::string userID ( Error err = Error::Default()) const
inline

Gets the user-defined identifier of this device.

If supported by the device, the device's user-defined identifier can be configured through the DeviceUserID feature in the device's property map.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The device's user-defined name, or an empty string if an error occurred.

◆ version()

std::string version ( Error err = Error::Default()) const
inline

Gets the version of this device.

The format of the version string is device-specific.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The device's version, or an empty string if an error occurred.