CVB++ 15.0
Device Class Reference

Generic CVB physical device. More...

#include <cvb/device.hpp>

Inherits enable_shared_from_this< Device >.

Inherited by EmuDevice, GenICamDevice, NonStreamingDevice, VideoDevice, and VinDevice.

Public Member Functions

void * Handle () const noexcept
 Classic API device handle. More...
 
String ResourceLocator () const noexcept
 Gets the access token or path of the file name including its extension. More...
 
DeviceControlPtr DeviceControl () const
 Gets the DeviceControl interface if present. More...
 
DigitalIOPtr DigitalIO () const
 Gets the DigitalIO interface if present. More...
 
SoftwareTriggerPtr SoftwareTrigger () const
 Gets the SoftwareTrigger interface if present. More...
 
ImageRectPtr ImageRect () const
 Gets the ImageRect interface if present. More...
 
virtual StreamPtr Stream () const
 Get the stream for this device. More...
 
int StreamCount () const noexcept
 Get the number of streams. More...
 
template<class T >
std::shared_ptr< T > DeviceImage () const
 Gets, if available, the device image pointing to the last synchronized image. More...
 
DeviceImagePtr DeviceImage () const
 Gets, if available, the device image pointing to the latest synchronized image. More...
 
NodeMapPtr NodeMap (const String &name) const
 Gets the NodeMap with the given name. More...
 
std::map< String, NodeMapPtr > NodeMaps () const
 Gets the dictionary holding all available NodeMaps. More...
 
NotifyObservablePtr NotifyObservable (int id) const
 Get the observable for a given id. More...
 
Cvb::ConnectionState ConnectionState () const noexcept
 brief Gets the current Cvb::ConnectionState of this Device object.
 
EventCookie RegisterConnectionStateChangedEvent (std::function< void()> handler)
 Register a listener to the OnDisconnect event. More...
 
void UnregisterConnectionStateChangedEvent (EventCookie eventCookie) noexcept
 Manually unregister a listener to the OnDisconnect event. More...
 

Detailed Description

Generic CVB physical device.

A device may provide an image stream or just expose a configuration interface.

See DeviceFactory for creating instances of this object.

Examples
Cvb/QtStreamDisplayPair.

Member Function Documentation

◆ DeviceControl()

Gets the DeviceControl interface if present.

Returns
Pointer object for accessing the interface; empty pointer if not available.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ DeviceImage() [1/2]

std::shared_ptr< T > DeviceImage ( ) const
inline

Gets, if available, the device image pointing to the last synchronized image.

Returns
Pointer to the device image (casted to the provided type).
Exceptions
Anyexception derived from std::exception including CvbException.
Examples
Cvb/QtStreamDisplayPair.

◆ DeviceImage() [2/2]

DeviceImagePtr DeviceImage ( ) const
inline

Gets, if available, the device image pointing to the latest synchronized image.

Returns
Pointer to the device image.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ DigitalIO()

Driver::DigitalIOPtr DigitalIO ( ) const
inline

Gets the DigitalIO interface if present.

Returns
Pointer object for accessing the interface; empty pointer if not available.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Handle()

void * Handle ( ) const
inlinenoexcept

Classic API device handle.

Returns
Classic API handle.
Exceptions
Doesnot throw any exception.

It is normally not necessary to work with this handle.

◆ ImageRect()

Driver::ImageRectPtr ImageRect ( ) const
inline

Gets the ImageRect interface if present.

Returns
Pointer object for accessing the interface; empty pointer if not available.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ NodeMap()

NodeMapPtr NodeMap ( const String name) const
inline

Gets the NodeMap with the given name.

Parameters
[in]nameThe NodeMap name (String or Cvb::NodeMapID).
Returns
A pointer to the NodeMap
Exceptions
Anyexception derived from std::exception including CvbException.
Example:
auto devices = Cvb::DeviceFactory::Discover(Cvb::DiscoverFlags::IgnoreVins);
auto device = Cvb::DeviceFactory::Open<Cvb::GenICamDevice>(devices.at(0).AccessToken(), Cvb::AcquisitionStack::GenTL);
auto deviceNodeMap = device->NodeMap(Cvb::NodeMapID::Device);
static std::vector< DiscoveryInformation > Discover()
Discovers available devices (not vins) with a default time span of 300ms.
Definition: decl_device_factory.hpp:221

◆ NodeMaps()

std::map< String, NodeMapPtr > NodeMaps ( ) const
inline

Gets the dictionary holding all available NodeMaps.

Returns
Dictionary containing all available node maps. Empty if no node map interface is available on this device.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ NotifyObservable()

Get the observable for a given id.

Parameters
[in]idThe observable id, which is device specific.
Returns
Pointer to the observabel object; empty pointer if not available.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ RegisterConnectionStateChangedEvent()

EventCookie RegisterConnectionStateChangedEvent ( std::function< void()>  handler)
inline

Register a listener to the OnDisconnect event.

Parameters
[in]handlerListener, to the OnDisconnect event.
Returns
Event cookie, to manually unregister the listener.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ResourceLocator()

String ResourceLocator ( ) const
inlinenoexcept

Gets the access token or path of the file name including its extension.

Returns
String containing the access token or rooted path for a file name.
Exceptions
Doesnot throw any exception.

◆ SoftwareTrigger()

Gets the SoftwareTrigger interface if present.

Returns
Pointer object for accessing the interface; empty pointer if not available.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Stream()

CVB_BEGIN_INLINE_NS Driver::StreamPtr Stream ( ) const
inlinevirtual

Get the stream for this device.

Note
This method is not supported by GenICamDevice.
Deprecated:
This method is deprecated for all technologies providing a GenTL. Use the template version with ImageStream, PointCloudStream or CompositeStream instead.
Returns
Pointer to the stream object.
Exceptions
Anyexception derived from std::exception including CvbException.

Reimplemented in GenICamDevice, and GenICamDevice.

Examples
Cvb/QtStreamDisplayPair.

◆ StreamCount()

int StreamCount ( ) const
inlinenoexcept

Get the number of streams.

Note
Only a GenICamDevice can have more than one stream A NonStreamingDevice does not have a stream!
Returns
Number of streams.
Exceptions
Doesnot throw any exception.

◆ UnregisterConnectionStateChangedEvent()

void UnregisterConnectionStateChangedEvent ( EventCookie  eventCookie)
inlinenoexcept

Manually unregister a listener to the OnDisconnect event.

Parameters
[in]eventCookieEvent cookie, obtained from registering the listener.
Exceptions
Doesnot throw any exception.