IDS peak genericC++  v1.5.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 DeviceLostCallback = std::function< void(const std::string &lostDeviceId)>
 
using DeviceLostCallbackHandle = DeviceLostCallback *
 

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...
 
- 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

◆ 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.

◆ 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.

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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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: