![]() |
IDS peak genericC++
v1.7.0
|
The global DeviceManager (singleton) searches all installed producer libraries (*.cti) and enumerates the modules contained in them. More...
#include <peak/peak_device_manager.hpp>
Public Member Functions | |
| void | AddProducerLibrary (const std::string &ctiPath) |
| Adds the given producer library (CTI). More... | |
| void | AddProducerLibrary (const std::shared_ptr< core::ProducerLibrary > &library) |
| Adds the given producer library (CTI). More... | |
| void | Update (UpdatePolicy updatePolicy=UpdatePolicy::ScanEnvironmentForProducerLibraries, const UpdateErrorCallback &errorCallback=UpdateErrorCallback()) |
| Starts an update. More... | |
| void | Reset (ResetPolicy resetPolicy=ResetPolicy::ErrorOnOpenDevices) |
| Resets the DeviceManager. More... | |
| core::Timeout | InterfaceUpdateTimeout () const |
| Returns the interface update timeout. More... | |
| void | SetInterfaceUpdateTimeout (core::Timeout timeout_ms) |
| Sets the interface update timeout. More... | |
| core::Timeout | DeviceUpdateTimeout () const |
| Returns the device update timeout. More... | |
| void | SetDeviceUpdateTimeout (core::Timeout timeout_ms) |
| Sets the device update timeout. More... | |
| std::vector< std::shared_ptr< const core::System > > | Systems () const |
| Returns the found and opened systems. More... | |
| std::vector< std::shared_ptr< const core::Interface > > | Interfaces () const |
| Returns the found and opened interfaces. More... | |
| std::vector< std::shared_ptr< core::DeviceDescriptor > > | Devices () const |
| Returns the found devices. More... | |
| SystemFoundCallbackHandle | RegisterSystemFoundCallback (const SystemFoundCallback &callback) |
| Registers a callback for signaling a found system. More... | |
| void | UnregisterSystemFoundCallback (SystemFoundCallbackHandle callbackHandle) |
| Unregisters a system found callback. More... | |
| InterfaceFoundCallbackHandle | RegisterInterfaceFoundCallback (const InterfaceFoundCallback &callback) |
| Registers a callback for signaling a found interface. More... | |
| void | UnregisterInterfaceFoundCallback (InterfaceFoundCallbackHandle callbackHandle) |
| Unregisters a interface found callback. More... | |
| InterfaceLostCallbackHandle | RegisterInterfaceLostCallback (const InterfaceLostCallback &callback) |
| Registers a callback for signaling a lost interface. More... | |
| void | UnregisterInterfaceLostCallback (InterfaceLostCallbackHandle callbackHandle) |
| Unregisters an interface lost callback. 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... | |
| DeviceDisconnectedCallbackHandle | RegisterDeviceDisconnectedCallback (const DeviceDisconnectedCallback &callback) |
| Registers a callback for signaling a disconnected device. More... | |
| void | UnregisterDeviceDisconnectedCallback (DeviceDisconnectedCallbackHandle callbackHandle) |
| Unregisters a device disconnected 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... | |
| DeviceListChangedCallbackHandle | RegisterDeviceListChangedCallback (const DeviceListChangedCallback &callback) |
| Registers a callback for signaling a change in the device list. More... | |
| void | UnregisterDeviceListChangedCallback (DeviceListChangedCallbackHandle callbackHandle) |
| Unregisters a device list change callback. More... | |
| DeviceManager (const DeviceManager &other)=delete | |
| DeviceManager & | operator= (const DeviceManager &other)=delete |
Static Public Member Functions | |
| static DeviceManager & | Instance () |
| Returns the global DeviceManager. More... | |
Friends | |
| class | Library |
The global DeviceManager (singleton) searches all installed producer libraries (*.cti) and enumerates the modules contained in them.
Retrieve the global DeviceManager with DeviceManager::Instance().
When Update() is called, it searches for all producer libraries contained in the directories found in the official GenICam GenTL environment variable GENICAM_GENTL{32/64}_PATH. It then openes all found ProducerLibraries, their Systems, their Interfaces, and lists all available DeviceDescriptors.
The DeviceManager is a singleton. Therefore, after it was used, it stays active until program termination. That means the opened ProducerLibraries, Systems, and Interfaces stay open. To close them before and start from scratch during runtime, call Reset().
| using peak::DeviceManager::DeviceDisconnectedCallback = std::function<void(const std::shared_ptr<core::DeviceDescriptor>& disconnectedDevice)> |
The type of device disconnect callbacks.
The type of device disconnect callback handles.
| using peak::DeviceManager::DeviceFoundCallback = std::function<void(const std::shared_ptr<core::DeviceDescriptor>& foundDevice)> |
The type of device found callbacks.
The type of device found callback handles.
| using peak::DeviceManager::DeviceListChangedCallback = std::function<void()> |
The type of device list changed callbacks.
The type of device list changed callback handles.
| using peak::DeviceManager::DeviceLostCallback = std::function<void(const std::string& lostDeviceKey)> |
The type of device lost callbacks.
The type of device lost callback handles.
| using peak::DeviceManager::DeviceReconnectedCallback = std::function<void(const std::shared_ptr<core::DeviceDescriptor>& reconnectedDevice, core::DeviceReconnectInformation reconnectInformation)> |
The type of device reconnect callbacks.
The type of device reconnect callback handles.
| using peak::DeviceManager::InterfaceFoundCallback = std::function<void(const std::shared_ptr<const core::Interface>& foundInterface)> |
The type of interface found callbacks.
The type of interface found callback handles.
| using peak::DeviceManager::InterfaceLostCallback = std::function<void(const std::string& lostInterfaceKey)> |
The type of interface lost callbacks.
The type of interface lost callback handles.
| using peak::DeviceManager::SystemFoundCallback = std::function<void(const std::shared_ptr<const core::System>& foundSystem)> |
The type of system found callbacks.
The type of system found callback handles.
| using peak::DeviceManager::UpdateErrorCallback = std::function<void(const std::string& errorDescription)> |
The type of update error callbacks.
|
strong |
|
strong |
Enum holding the possible update policies.
|
delete |
|
inline |
Adds the given producer library (CTI).
This function can be used to add producer libraries manually. This is useful when the desired producer library is not registered at the GenTL environment variable.
| [in] | ctiPath | The path to the producer library (CTI) to add |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Adds the given producer library (CTI).
This function can be used to add already opened producer libraries manually. This is useful when the desired producer library is not registered at the GenTL environment variable. If the producer library is already present, this call does nothing.
| [in] | library | The library instance |
| core::BadAccessException | Access denied |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Returns the found devices.
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Returns the device update timeout.
| core::InternalErrorException | An internal error has occurred. |
|
inlinestatic |
Returns the global DeviceManager.
|
inline |
Returns the found and opened interfaces.
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Returns the interface update timeout.
| core::InternalErrorException | An internal error has occurred. |
|
delete |
|
inline |
Registers a callback for signaling a disconnected device.
This function registers a callback which gets called every time a device is disconnected. Pass the callback handle returned by this function to UnregisterDeviceDisconnectCallback() to unregister the callback.
| [in] | callback | The callback to call if a device is disconnected. |
| core::InternalErrorException | An internal error has occurred. |
|
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.
| [in] | callback | The callback to call if a new device is found. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Registers a callback for signaling a change in the device list.
This function registers a callback which gets called every time the device list changes. Pass the callback handle returned by this function to UnregisterDeviceListChangedCallback() to unregister the callback.
| [in] | callback | The callback to call if the device list has changed. |
| core::InternalErrorException | An internal error has occurred. |
|
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.
| [in] | callback | The callback to call if a device is lost. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Registers a callback for signaling a reconnected device.
This function registers a callback which gets called every time a device is reconnected. Pass the callback handle returned by this function to UnregisterDeviceReconnectedCallback() to unregister the callback.
| [in] | callback | The callback to call if a device is reconnected. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Registers a callback for signaling a found interface.
This function registers a callback which gets called every time a new interface is found. Pass the callback handle returned by this function to UnregisterInterfaceFoundCallback() to unregister the callback.
| [in] | callback | The callback to call if a new interface is found. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Registers a callback for signaling a lost interface.
This function registers a callback which gets called every time an interface is lost. Pass the callback handle returned by this function to UnregisterInterfaceLostCallback() to unregister the callback.
| [in] | callback | The callback to call if an interface is lost. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Registers a callback for signaling a found system.
This function registers a callback which gets called every time a new system is found. Pass the callback handle returned by this function to UnregisterSystemFoundCallback() to unregister the callback.
| [in] | callback | The callback to call if a new system is found. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Resets the DeviceManager.
All Interfaces and Systems are closed, additional ProducerLibraries (added via AddProducerLibrary()) are cleared. Any registered callbacks stay active and the DeviceLostCallback and InterfaceLostCallback are called for all devices / interfaces.
| [in] | resetPolicy | With the default ResetPolicy::ErrorOnOpenDevices, an exception is thrown if there are any open devices managed by the DeviceManager. With ResetPolicy::IgnoreOpenDevices, no such exception is thrown. |
| core::InternalErrorException | If there are open devices (with ResetPolicy::ErrorOnOpenDevices). |
|
inline |
Sets the device update timeout.
| [in] | timeout_ms | The time to wait for new devices in milliseconds. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Sets the interface update timeout.
| [in] | timeout_ms | The time to wait for new interfaces in milliseconds. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Returns the found and opened systems.
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a device disconnected callback.
This function unregisters a device disconnected callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a device found callback.
This function unregisters a device found callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a device list change callback.
This function unregisters a device lost callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a device lost callback.
This function unregisters a device lost callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a device reconnected callback.
This function unregisters a device reconnected callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a interface found callback.
This function unregisters a interface found callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters an interface lost callback.
This function unregisters an interface lost callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Unregisters a system found callback.
This function unregisters a system found callback by taking its handle.
| [in] | callbackHandle | The handle of the callback to unregister. |
| core::InternalErrorException | An internal error has occurred. |
|
inline |
Starts an update.
If there is already an update in progress, it waits for the previous update to finish before starting the new update.
| [in] | updatePolicy | The update policy to use. |
| [in] | errorCallback | A thread-safe callback getting called for each error occurring during the update. |
| core::NotInitializedException | The library was not initialized before use. |
| core::InternalErrorException | An internal error has occurred. |
| core::NotFoundException | The environment variable GENICAM_GENTL32_PATH / GENICAM_GENTL64_PATH was not found or was empty when scanning for environment ProducerLibraries. |
| core::CTILoadingException | A error has occurred when loading a CTI from the environment variable GENICAM_GENTL32_PATH / GENICAM_GENTL64_PATH. |
|
friend |