CVB.Net 14.1
DeviceFactory Class Reference

Factory object for creating Device objects. More...

Static Public Member Functions

static DiscoveryInformationList Discover ()
 Discovers available devices (not vins) with a default time span of 300ms. More...
 
static DiscoveryInformationList Discover (DiscoverFlags flags)
 Discovers available devices/nodes depending on the given flags with a default time span of 300ms. More...
 
static DiscoveryInformationList Discover (DiscoverFlags flags, TimeSpan waitTime)
 Discovers available devices/nodes depending on the given flags . More...
 
static DiscoveryInformationList Discover (DiscoveryInformation info)
 Discovers available nodes starting on the level of the given discover info with a default time span of 300ms. More...
 
static DiscoveryInformationList Discover (string accessToken)
 Discovers available nodes starting on level of the given accessToken with a default time span of 300ms. More...
 
static DiscoveryInformationList Discover (DiscoveryInformation info, DiscoverFlags flags)
 Discovers available nodes starting on level of the given discover info with a default time span of 300ms. More...
 
static DiscoveryInformationList Discover (string accessToken, DiscoverFlags flags)
 Discovers available nodes starting on level of the given accessToken with a default time span of 300ms. More...
 
static DiscoveryInformationList Discover (DiscoveryInformation info, DiscoverFlags flags, TimeSpan waitTime)
 Discovers available nodes starting on level of the given discover info . More...
 
static DiscoveryInformationList Discover (string accessToken, DiscoverFlags flags, TimeSpan waitTime)
 Discovers available nodes starting on level of the given accessToken . More...
 
static IEnumerable< DeviceGetOpenDeviceSnapshot ()
 Gets all currently opened devices. More...
 
