IDS peak genericC++  v1.7.0
peak::core::Interface Class Reference

Represents a GenTL Interface module. More...

#include <peak/interface/peak_interface.hpp>

Inheritance diagram for peak::core::Interface:
peak::core::EventSupportingModule peak::core::Module

Public Types

using DeviceFoundCallback = std::function< void(const std::shared_ptr< DeviceDescriptor > &foundDevice)>
 
using DeviceFoundCallbackHandle = DeviceFoundCallback *
 
using DeviceDisconnectedCallback = std::function< void(const std::shared_ptr< DeviceDescriptor > &disconnectedDevice)>
 
using DeviceDisconnectedCallbackHandle = DeviceDisconnectedCallback *
 
using DeviceReconnectedCallback = std::function< void(const std::shared_ptr< DeviceDescriptor > &reconnectedDevice, DeviceReconnectInformation reconnectInformation)>
 
using DeviceReconnectedCallbackHandle = DeviceReconnectedCallback *
 
using DeviceLostCallback = std::function< void(const std::string &lostDeviceId)>
 
using DeviceLostCallbackHandle = DeviceLostCallback *
 
using DeviceListChangedCallback = std::function< void()>
 
using DeviceListChangedCallbackHandle = DeviceListChangedCallback *
 

Public Member Functions

 Interface ()=delete
 
 ~Interface () override
 
 Interface (const Interface &other)=delete
 
Interface & operator= (const Interface &other)=delete
 
 Interface (Interface &&other)=delete
 
