IDS peak genericC++  v1.5.0
peak::core::DeviceDescriptor Class Reference

Encapsulates the GenTL functions associated with a GenTL Device module's ID. More...

#include <peak/device/peak_device_descriptor.hpp>

Inheritance diagram for peak::core::DeviceDescriptor:
peak::core::ModuleDescriptor

Public Types

using InformationChangedCallback = std::function< void(const std::vector< DeviceInformationRole > &changedRoles)>
 
using InformationChangedCallbackHandle = InformationChangedCallback *
 
using DeviceOpenedCallback = std::function< void(const std::shared_ptr< core::Device > &openedDevice)>
 
using DeviceOpenedCallbackHandle = DeviceOpenedCallback *
 

Public Member Functions

 DeviceDescriptor ()=delete
 
 ~DeviceDescriptor () override
 
 DeviceDescriptor (const DeviceDescriptor &other)=delete
 
DeviceDescriptor & operator= (const DeviceDescriptor &other)=delete
 
 DeviceDescriptor (DeviceDescriptor &&other)=delete
 
DeviceDescriptor & operator= (DeviceDescriptor &&other)=delete
 
std::string Key () const
 Returns the unique key. More...
 
RawInformation Info (int32_t infoCommand) const
 Delivers information based on the given GenTL info command. More...
 
std::string DisplayName () const
 Returns the display name. More...
 
std::string VendorName () const
 Returns the vendor name. More...
 
std::string ModelName () const
 Returns the model name. More...
 
std::string Version () const
 Returns the version. More...
 
std::string TLType () const
 Returns the TL (transport layer) type. More...
 
std::string UserDefinedName () const
 Returns the user defined name. More...
 
std::string SerialNumber () const
 Returns the serial number. More...
 
DeviceAccessStatus AccessStatus () const
 Returns the access status. More...
 
uint64_t TimestampTickFrequency () const
 Returns the timestamp tick frequency. More...
 
std::shared_ptr< Interface > ParentInterface () const
 Returns the parent interface. More...
 
Open the device

bool IsOpenable (DeviceAccessType accessType=DeviceAccessType::Exclusive) const
 Checks whether the device can be opened with a specific access type. More...
 
std::shared_ptr< Device > OpenDevice (DeviceAccessType accessType)
 Opens the Device. More...
 
std::shared_ptr< Device > OpenedDevice () const
 Returns the Device that was opened with this DeviceDescriptor. More...
 
DeviceOpenedCallbackHandle RegisterDeviceOpenedCallback (const DeviceOpenedCallback &callback)
 Registers a callback for signaling when the Device is opened with this DeviceDescriptor. More...
 
void UnregisterDeviceOpenedCallback (DeviceOpenedCallbackHandle callbackHandle)
 Unregisters a device opened callback. More...
 
Device Information Monitoring

uint64_t MonitoringUpdateInterval () const
 Returns the monitoring update interval. More...
 
void SetMonitoringUpdateInterval (uint64_t monitoringUpdateInterval_ms)
 Sets the monitoring update interval. More...
 
bool IsInformationRoleMonitored (DeviceInformationRole informationRole) const
 Checks whether the given information role is monitored. More...
 
void AddInformationRoleToMonitoring (DeviceInformationRole informationRole)
 Adds the given information role to the monitoring. More...
 
void RemoveInformationRoleFromMonitoring (DeviceInformationRole informationRole)
 Removes the given information role from the monitoring. More...
 
InformationChangedCallbackHandle RegisterInformationChangedCallback (const InformationChangedCallback &callback)
 Registers a callback for signaling changed information. More...
 
void UnregisterInformationChangedCallback (InformationChangedCallbackHandle callbackHandle)
 Unregisters an information changed callback. More...
 
- Public Member Functions inherited from peak::core::ModuleDescriptor
 ModuleDescriptor ()=default
 
virtual ~ModuleDescriptor ()=default
 
 ModuleDescriptor (const ModuleDescriptor &other)=delete
 
ModuleDescriptor & operator= (const ModuleDescriptor &other)=delete
 
 ModuleDescriptor (ModuleDescriptor &&other)=delete
 
ModuleDescriptor & operator= (ModuleDescriptor &&other)=delete
 
std::string ID () const
 Returns the ID of the described module. More...
 

Friends

class FirmwareUpdater
 

Additional Inherited Members

Detailed Description

Encapsulates the GenTL functions associated with a GenTL Device module's ID.

This class allows to query information about a GenTL Device module without opening it. Furthermore, it enables you to open this GenTL Device module.

Opening a Device

