VisionBox Interface Library (2023-09-08)
Device Factory

Detailed Description

The class VIBSystem can be used as the factory for Devices.

Also take a look at Open devices using the Open() method which describes a more simple method.

A VIBSystem object is associated with a specific hardware entity like the mainboard or an extension card, see eSystemType.

After the factory is created with the static function VIBSystem::CreateInstance() , the method VIBSystem::OpenDevice() is used to create and open device objects. The Index parameter for OpenDevice() specifies the component on the hardware entity, starting with 0 for each device type.

The method VIBSystem::CloseDevice() closes the device and deletes the object.


VIB::VIBSystem *pVIBSystem = NULL;
VIB::DigitalInput *pDigitalInput = NULL;
// open the factory for the mainboard
// Open the second DigitaInput device on the mainboard
pVIBSystem->OpenDevice(&pDigitalInput, 1);
// Use the device
pDigitalInput->ConfigureDebounceTime(1000, 1000);
// Close the device
// Close the factory
  • Mixing the device's Open() / Close() API with the factory's OpenDevice() / CloseDevice() API is not allowed.
  • Unlike device objects, factory objects can be created multiple times for the same hardware entity simultaneously.
  • After opening a device with the factory, the factory can be closed and the device remains available. The device can be closed by reopening the factory.
  • If a USB device is unplugged, all device indexes remain constant and unique, until all programs have stopped using the library. Therefore, it is possible that a gap is created when a device with a lower number is unplugged.

The factory hides any hardware related implementation details. Therefore, the same programming interface can be used with different hardware platforms and operating systems. To enable generic applications, the available devices can be determined at runtime by calling GetDeviceInfo().

Each hardware entity can provide multiple devices of the same type and each device can have multiple I/O channels.
For example, the VisionBox AGE-X1 has a single CameraTrigger device which controls two output channels.
The VisionBox AGE-X2 "Tiger" has four CameraTrigger devices, but each device has only one output channel.
The number of channels can be requested with CameraTrigger::GetNumberOfOutputs() or similar member functions for other devices.

The following image shows the internal structure of the VisionBox AGE-X2 with a Camera Link interface:

VisionBox AGEX-2

Most devices are controlled by the mainboard hardware entity (SYST_BASEBOARD) which provides the RTCC (FPGA).
The VisionBox additionally includes a Camera Link card. In order to use the CameraLinkIn device, the VIBSystem factory has to be created with the system type SYST_CL.

Also note that the Multiplexer signals are also available to the Camera Link card as signal source for CameraLinkIn::ConfigureCC().
In the opposite direction, the RS-422 input signals are sent to the main FPGA as source for the Multiplexer or other devices.

The following example shows a VisionBox AGEX-4 with three PCIe cards: one Machine Vision Controller and two PoE/ToE cards:

VisionBox AGEX-4

This hardware configuration has four hardware entities. Please note that the mainboard only has a Service device, most devices are controlled by the Machine Vision Controller (SYST_INTERNAL_PCI).


class  VIB::VIBSystem
 The factory for devices. More...
Definition: VIB_Interface.h:110
static bool CreateInstance(VIBSystem **ppVIBSystem)
Creates a factory instance for the mainboard.
Definition: VIBSystem.cpp:105
bool CloseDevice(iDevice *pDevice)
Closes a device.
Definition: VIBSystem.cpp:849
static bool DeleteInstance(VIBSystem *pObj)
Releases the device object.
Definition: VIBSystem.cpp:192
bool ConfigureDebounceTime(unsigned int nsLow, unsigned int nsHigh)
Sets debouncing time for the digital input signals.
Definition: DigitalInput.cpp:227
bool OpenDevice(eDeviceType Type, int Index, iDevice **ppNewDevice)
Opens a device and returns a new device object.
Definition: VIBSystem.cpp:448
This class controls a group of digital input signals.
Definition: VIB_Interface.h:437
The factory for devices.
Definition: VIB_Interface.h:217