CVB++ 14.1
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 explicit 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 // Normally MockTL.cti is filtered out: this flag includes it.
326 IncludeMockTL = 1 << 13
327};
328
329inline DiscoverFlags operator|(DiscoverFlags a, DiscoverFlags b)
330{
331 return static_cast<DiscoverFlags>(static_cast<std::uint64_t>(a) | static_cast<std::uint64_t>(b));
332}
333
334inline DiscoverFlags& operator|=(DiscoverFlags& lhs, const DiscoverFlags& rhs)
335{
336 lhs = static_cast<DiscoverFlags>(static_cast<std::uint64_t>(lhs) | static_cast<std::uint64_t>(rhs));
337 return lhs;
338}
339
341enum class ModuleLayer
342{
344 Unknown = CExports::DO_AT_LEVEL_UNKNOWN,
346 System = CExports::DO_AT_LEVEL_SYSTEM,
348 Vin = CExports::DO_AT_LEVEL_VIN,
350 TransportLayerSystem = CExports::DO_AT_LEVEL_TLSYSTEM,
352 TransportLayerInterface = CExports::DO_AT_LEVEL_TLIFACE,
354 TransportLayerDevice = CExports::DO_AT_LEVEL_TLDEVICE,
356 TransportLayerStream = CExports::DO_AT_LEVEL_TLSTREAM
357};
358
361{
363 Void = CExports::CVNO_DATA_VOID,
365 Int64 = CExports::CVNO_DATA_INTEGER64,
367 Float64 = CExports::CVNO_DATA_FLOAT64,
369 String = CExports::CVNO_DATA_STRING,
371 Binary = CExports::CVNO_DATA_BINARY,
373 Boolean = CExports::CVNO_DATA_BOOL8,
374};
375
377enum class DeviceState
378{
382 DeviceReconnect = 3,
386 NewMetaData = 5
387};
388
390
392template <class T> struct WaitResult
393{
398};
399
402{
408 Auto = CExports::RINGBUFFER_LOCKMODE_AUTO,
409
410 // lockmode off removed
411
417 On = CExports::RINGBUFFER_LOCKMODE_ON
418};
419
421enum class PlaybackMode
422{
431 Stream
432};
433
436{
438 Grabber,
440 Grab2,
442 GenTL
443};
444
446
451enum class StreamInfo
452{
461 IsCameraDetected = CExports::GRAB_INFO_CAMERA_DETECTED,
463 NumBuffersAcquired = CExports::GRAB_INFO_NUMBER_IMAGES_AQCUIRED,
470 NumBuffersDelivered = CExports::G2INFO_NumBuffersDelivered,
475 NumBuffersLost = CExports::G2INFO_NumBuffersLost,
477 NumBuffersLostTransfer = CExports::GRAB_INFO_NUMBER_IMAGES_LOST,
479 NumBuffersLostLocked = CExports::GRAB_INFO_NUMBER_IMAGES_LOST_LOCKED,
481 NumBuffersLocked = CExports::GRAB_INFO_NUMBER_IMAGES_LOCKED,
483 NumBuffersPending = CExports::GRAB_INFO_NUMBER_IMAGES_PENDIG,
492 NumBuffersCorruptOnArrival = CExports::G2INFO_NumBuffersCorrupt,
500 NumBuffersCorruptOnDelivery = CExports::G2INFO_NumBuffersCorruptOnDelivery,
502 NumTriggersLost = CExports::GRAB_INFO_NUMBER_TRIGGERS_LOST,
509 NumBuffersAnnounced = CExports::G2INFO_NumBuffersAnnounced,
514 NumBuffersQueued = CExports::G2INFO_NumBuffersQueued,
516 NumBuffersBeingFilled = CExports::G2INFO_NumBuffersInIncompleteList,
518 NumPacketsReceived = CExports::G2INFO_NumPacketsReceived,
520 NumResends = CExports::G2INFO_NumResends
521};
522
525{
527 Get = CExports::DC_GET,
529 Set = CExports::DC_SET,
531 GetMinimum = CExports::DC_GETMIN,
533 GetMaxiumum = CExports::DC_GETMAX,
535 Verify = CExports::DC_VERIFY
536
537};
538
541{
543 Started,
545 Stopping,
549 Stopped
550};
551
553namespace NodeMapID
554{
556 static const Cvb::String Device = Cvb::String(CVB_LIT("Device")); // NOLINT(cert-err58-cpp)
558 static const Cvb::String Factory = Cvb::String(CVB_LIT("TLFactory")); // NOLINT(cert-err58-cpp)
560 static const Cvb::String System = Cvb::String(CVB_LIT("TLSystem")); // NOLINT(cert-err58-cpp)
562 static const Cvb::String Interface = Cvb::String(CVB_LIT("TLInterface")); // NOLINT(cert-err58-cpp)
564 static const Cvb::String TLDevice = Cvb::String(CVB_LIT("TLDevice")); // NOLINT(cert-err58-cpp)
566 static const Cvb::String DataStream = Cvb::String(CVB_LIT("TLDatastream")); // NOLINT(cert-err58-cpp)
568 static const Cvb::String VinDevice = Cvb::String(CVB_LIT("VinDevice")); // NOLINT(cert-err58-cpp)
570 static const Cvb::String VinBuffer = Cvb::String(CVB_LIT("VinBuffer")); // NOLINT(cert-err58-cpp)
571}
572
574template<class T>
576
577}
578
585
606using Driver::Stream;
610
611using Driver::StreamType;
626using Driver::VinImage;
632using Driver::Flow;
633
634namespace NodeMapID = Driver::NodeMapID;
635
636CVB_END_INLINE_NS
637
638}
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:67
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
static const Cvb::String Factory
The name of the node map that gives access to CVB's GenTL enumeration.
Definition: driver.hpp:558
static const Cvb::String VinBuffer
The name of the node map that represents the video interface driver buffer.
Definition: driver.hpp:570
static const Cvb::String TLDevice
The name of the node map that gives access to the GenTL's side of the device (the proxy).
Definition: driver.hpp:564
static const Cvb::String Interface
The name of the node map that gives access to the GenTL interface (e.g. the NIC) of the currently ope...
Definition: driver.hpp:562
static const Cvb::String System
The name of the node map that gives access to the GenTL system (the TL itself) of the currently opene...
Definition: driver.hpp:560
static const Cvb::String DataStream
The name of the node map that gives access to the GenTL streaming interface (grab/acquisition).
Definition: driver.hpp:566
DeviceState
States the device can be in.
Definition: driver.hpp:378
@ 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:525
@ 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:422
@ 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:402
ModuleLayer
Level of an access token entry.
Definition: driver.hpp:342
@ 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:361
StreamInfo
Queryable stream information.
Definition: driver.hpp:452
@ 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:541
@ 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:436
@ 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:56
WaitStatus
Status after waiting for an image to be returned.
Definition: global.hpp:376
@ 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:393
WaitStatus Status
The status.
Definition: driver.hpp:395
std::shared_ptr< T > Image
The returned image by wait if applicable cast to the provided type.
Definition: driver.hpp:397