Interface & operator= (Interface &&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 ID () const
 Returns the ID. More...
 
std::string DisplayName () const
 Returns the display name. More...
 
std::string TLType () const
 Returns the TL (transport layer) type. More...
 
void UpdateDevices (Timeout timeout_ms)
 Searches for devices. More...
 
std::vector< std::shared_ptr< DeviceDescriptor > > Devices () const
 Returns the device list. More...
 
std::shared_ptr< System > ParentSystem () const
 Returns the parent system. More...
 
DeviceFoundCallbackHandle RegisterDeviceFoundCallback (const DeviceFoundCallback &callback)
 Registers a callback for signaling a found device. More...
 
void UnregisterDeviceFoundCallback (DeviceFoundCallbackHandle callbackHandle)
 Unregisters a device found callback. More...
 
DeviceLostCallbackHandle RegisterDeviceLostCallback (const DeviceLostCallback &callback)
 Registers a callback for signaling a lost device. More...
 
void UnregisterDeviceLostCallback (DeviceLostCallbackHandle callbackHandle)
 Unregisters a device lost callback. More...
 
DeviceReconnectedCallbackHandle RegisterDeviceReconnectedCallback (const DeviceReconnectedCallback &callback)
 Registers a callback for signaling a reconnected device. More...
 
void UnregisterDeviceReconnectedCallback (DeviceReconnectedCallbackHandle callbackHandle)
 Unregisters a device reconnected callback. More...
 
DeviceDisconnectedCallbackHandle RegisterDeviceDisconnectedCallback (const DeviceDisconnectedCallback &callback)
 Registers a callback for signaling a disconnected device. More...
 
void UnregisterDeviceDisconnectedCallback (DeviceDisconnectedCallbackHandle callbackHandle)
 Unregisters a device disconnected callback. More...
 
DeviceListChangedCallbackHandle RegisterDeviceListChangedCallback (const DeviceListChangedCallback &callback)
 Registers a callback for signaling a device list changed. More...
 
void UnregisterDeviceListChangedCallback (DeviceListChangedCallbackHandle callbackHandle)
 Unregisters a device list changed callback. More...
 
- Public Member Functions inherited from peak::core::EventSupportingModule
 EventSupportingModule ()=default
 
 ~EventSupportingModule () override=default
 
 EventSupportingModule (const EventSupportingModule &other)=delete
 
EventSupportingModule & operator= (const EventSupportingModule &other)=delete
 
 EventSupportingModule (EventSupportingModule &&other)=delete
 
EventSupportingModule & operator= (EventSupportingModule &&other)=delete
 
std::unique_ptr< EventController > EnableEvents (EventType type)
 Enables events of the given event type. More...
 
- Public Member Functions inherited from peak::core::Module
 Module ()=default
 
virtual ~Module ()=default
 
 Module (const Module &other)=delete
 
Module & operator= (const Module &other)=delete
 
 Module (Module &&other)=delete
 
Module & operator= (Module &&other)=delete
 
std::vector< std::shared_ptr< NodeMap > > NodeMaps () const
 Returns the module's node maps. More...
 
std::shared_ptr< class Port > Port () const
 Returns the module's port. More...
 

Additional Inherited Members

Detailed Description

Represents a GenTL Interface module.

This class allows to query information about a GenTL Interface module and to enumerate its DeviceDescriptors, which allow you to open the corresponding Device.

Member Typedef Documentation

◆ DeviceDisconnectedCallback

using peak::core::Interface::DeviceDisconnectedCallback = std::function<void(const std::shared_ptr<DeviceDescriptor>& disconnectedDevice)>

The type of device disconnected callbacks.

◆ DeviceDisconnectedCallbackHandle

The type of device disconnect callback handles.

◆ DeviceFoundCallback

using peak::core::Interface::DeviceFoundCallback = std::function<void(const std::shared_ptr<DeviceDescriptor>& foundDevice)>

The type of device found callbacks.

◆ DeviceFoundCallbackHandle

The type of device found callback handles.

◆ DeviceListChangedCallback

using peak::core::Interface::DeviceListChangedCallback = std::function<void()>

The type of device list changed callbacks.

◆ DeviceListChangedCallbackHandle

The type of device list changed callback handles.

◆ DeviceLostCallback

using peak::core::Interface::DeviceLostCallback = std::function<void(const std::string& lostDeviceId)>

The type of device lost callbacks.

◆ DeviceLostCallbackHandle

The type of device lost callback handles.

◆ DeviceReconnectedCallback

using peak::core::Interface::DeviceReconnectedCallback = std::function<void( const std::shared_ptr<DeviceDescriptor>& reconnectedDevice, DeviceReconnectInformation reconnectInformation)>

The type of device reconnected callbacks.

◆ DeviceReconnectedCallbackHandle

The type of device reconnected callback handles.

Constructor & Destructor Documentation

◆ Interface() [1/3]

peak::core::Interface::Interface ( )
delete

◆ ~Interface()

peak::core::Interface::~Interface ( )
inlineoverride

◆ Interface() [2/3]

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

◆ Interface() [3/3]

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

Member Function Documentation

◆ Devices()

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

Returns the device list.

Returns
Device list
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ DisplayName()

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

Returns the display name.

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

◆ ID()

std::string peak::core::Interface::ID ( ) const
inline

Returns the ID.

Returns
ID
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Info()

RawInformation peak::core::Interface::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.

◆ Key()

std::string peak::core::Interface::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.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ ParentSystem()

std::shared_ptr< System > peak::core::Interface::ParentSystem ( ) const
inline

Returns the parent system.

Returns
Parent system
Since
1.0
Exceptions
NotFoundExceptionInterface could not be found.
InternalErrorExceptionAn internal error has occurred.

◆ RegisterDeviceDisconnectedCallback()

Interface::DeviceDisconnectedCallbackHandle peak::core::Interface::RegisterDeviceDisconnectedCallback ( const DeviceDisconnectedCallback &  callback)
inline

Registers a callback for signaling a disconnected device.

This function registers a callback which gets called every time a device has beeen disconnected. Pass the callback handle returned by this function to UnregisterDeviceDisconnectedCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call if a device has been disconnected.
Returns
Callback handle
Since
1.7
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ RegisterDeviceFoundCallback()

Interface::DeviceFoundCallbackHandle peak::core::Interface::RegisterDeviceFoundCallback ( const DeviceFoundCallback &  callback)
inline

Registers a callback for signaling a found device.

This function registers a callback which gets called every time a new device is found. Pass the callback handle returned by this function to UnregisterDeviceFoundCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call if a new device is found.
Returns
Callback handle
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ RegisterDeviceListChangedCallback()

Interface::DeviceListChangedCallbackHandle peak::core::Interface::RegisterDeviceListChangedCallback ( const DeviceListChangedCallback &  callback)
inline

Registers a callback for signaling a device list changed.

This function registers a callback which gets called every time something changes within the device list. Pass the callback handle returned by this function to UnregisterDeviceDisconnectedCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call if a device has been disconnected.
Returns
Callback handle
Since
1.7
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ RegisterDeviceLostCallback()

Interface::DeviceLostCallbackHandle peak::core::Interface::RegisterDeviceLostCallback ( const DeviceLostCallback &  callback)
inline

Registers a callback for signaling a lost device.

This function registers a callback which gets called every time a device is lost. Pass the callback handle returned by this function to UnregisterDeviceLostCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call if a device is lost.
Returns
Callback handle
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ RegisterDeviceReconnectedCallback()

Interface::DeviceReconnectedCallbackHandle peak::core::Interface::RegisterDeviceReconnectedCallback ( const DeviceReconnectedCallback &  callback)
inline

Registers a callback for signaling a reconnected device.

This function registers a callback which gets called every time a device has beeen reconnected. Pass the callback handle returned by this function to UnregisterDeviceReconnectedCallback() to unregister the callback.

Parameters
[in]callbackThe callback to call if a device has been reconnected.
Returns
Callback handle
Since
1.7
Exceptions
NotAvailableExceptionThe reconnect callback is not available in the parent system
InternalErrorExceptionAn internal error has occurred.

◆ TLType()

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

Returns the TL (transport layer) type.

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

◆ UnregisterDeviceDisconnectedCallback()

void peak::core::Interface::UnregisterDeviceDisconnectedCallback ( DeviceDisconnectedCallbackHandle  callbackHandle)
inline

Unregisters a device disconnected callback.

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

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

◆ UnregisterDeviceFoundCallback()

void peak::core::Interface::UnregisterDeviceFoundCallback ( Interface::DeviceFoundCallbackHandle  callbackHandle)
inline

Unregisters a device found callback.

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

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

◆ UnregisterDeviceListChangedCallback()

void peak::core::Interface::UnregisterDeviceListChangedCallback ( Interface::DeviceListChangedCallbackHandle  callbackHandle)
inline

Unregisters a device list changed callback.

This function unregisters a device list changed callback by taking its handle.

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

◆ UnregisterDeviceLostCallback()

void peak::core::Interface::UnregisterDeviceLostCallback ( Interface::DeviceLostCallbackHandle  callbackHandle)
inline

Unregisters a device lost callback.

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

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

◆ UnregisterDeviceReconnectedCallback()

void peak::core::Interface::UnregisterDeviceReconnectedCallback ( DeviceReconnectedCallbackHandle  callbackHandle)
inline

Unregisters a device reconnected callback.

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

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

◆ UpdateDevices()

void peak::core::Interface::UpdateDevices ( Timeout  timeout_ms)
inline

Searches for devices.

This function triggers an update of the internal device list. The callbacks registered on the interface will be triggered if an device is found or lost.

Parameters
[in]timeout_msThe time to wait for new devices in milliseconds. In any case the GenTL Producer must make sure that this operation is completed in a reasonable amount of time depending on the underlying technology.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

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