static bool TryOpen (DiscoveryInformation info, out Device device, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
 Tries to open a device with the given discovery info . More...
 
static bool TryOpen (string provider, out Device device, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
 Tries to open a device with the given provider with its default board and port (if applicable). More...
 
static bool TryOpen (string provider, int board, int port, out Device device)
 Tries to open a device with the given provider . More...
 
static bool TryOpenBoard (string provider, int board, out Device device)
 Tries to open a device with the given provider and board . More...
 
static bool TryOpenPort (string provider, int port, out Device device)
 Tries to open a device with the given provider and port . More...
 
static Device Open (DiscoveryInformation info, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
 Opens a device based on the given discovery info . More...
 
static T Open< T > (DiscoveryInformation info)
 Opens a device of type T based on the given discovery info . More...
 
static Device Open (string provider, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
 Tries to open a device with the given provider with its default board and port (if applicable). More...
 
static T Open< T > (string provider)
 Tries to open a device of type T with the given provider with its default board and port (if applicable). More...
 
static Device Open (string provider, int board, int port)
 Open a device with the given provider . More...
 
static T Open< T > (string provider, int board, int port)
 Open a device of type T with the given provider . More...
 
static Device OpenBoard (string provider, int board)
 Open a device with the given provider and board . More...
 
static Device OpenPort (string provider, int port)
 Open a device with the given provider and port . More...
 

Static Public Attributes

static readonly Guid AviMpgGuid = new Guid(0x7DBE4A03, 0xAD3D, 0x4533, 0x85, 0x1F, 0x61, 0xB4, 0xAE, 0x62, 0xC2, 0x0E)
 The GUID for the video image source.
 
static readonly Guid FileGuid = new Guid(0x202a953a, 0xe736, 0x11d0, 0xae, 0x79, 0x00, 0xa0, 0x24, 0x90, 0x4c, 0x20)
 The GUID for the CVCFile based driver (i.e. load the CVCFile dlo like a vin).
 
static readonly Guid EmuGuid = new Guid(0x10cb8e8f, 0x00b6, 0x4bb0, 0xbb, 0x82, 0xcd, 0x77, 0x2c, 0xba, 0xb7, 0x57)
 The GUID for the Emu file driver.
 
static readonly Guid GenICamGuid = new Guid(0x4de1ebf3, 0xd052, 0x43ad, 0xbc, 0x4, 0x72, 0x45, 0x02, 0xb5, 0xf3, 0x71)
 The GUID for the GenICam.vin.
 

Properties

static int NumberOfOpenDevices [get]
 Gets the number of open devices.
 
static EventHandler< DeviceEventArgsNewDevice
 Occurs when a new device is created.
 
static EventHandler< DeviceEventArgsDeviceDisposed
 Occurs when a new device is disposed. More...
 

Detailed Description

Factory object for creating Device objects.

Member Function Documentation

◆ Discover() [1/9]

static DiscoveryInformationList Discover ( )
static

Discovers available devices (not vins) with a default time span of 300ms.

This method behaves like the CVB Management Console when discovering devices: It lists all GenICam devices (like GigE Vision and USB3 Vision) and filters out the STEMMER IMAGING Socket Driver devices for GigE Vision (only shows Filter Driver devices).

This method does not throw a TimeoutException if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Returns
The list of found devices.

◆ Discover() [2/9]

static DiscoveryInformationList Discover ( DiscoverFlags  flags)
static

Discovers available devices/nodes depending on the given flags with a default time span of 300ms.

This method does not throw a TimeoutException if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Parameters
flagsDiscovery control flags.
Returns
The list of found devices/nodes.

◆ Discover() [3/9]

static DiscoveryInformationList Discover ( DiscoverFlags  flags,
TimeSpan  waitTime 
)
static

Discovers available devices/nodes depending on the given flags .

This method does not throw a TimeoutException if waitTime is exceeded: it just waits for the given time span. If a device answers after this span it is not in the returned list.

Parameters
flagsDiscovery control flags.
waitTimeTime to wait for discovery answers from devices.
Returns
The list of found devices/nodes.

◆ Discover() [4/9]

static DiscoveryInformationList Discover ( DiscoveryInformation  info)
static

Discovers available nodes starting on the level of the given discover info with a default time span of 300ms.

This method does not throw a TimeoutException if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Parameters
infoStart level and parameter set for query.
Returns
The list of found devices/nodes.

◆ Discover() [5/9]

static DiscoveryInformationList Discover ( DiscoveryInformation  info,
DiscoverFlags  flags 
)
static

Discovers available nodes starting on level of the given discover info with a default time span of 300ms.

This method does not throw a TimeoutException if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Parameters
infoStart level and parameter set for query.
flagsDiscovery control flags.
Returns
The list of found devices/nodes.

◆ Discover() [6/9]

static DiscoveryInformationList Discover ( DiscoveryInformation  info,
DiscoverFlags  flags,
TimeSpan  waitTime 
)
static

Discovers available nodes starting on level of the given discover info .

This method does not throw a TimeoutException if waitTime is exceeded: it just waits for the given time span. If a device answers after this span it is not in the returned list.

Parameters
infoStart level and parameter set for query.
flagsDiscovery control flags.
waitTimeTime to wait for discovery answers from devices.
Returns
The list of found devices/nodes.

◆ Discover() [7/9]

static DiscoveryInformationList Discover ( string  accessToken)
static

Discovers available nodes starting on level of the given accessToken with a default time span of 300ms.

This method does not throw a TimeoutException if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Parameters
accessTokenStart level and parameter set for query.
Returns
The list of found devices/nodes.

◆ Discover() [8/9]

static DiscoveryInformationList Discover ( string  accessToken,
DiscoverFlags  flags 
)
static

Discovers available nodes starting on level of the given accessToken with a default time span of 300ms.

This method does not throw a TimeoutException if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Parameters
accessTokenStart level and parameter set for query.
flagsDiscovery control flags.
Returns
The list of found devices/nodes.

◆ Discover() [9/9]

static DiscoveryInformationList Discover ( string  accessToken,
DiscoverFlags  flags,
TimeSpan  waitTime 
)
static

Discovers available nodes starting on level of the given accessToken .

This method does not throw a TimeoutException if waitTime is exceeded: it just waits for the given time span. If a device answers after this span it is not in the returned list.

Parameters
accessTokenStart level and parameter set for query.
flagsDiscovery control flags.
waitTimeTime to wait for discovery answers from devices.
Returns
The list of found devices/nodes.

◆ GetOpenDeviceSnapshot()

static IEnumerable< Device > GetOpenDeviceSnapshot ( )
static

Gets all currently opened devices.

Returns
All open, non-disposed Devices, available at the time the method was called.

◆ Open() [1/3]

static Device Open ( DiscoveryInformation  info,
AcquisitionStack  acquisitionStack = AcquisitionStack.PreferVin 
)
static

Opens a device based on the given discovery info .

Parameters
infoInfo describing a discovered device/node.
acquisitionStackAcquisition stack to open.
Returns
Device object for given info .

◆ Open() [2/3]

static Device Open ( string  provider,
AcquisitionStack  acquisitionStack = AcquisitionStack.PreferVin 
)
static

Tries to open a device with the given provider with its default board and port (if applicable).

The opened board/port need not necessary be 0 as this depends on the driver configuration!

Returns
Device object for given provider .
Exceptions
IOExceptionIf the given provider could not be opened.
Parameters
providerName of the device provider.
acquisitionStackAcquisition stack to open.

◆ Open() [3/3]

static Device Open ( string  provider,
int  board,
int  port 
)
static

Open a device with the given provider .

For this method the provider is a vin-driver on which a specific board and port is to be opened.

If the driver does not support either one of the board/port select interfaces, you can set the board or port parameters to 0. For non-0 values an exception will be thrown.

Parameters
providerName of the device provider.
boardBoard number to open.
portPort number to open.
Returns
Device object for given provider , board and port combination.
Exceptions
IOExceptionIf the given provider could not be opened.
ArgumentOutOfRangeExceptionIf the given board or port are outside their allowed range.
NullReferenceExceptionIf board or port select interface are missing.

◆ Open< T >() [1/3]

static T Open< T > ( DiscoveryInformation  info)
static

Opens a device of type T based on the given discovery info .

Used to get a specific type T of device (VinDevice, GenICamdevice...).

Parameters
infoInfo describing a discovered device/node.
Returns
Device object of type T for given info . Returns null if device for given info is not of type T .
Type Constraints
T :Device 

◆ Open< T >() [2/3]

static T Open< T > ( string  provider)
static

Tries to open a device of type T with the given provider with its default board and port (if applicable).

The opened board/port need not necessary be 0 as this depends on the driver configuration!

Used to get a specific type T of device (VinDevice, GenICamdevice...).

Returns
Device object of type T for given provider . If device for given provider is not of type T , returns null.
Exceptions
IOExceptionIf the given provider could not be opened.
Parameters
providerName of the device provider.
Type Constraints
T :Device 

◆ Open< T >() [3/3]

static T Open< T > ( string  provider,
int  board,
int  port 
)
static

Open a device of type T with the given provider .

For this method the provider is a vin-driver on which a specific board and port is to be opened.

If the driver does not support either one of the board/port select interfaces, you can set the board or port parameters to 0. For non-0 values an exception will be thrown.

Used to get a specific type T of device (VinDevice, GenICamdevice...).

Parameters
providerName of the device provider.
boardBoard number to open.
portPort number to open.
Returns
Device object of type T for given provider , board and port combination. Null if device for given combination is not of type T .
Exceptions
IOExceptionIf the given provider could not be opened.
ArgumentOutOfRangeExceptionIf the given board or port are outside their allowed range.
NullReferenceExceptionIf board or port select interface are missing.
Type Constraints
T :Device 

◆ OpenBoard()

static Device OpenBoard ( string  provider,
int  board 
)
static

Open a device with the given provider and board .

For this method the provider is a vin-driver on which a specific board is to be opened.

If the driver does not support board select interfaces, you can set the board parameter to 0. For non-0 values an exception will be thrown.

Parameters
providerName of the device provider.
boardBoard number to open.
Returns
Device object for given provider and board .
Exceptions
IOExceptionIf the given provider could not be opened.
ArgumentOutOfRangeExceptionIf the given board is outside its allowed range.
NullReferenceExceptionIf board select interfaces are missing.

◆ OpenPort()

static Device OpenPort ( string  provider,
int  port 
)
static

Open a device with the given provider and port .

For this method the provider is a vin-driver on which a specific port is to be opened.

If the driver does not support camera select interfaces, you can set the port parameter to 0. For non-0 values an exception will be thrown.

Parameters
providerName of the device provider.
portPort number to open.
Returns
Device object for given provider and port .
Exceptions
IOExceptionIf the given provider could not be opened.
ArgumentOutOfRangeExceptionIf the given port is outside its allowed range.
NullReferenceExceptionIf camera select interfaces are missing.

◆ TryOpen() [1/3]

static bool TryOpen ( DiscoveryInformation  info,
out Device  device,
AcquisitionStack  acquisitionStack = AcquisitionStack.PreferVin 
)
static

Tries to open a device with the given discovery info .

Parameters
infoDiscovery information.
deviceDevice object on success; null on failure.
acquisitionStackAcquisition stack to open.
Returns
true on success; false on failure.

◆ TryOpen() [2/3]

static bool TryOpen ( string  provider,
int  board,
int  port,
out Device  device 
)
static

Tries to open a device with the given provider .

For this method the provider is a vin-driver on which a specific board and port is to be opened.

If the driver does not support either one of the board/port select interfaces, you can set the board or port parameters to 0. For non-0 values this method will fail.

Parameters
providerName of the device provider.
boardBoard number to open.
portPort number to open.
deviceDevice object on success; null otherwise.
Returns
true on success; false on failure.

◆ TryOpen() [3/3]

static bool TryOpen ( string  provider,
out Device  device,
AcquisitionStack  acquisitionStack = AcquisitionStack.PreferVin 
)
static

Tries to open a device with the given provider with its default board and port (if applicable).

The opened board/port need not necessary be 0 as this depends on the driver configuration!

Parameters
providerName of the device provider.
deviceDevice object on success; null otherwise.
acquisitionStackAcquisition stack to open.
Returns
true on success; false on failure.

◆ TryOpenBoard()

static bool TryOpenBoard ( string  provider,
int  board,
out Device  device 
)
static

Tries to open a device with the given provider and board .

For this method the provider is a vin-driver on which a specific board .

If the driver does not support the board select interfaces, you can set the board parameter to 0. For non-0 values this method will fail.

Parameters
providerName of the device provider.
boardBoard number to open.
deviceDevice object on success; null otherwise.
Returns
true on success; false on failure.

◆ TryOpenPort()

static bool TryOpenPort ( string  provider,
int  port,
out Device  device 
)
static

Tries to open a device with the given provider and port .

For this method the provider is a vin-driver on which a specific port .

If the driver does not support the camera select interfaces, you can set the port parameter to 0. For non-0 values this method will fail.

Parameters
providerName of the device provider.
portPort number to open.
deviceDevice object on success; null otherwise.
Returns
true on success; false on failure.

Property Documentation

◆ DeviceDisposed

EventHandler<DeviceEventArgs> DeviceDisposed
staticaddremove

Occurs when a new device is disposed.

Beware of using the associated object as it is either disposed or in the process of disposing.