When you try to open a device with an access mode that is not allowed, a BadAccessException is thrown. To avoid that, ask the device if the desired access mode is available with IsOpenable(). By default, IsOpenable asks for the highest access mode, DeviceAccessType::Exclusive:

if (deviceDescriptor->IsOpenable())
{
device = deviceDescriptor->OpenDevice(DeviceAccessType::Control);
}

Device Information Monitoring

With this group of methods, you can conveniently monitor for changes of information about the device.

Register a callback using RegisterInformationChangedCallback() and configure which information you want to monitor with AddInformationRoleToMonitoring() and RemoveInformationRoleFromMonitoring().

By default, the following DeviceInformationRoles are monitored:

  • AccessStatus
  • UserDefinedName
  • TimestampTickFrequency

Member Typedef Documentation

◆ DeviceOpenedCallback

using peak::core::DeviceDescriptor::DeviceOpenedCallback = std::function<void(const std::shared_ptr<core::Device>& openedDevice)>

The type of device opened callbacks.

◆ DeviceOpenedCallbackHandle

The type of device opened callback handles.

◆ InformationChangedCallback

using peak::core::DeviceDescriptor::InformationChangedCallback = std::function<void(const std::vector<DeviceInformationRole>& changedRoles)>

The type of changed callbacks.

◆ InformationChangedCallbackHandle

Constructor & Destructor Documentation

◆ DeviceDescriptor() [1/3]

peak::core::DeviceDescriptor::DeviceDescriptor ( )
delete

◆ ~DeviceDescriptor()

peak::core::DeviceDescriptor::~DeviceDescriptor ( )
inlineoverride

◆ DeviceDescriptor() [2/3]

peak::core::DeviceDescriptor::DeviceDescriptor ( const DeviceDescriptor &  other)
delete

◆ DeviceDescriptor() [3/3]

peak::core::DeviceDescriptor::DeviceDescriptor ( DeviceDescriptor &&  other)
delete

Member Function Documentation

◆ AccessStatus()

DeviceAccessStatus peak::core::DeviceDescriptor::AccessStatus ( ) const
inline

Returns the access status.

Returns
Access status
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ AddInformationRoleToMonitoring()

void peak::core::DeviceDescriptor::AddInformationRoleToMonitoring ( DeviceInformationRole  informationRole)
inline

Adds the given information role to the monitoring.

Parameters
[in]informationRoleThe information role to add to the monitoring.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ DisplayName()

std::string peak::core::DeviceDescriptor::DisplayName ( ) const
inline

Returns the display name.

Returns
Display name
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ Info()

RawInformation peak::core::DeviceDescriptor::Info ( int32_t  infoCommand) const
inline

Delivers information based on the given GenTL info command.

Parameters
[in]infoCommandThe GenTL info command.

This function can be used to query information going beyond the predefined info functions, based on the GenTL info commands of the corresponding module.

Example (error handling is omitted):

auto info = object->Info(GenTL::XX_INFO_XX);
// Cast depending on the delivered data type
if (info.dataType == GenTL::INFO_DATATYPE_UINT64)
{
uint64_t uint64Var = *reinterpret_cast<const uint64_t*>(info.data.data());
// Do something with the information
}
else if (infoDataTypeVar == GenTL::INFO_DATATYPE_INT64)
{
...
}
...
Returns
Raw information according to the passed info command
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ IsInformationRoleMonitored()

bool peak::core::DeviceDescriptor::IsInformationRoleMonitored ( DeviceInformationRole  informationRole) const
inline

Checks whether the given information role is monitored.

Parameters
[in]informationRoleThe information role to check.
Returns
True, if the given information role is monitored.
False otherwise.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ IsOpenable()

bool peak::core::DeviceDescriptor::IsOpenable ( DeviceAccessType  accessType = DeviceAccessType::Exclusive) const
inline

Checks whether the device can be opened with a specific access type.

If the device can be opened with a higher access type, it can also be opened with a lower access type.

if (deviceDescriptor->IsOpenable())
{
device = deviceDescriptor->OpenDevice(DeviceAccessType::Control);
}
Parameters
[in]accessTypeThe access type to check.
Returns
True, if the device can be opened with the given access type.
False otherwise.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Key()

std::string peak::core::DeviceDescriptor::Key ( ) const
inline

Returns the unique key.

The returned key is unique even across different producer libraries.

Returns
Unique key
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ ModelName()

std::string peak::core::DeviceDescriptor::ModelName ( ) const
inline

Returns the model name.

Returns
Model name
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ MonitoringUpdateInterval()

uint64_t peak::core::DeviceDescriptor::MonitoringUpdateInterval ( ) const
inline

