Device enumeration#

One of the key functionalities of the system is to enumerate and provide usable devices to the client code. Opto Engineering devices are controlled via the IDevice interface.

Warning

The maximum number of enumerated devices is 255. The maximum number of simultaneously created devices is 50.

Enumerate all available devices#

The quickest way to be up and running is to make the system look for devices across all network interfaces available. The result of the enumeration performed by the system is a list of DeviceInfo containing useful information about available devices. To start using a specific device, the client code must pick the proper DeviceInfo and provide it to the system so that it can create the device instance.

Warning

The client code is responsible for device instances lifetime. The client code must destroy the device instances when they are no longer required.

//Look for connected devices across all network interfaces on the host.
//Stop the enumeration after an elapsed time of 700 milliseconds.
Itala::DeviceInfoList deviceInfos = pSystem->EnumerateDevices(700);
Itala::DeviceInfo firstDeviceInfo = deviceInfos[0];

std::cout << "First device found is: " << firstDeviceInfo.SerialNumber() << std::endl;

Itala::IDevice* pDevice = pSystem->CreateDevice(firstDeviceInfo);

//Use the device

pDevice->Dispose();
pDevice = nullptr;

Enumerate devices under specific network interfaces#

A more precise enumeration can be performed by specifing a target network interface. The proper InterfaceInfo data must be passed to the system to specify under which interface the device enumeration must be performed. To obtain the list of InterfaceInfo, an interface enumeration must be accomplished, via EnumerateInterfaces().

//Look for available network interfaces on the host.
Itala::InterfaceInfoList interfaceInfos = pSystem->EnumerateInterfaces();
Itala::InterfaceInfo firstInterfaceInfo = interfaceInfos[0];

std::cout << "First interface found is " << firstInterfaceInfo.DisplayName() << std::endl;

//Looks for connected devices under the specified interface.
//Stops the enumeration after an elapsed time of 700 milliseconds.
Itala::DeviceInfoList deviceInfos = pSystem->EnumerateDevices(firstInterfaceInfo, 700);
Itala::DeviceInfo firstDeviceInfo = deviceInfos[0];

std::cout << "First device found under " << firstInterfaceInfo.DisplayName()
   << " is: " << firstDeviceInfo.SerialNumber() << std::endl;

Itala::IDevice* pDevice = pSystem->CreateDevice(firstDeviceInfo);

//Use the device

pDevice->Dispose();
pDevice = nullptr;