CVB++ 14.0
driver.hpp
1#pragma once
2
3#include <codecvt>
4#include <locale>
5#include <vector>
6#include <type_traits>
7#include <tuple>
8
9#include "../global.hpp"
10#include "../string.hpp"
11#include "../genapi/genapi.hpp"
12
13namespace Cvb
14{
15
16CVB_BEGIN_INLINE_NS
17
19
23namespace Driver
24{
25
26class FlowSetPool;
29
30class DeviceControl;
33
34class RingBuffer;
37
38class DigitalIO;
41
42class SoftwareTrigger;
45
49
50class ImageRect;
53
54class DeviceImage;
57
58class VinDevice;
61
62class VideoDevice;
65
66class EmuDevice;
69
70class NonStreamingDevice;
73
74class GenICamDevice;
77
78class RingBufferImage;
81
82class StreamImage;
85
86class MultiPartImage;
89
90class BufferImage;
93
94class Stream;
97
98class IndexedStream;
101
102class StreamBase;
105
109
110class ImageStream;
113
114class CompositeStream;
117
118class PointCloudStream;
121
122class VideoImage;
125
126class EmuImage;
129
130class VinImage;
133
134class FlowSetPool;
137
138enum class StreamType
139{
140 Legacy,
141 Composite,
142 Image,
144};
145
147
148struct Flow
149{
151 size_t Size;
152
154 void* Buffer;
155
157 Flow(size_t size = 0, void* buffer = nullptr)
158 : Size(size)
159 , Buffer(buffer)
160 {
161 }
162};
163
164namespace Private
165{
166
167template <class T>
168inline StreamType StreamTypeFor() noexcept
169{
173 std::is_same<T, class Stream>::value, "unsupported stream type");
174 return StreamType::Legacy;
175}
176
177template <>
178inline StreamType StreamTypeFor<class Stream>() noexcept
179{
180 return StreamType::Legacy;
181}
182
183template <>
184inline StreamType StreamTypeFor<CompositeStream>() noexcept
185{
186 return StreamType::Composite;
187}
188
189template <>
190inline StreamType StreamTypeFor<ImageStream>() noexcept
191{
192 return StreamType::Image;
193}
194
195template <>
196inline StreamType StreamTypeFor<PointCloudStream>() noexcept
197{
198 return StreamType::PointCloud;
199}
200
201}
202
205{
211 InterfaceSubNetList = CExports::DO_DISCOVER_INFO_INTERFACE_NET_LIST,
213 InterfaceMac = CExports::DO_DISCOVER_INFO_INTERFACE_NET_MAC,
219 InterfaceTLType = CExports::DO_DISCOVER_INFO_INTERFACE_TLTYPE,
221 InterfaceDisplayName = CExports::DO_DISCOVER_INFO_INTERFACE_DISPLAYNAME,
227 InterfaceDriverType = CExports::DO_DISCOVER_INFO_INTERFACE_DRIVERTYPE,
229 InterfaceId = CExports::DO_DISCOVER_INFO_INTERFACE_ID,
235 DeviceTransportLayerType = CExports::DO_DISCOVER_INFO_DEVICE_TLTYPE,
237 DeviceUsername = CExports::DO_DISCOVER_INFO_DEVICE_USERNAME,
239 DeviceSerialNumber = CExports::DO_DISCOVER_INFO_DEVICE_SERIALNUMBER,
241 DeviceMac = CExports::DO_DISCOVER_INFO_DEVICE_NET_MAC,
243 DeviceIP = CExports::DO_DISCOVER_INFO_DEVICE_NET_IP,
245 DeviceSubnetMask = CExports::DO_DISCOVER_INFO_DEVICE_NET_SUBNETMASK,
247 DeviceUsbVendorId = CExports::DO_DISCOVER_INFO_DEVICE_USB_VID,
249 DeviceUsbProductId = CExports::DO_DISCOVER_INFO_DEVICE_USB_PID,
251 DeviceVendor = CExports::DO_DISCOVER_INFO_DEVICE_VENDOR,
253 DeviceModel = CExports::DO_DISCOVER_INFO_DEVICE_MODEL,
255 DeviceId = CExports::DO_DISCOVER_INFO_DEVICE_ID,
261 DeviceAccessStatus = CExports::DO_DISCOVER_INFO_DEVICE_ACCESS_STATUS,
263 TransportLayerId = CExports::DO_DISCOVER_INFO_TRANSPORTLAYER_ID,
265 TransportLayerPath = CExports::DO_DISCOVER_INFO_TRANSPORTLAYER_PATH,
267 TransportLayerVendor = CExports::DO_DISCOVER_INFO_TRANSPORTLAYER_VENDOR,
269 UsbPortPath = CExports::DO_DISCOVER_INFO_DEVICE_USB_PORT_PATH
270};
271
274{
276 Vin,
280 PreferVin,
282 GenTL,
287};
288
290
294{
296 FindAll = 0,
302 IncludeEmpty = 1,
304 IncludeInaccessible = 1 << 12,
306 UpToLevelSystem = 1 << 1,
308 UpToLevelVin = 2 << 1,
310 UpToLevelTL = 3 << 1,
312 UpToLevelInterface = 4 << 1,
314 UpToLevelDevice = 5 << 1,
316 UpToLevelStream = 6 << 1,
318 IgnoreVins = 1 << 8,
320 IgnoreTLs = 1 << 9,
322 IgnoreGevSD = 1 << 10,
324 IgnoreGevFD = 1 << 11
325};
326
327inline DiscoverFlags operator|(DiscoverFlags a, DiscoverFlags b)
328{
329 return static_cast<DiscoverFlags>(static_cast<std::uint64_t>(a) | static_cast<std::uint64_t>(b));
330}
331
333enum class ModuleLayer
334{
336 Unknown = CExports::DO_AT_LEVEL_UNKNOWN,
338 System = CExports::DO_AT_LEVEL_SYSTEM,
340 Vin = CExports::DO_AT_LEVEL_VIN,
342 TransportLayerSystem = CExports::DO_AT_LEVEL_TLSYSTEM,
344 TransportLayerInterface = CExports::DO_AT_LEVEL_TLIFACE,
346 TransportLayerDevice = CExports::DO_AT_LEVEL_TLDEVICE,
348 TransportLayerStream = CExports::DO_AT_LEVEL_TLSTREAM
349};
350
353{
355 Void = CExports::CVNO_DATA_VOID,
357 Int64 = CExports::CVNO_DATA_INTEGER64,
359 Float64 = CExports::CVNO_DATA_FLOAT64,
361 String = CExports::CVNO_DATA_STRING,
363 Binary = CExports::CVNO_DATA_BINARY,
365 Boolean = CExports::CVNO_DATA_BOOL8,
366};
367
369enum class DeviceState
370{
374 DeviceReconnect = 3,
378 NewMetaData = 5
379};
380
382
384template <class T> struct WaitResult
385{
390};
391
394{
400 Auto = CExports::RINGBUFFER_LOCKMODE_AUTO,
406 Off = CExports::RINGBUFFER_LOCKMODE_OFF,
412 On = CExports::RINGBUFFER_LOCKMODE_ON
413};
414
416enum class PlaybackMode
417{
426 Stream
427};
428
431{
433 Grabber,
435 Grab2,
437 GenTL
438};
439
441
446enum class StreamInfo
447{
456 IsCameraDetected = CExports::GRAB_INFO_CAMERA_DETECTED,
458 NumBuffersAcquired = CExports::GRAB_INFO_NUMBER_IMAGES_AQCUIRED,
465 NumBuffersDelivered = CExports::G2INFO_NumBuffersDelivered,
470 NumBuffersLost = CExports::G2INFO_NumBuffersLost,
472 NumBuffersLostTransfer = CExports::GRAB_INFO_NUMBER_IMAGES_LOST,
474 NumBuffersLostLocked = CExports::GRAB_INFO_NUMBER_IMAGES_LOST_LOCKED,
476 NumBuffersLocked = CExports::GRAB_INFO_NUMBER_IMAGES_LOCKED,
478 NumBuffersPending = CExports::GRAB_INFO_NUMBER_IMAGES_PENDIG,
487 NumBuffersCorruptOnArrival = CExports::G2INFO_NumBuffersCorrupt,
495 NumBuffersCorruptOnDelivery = CExports::G2INFO_NumBuffersCorruptOnDelivery,
497 NumTriggersLost = CExports::GRAB_INFO_NUMBER_TRIGGERS_LOST,
504 NumBuffersAnnounced = CExports::G2INFO_NumBuffersAnnounced,
509 NumBuffersQueued = CExports::G2INFO_NumBuffersQueued,
511 NumBuffersBeingFilled = CExports::G2INFO_NumBuffersInIncompleteList,
513 NumPacketsReceived = CExports::G2INFO_NumPacketsReceived,
515 NumResends = CExports::G2INFO_NumResends
516};
517
520{
522 Get = CExports::DC_GET,
524 Set = CExports::DC_SET,
526 GetMinimum = CExports::DC_GETMIN,
528 GetMaxiumum = CExports::DC_GETMAX,
530 Verify = CExports::DC_VERIFY
531
532};
533
536{
538 Started,
540 Stopping,
544 Stopped
545};
546
547
548namespace NodeMapID
549{
551 static const Cvb::String Device = Cvb::String(CVB_LIT("Device"));
553 static const Cvb::String Factory = Cvb::String(CVB_LIT("TLFactory"));
555 static const Cvb::String System = Cvb::String(CVB_LIT("TLSystem"));
557 static const Cvb::String Interface = Cvb::String(CVB_LIT("TLInterface"));
559 static const Cvb::String TLDevice = Cvb::String(CVB_LIT("TLDevice"));
561 static const Cvb::String DataStream = Cvb::String(CVB_LIT("TLDatastream"));
563 static const Cvb::String VinDevice = Cvb::String(CVB_LIT("VinDevice"));
565 static const Cvb::String VinBuffer = Cvb::String(CVB_LIT("VinBuffer"));
566}
567
569template<class T>
571
572}
573
580
601using Driver::Stream;
605
606using Driver::StreamType;
621using Driver::VinImage;
627using Driver::Flow;
628
629namespace NodeMapID = Driver::NodeMapID;
630
631CVB_END_INLINE_NS
632
633}
Buffer class implementing a buffer.
Definition: buffer.hpp:14
Component class is a container for CVB objects.
Definition: decl_composite.hpp:45
Generic CVB physical device.
Definition: decl_device.hpp:39
Base class of all composite based streams.
Definition: decl_composite_stream_base.hpp:32
Streams composites.
Definition: composite_stream.hpp:21
Implementation of the device control interface.
Definition: decl_device_control.hpp:98
Special device image.
Definition: decl_device_image.hpp:26
Digital I/O operations on a device.
Definition: decl_digital_io.hpp:24
A device representing an image stream based on single image files.
Definition: decl_emu_device.hpp:34
FlowSetPool class to set external buffers as set of flows.
Definition: flow_set_pool.hpp:44
A device representing a GenICam compliant device.
Definition: decl_genicam_device.hpp:20
Image rectangle operations on a device.
Definition: decl_image_rect.hpp:18
Streams images.
Definition: image_stream.hpp:20
A stream with a finite number of images, which can also be accessed via an index.
Definition: decl_indexed_stream.hpp:26
MultiPart image class.
Definition: multi_part_image.hpp:23
Single notify event observable.
Definition: decl_notify_observable.hpp:98
Streams point clouds.
Definition: point_cloud_stream.hpp:20
Ring buffer operations on a device.
Definition: decl_ring_buffer.hpp:22
Stream image that is returned, when the ring buffer interface is available on a device.
Definition: decl_ring_buffer_image.hpp:29
Implementation of the software trigger.
Definition: decl_software_trigger.hpp:16
Base class of all streams.
Definition: stream_base.hpp:20
Represents one acquisition stream of a device.
Definition: decl_stream.hpp:38
Base class of all stream related images.
Definition: stream_image.hpp:33
A device representing a video stream from the hard disk.
Definition: decl_video_device.hpp:32
A device representing a video interface driver (vin).
Definition: decl_vin_device.hpp:37
Lazy enumeration of node maps.
Definition: node_map_enumerator.hpp:31
The Common Vision Blox image.
Definition: decl_image.hpp:45
A point cloud object.
Definition: decl_point_cloud.hpp:49
DeviceState
States the device can be in.
Definition: driver.hpp:370
@ DeviceReconnect
Device was reconnected (communication regained).
@ DeviceImageGeometryChanged
Device width, height, plane number and/or data type changed.
@ NewMetaData
New meta data arrived.
@ DeviceDisconnected
Device was disconnected (communication lost).
DeviceControlOperation
Operation on driver specific parameter.
Definition: driver.hpp:520
@ GetMinimum
Gets the minimal supported value for the parameter.
@ GetMaxiumum
Gets the maximal supported value for the parameter.
@ Verify
Verify the given value for the parameter.
@ Set
Set information in the device.
@ Get
Get information from the device.
PlaybackMode
Defines how frames are acquired by this video device.
Definition: driver.hpp:417
@ FrameByFrame
The Stream::Wait() method always returns the next image in the video stream.
AcquisitionStack
Defines the acquisition stack when opening the device.
Definition: driver.hpp:274
@ GenTL
Use GenTL acquisition stack or fail.
@ Vin
Use Vin acquisition stack or fail.
RingBufferLockMode
Lock mode options for the ring buffer.
Definition: driver.hpp:394
ModuleLayer
Level of an access token entry.
Definition: driver.hpp:334
@ TransportLayerStream
GenTL Producer stream module.
@ TransportLayerSystem
GenTL Producer system module.
@ TransportLayerDevice
GenTL Producer device module.
@ TransportLayerInterface
GenTL Producer interface module.
DiscoveryProperties
Properties which can be queried from a DiscoveryInformation entry.
Definition: driver.hpp:205
@ TransportLayerPath
File path of the CTI file(GenTL Producer library).
@ TransportLayerVendor
Vendor name of the GenTL Producer.
@ DeviceSerialNumber
Device only : Serial number.
@ DeviceIP
Ethernet device only : IP address.
@ DeviceMac
Ethernet device only : MAC address.
@ DeviceSubnetMask
Ethernet device only : Subnet mask.
@ DeviceModel
Device only : Model name.
@ DeviceUsbProductId
USB device only : USB product identifier.
@ InterfaceMac
Ethernet interface only: MAC address.
@ UsbPortPath
Port path of USB device.
@ DeviceUsername
Device only : User configured name.
@ InterfaceDisplayName
Interface only: Human readable name of the interface.
@ DeviceUsbVendorId
USB device only: USB vendor identifier.
@ DeviceId
Device only : GenTL identifier of the interface.
@ DeviceVendor
Device only : Vendor name.
@ InterfaceId
Interface only: GenTL identifier of the interface.
@ TransportLayerId
Unique identifier of the GenTL Producer.
NotifyDataType
Data type delivered by the event.
Definition: driver.hpp:353
StreamInfo
Queryable stream information.
Definition: driver.hpp:447
@ NumBuffersLostTransfer
Count that only contains lost images during transfer.
@ NumPacketsReceived
For packet based protocols this contains the actual number of packets received (parts of a whole imag...
@ NumBuffersAcquired
The number of images buffers acquired since start of the last acquisition start.
@ NumBuffersPending
Number of images acquired, but not retrieved via the stream's wait method.
@ NumBuffersLostLocked
Count that only contains lost images due to ring buffer overflow.
@ NumBuffersBeingFilled
Number of buffer currently being filled by the acquisition engine.
@ NumResends
Number of resend requests sent since start of the last acquisition.
@ NumTriggersLost
Gets how many trigger signals where ignored by the device due to e.g. over-triggering.
@ NumBuffersLocked
Number of images currently in locked state.
DiscoverFlags
Flags controlling the discovery process.
Definition: driver.hpp:294
@ IgnoreVins
Ignore vin-drivers in discovery.
@ UpToLevelTL
Limit discovery depth to transport library level.
@ UpToLevelInterface
Limit discovery depth to interface library level.
@ UpToLevelVin
Limit discovery depth to vin-driver level.
@ UpToLevelStream
Limit discovery depth to stream level.
@ UpToLevelDevice
Limit discovery depth to device level.
@ UpToLevelSystem
Limit discovery depth to system level(factory).
@ IgnoreGevFD
Ignore filter driver for GEVTL GenTL Producer.
@ IgnoreTLs
Ignore GenTL producers in discovery.
@ IgnoreGevSD
Ignore socket driver for GEVTL GenTL Producer.
@ FindAll
Default flags to find all devices and vin-drivers.
@ IncludeInaccessible
Normally inaccessible devices are filtered out : this flag includes them.
AcquisitionState
Specifies current state of the acquisition engine.
Definition: driver.hpp:536
@ Stopping
The engine is in the process of stopping.
@ Started
The engine is started.
@ Stopped
The engine is stopped.
@ AbortingStop
The engine is aborting an ongoing stop.
AcquisitionInterface
Known acquisition CVB interfaces.
Definition: driver.hpp:431
@ Grab2
Ring buffer / queue based acquisition.
@ Grabber
Basic grabber interface for single image acquisition.
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
std::string String
String for wide characters or unicode characters.
Definition: string.hpp:45
WaitStatus
Status after waiting for an image to be returned.
Definition: global.hpp:351
@ Ok
Everything is fine, a new image arrived.
Struct handling the size and buffer of a flow.
Definition: driver.hpp:149
size_t Size
Flow size in bytes.
Definition: driver.hpp:151
Flow(size_t size=0, void *buffer=nullptr)
Constructor.
Definition: driver.hpp:157
void * Buffer
The buffer.
Definition: driver.hpp:154
A combined result returned after waiting for a image.
Definition: driver.hpp:385
WaitStatus Status
The status.
Definition: driver.hpp:387
std::shared_ptr< T > Image
The returned image by wait if applicable cast to the provided type.
Definition: driver.hpp:389