Returns the monitoring update interval.

Returns
Monitoring update interval in milliseconds
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ OpenDevice()

std::shared_ptr< Device > peak::core::DeviceDescriptor::OpenDevice ( DeviceAccessType  accessType)
inline

Opens the Device.

Parameters
[in]accessTypeThe access type the device should be opened for.
Returns
Opened Device
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
BadAccessExceptionAccess denied
InternalErrorExceptionAn internal error has occurred.

◆ OpenedDevice()

std::shared_ptr< Device > peak::core::DeviceDescriptor::OpenedDevice ( ) const
inline

Returns the Device that was opened with this DeviceDescriptor.

Returns
Opened Device
Since
1.0
Exceptions
BadAccessExceptionDevice is not open

◆ operator=() [1/2]

DeviceDescriptor& peak::core::DeviceDescriptor::operator= ( const DeviceDescriptor &  other)
delete

◆ operator=() [2/2]

DeviceDescriptor& peak::core::DeviceDescriptor::operator= ( DeviceDescriptor &&  other)
delete

◆ ParentInterface()

std::shared_ptr< Interface > peak::core::DeviceDescriptor::ParentInterface ( ) const
inline

Returns the parent interface.

Returns
Parent interface
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ RegisterDeviceOpenedCallback()

DeviceDescriptor::DeviceOpenedCallbackHandle peak::core::DeviceDescriptor::RegisterDeviceOpenedCallback ( const DeviceOpenedCallback &  callback)
inline

Registers a callback for signaling when the Device is opened with this DeviceDescriptor.

Pass the callback handle returned by this function to UnregisterDeviceOpenedCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call when the Device is opened.
Returns
Callback handle
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ RegisterInformationChangedCallback()

DeviceDescriptor::InformationChangedCallbackHandle peak::core::DeviceDescriptor::RegisterInformationChangedCallback ( const InformationChangedCallback &  callback)
inline

Registers a callback for signaling changed information.

This function registers a callback which gets called every time information have changed. Pass the callback handle returned by this function to UnregisterInformationChangedCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call if information have changed.
Returns
Callback handle
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ RemoveInformationRoleFromMonitoring()

void peak::core::DeviceDescriptor::RemoveInformationRoleFromMonitoring ( DeviceInformationRole  informationRole)
inline

Removes the given information role from the monitoring.

Parameters
[in]informationRoleThe information role to remove from the monitoring.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ SerialNumber()

std::string peak::core::DeviceDescriptor::SerialNumber ( ) const
inline

Returns the serial number.

Returns
Serial number
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ SetMonitoringUpdateInterval()

void peak::core::DeviceDescriptor::SetMonitoringUpdateInterval ( uint64_t  monitoringUpdateInterval_ms)
inline

Sets the monitoring update interval.

Parameters
[in]monitoringUpdateInterval_msThe monitoring update interval to set in milliseconds.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ TimestampTickFrequency()

uint64_t peak::core::DeviceDescriptor::TimestampTickFrequency ( ) const
inline

Returns the timestamp tick frequency.

Returns
Timestamp tick frequency in Hz
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ TLType()

std::string peak::core::DeviceDescriptor::TLType ( ) const
inline

Returns the TL (transport layer) type.

Returns
TL type
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ UnregisterDeviceOpenedCallback()

void peak::core::DeviceDescriptor::UnregisterDeviceOpenedCallback ( DeviceOpenedCallbackHandle  callbackHandle)
inline

Unregisters a device opened callback.

This function unregisters a device opened callback by taking its handle.

Parameters
[in]callbackHandleThe handle of the callback to unregister.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ UnregisterInformationChangedCallback()

void peak::core::DeviceDescriptor::UnregisterInformationChangedCallback ( InformationChangedCallbackHandle  callbackHandle)
inline

Unregisters an information changed callback.

This function unregisters an information changed callback by taking its handle.

Parameters
[in]callbackHandleThe handle of the callback to unregister.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ UserDefinedName()

std::string peak::core::DeviceDescriptor::UserDefinedName ( ) const
inline

Returns the user defined name.

Returns
User defined name
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ VendorName()

std::string peak::core::DeviceDescriptor::VendorName ( ) const
inline

Returns the vendor name.

Returns
Vendor name
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ Version()

std::string peak::core::DeviceDescriptor::Version ( ) const
inline

Returns the version.

Returns
Version
Since
1.0
Exceptions
NotFoundExceptionDevice could not be found.
InternalErrorExceptionAn internal error has occurred.

Friends And Related Function Documentation

◆ FirmwareUpdater

friend class FirmwareUpdater
friend

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