Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
Device Discovery - Third Party VIN Driver

Discovering devices using VIN drivers can be done using the Cvb::DeviceFactory::Discover.

The exact details of what each device reports depends on the exact implementation of the VIN driver in question. For more details, refer to the driver documentation.

#include <cvb/device_factory.hpp>
auto discoveredDevices = Cvb::DeviceFactory::Discover(Cvb::DiscoverFlags::IgnoreTLs); // (1)
auto chosenDiscoveryInformation = discoveredDevices[0]; // (2)
auto device = Cvb::DeviceFactory::Open<Cvb::VinDevice>(chosenDiscoveryInformation->AccessToken(), Cvb::AcquisitionStack::PreferVin); // (3)
// Configure device
// Start acquisition and streaming
static std::vector< DiscoveryInformation > Discover()
static std::shared_ptr< T > Open(const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)

using (var discoveredDevices = DeviceFactory.Discover(DiscoverFlags.IgnoreTLs)) // (1)
{
var chosenDiscoveryInformation = discoveredDevices[0]; // (2)
using (var device = (VinDevice)DeviceFactory.Open(chosenDiscoveryInformation, AcquisitionStack.PreferVin)) // (3)
{
// Configure device
// Start acquisition and streaming
}
}
static Device Open(DiscoveryInformation info, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
static DiscoveryInformationList Discover()

import cvb
discoveredDevices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreTLs) # (1)
chosenDiscoveryInformation = discoveredDevices[0] # (2)
with (cvb.VinDevice)cvb.DeviceFactory.open(chosenDiscoveryInformation.access_token, cvb.AcquisitionStack.PreferVin) as device: # (3)
# Configure device
# Start acquisition and streaming
Union[cvb.GenICamDevice, cvb.VinDevice, cvb.EmuDevice, cvb.VideoDevice, cvb.NonStreamingDevice] open(str provider, int acquisition_stack=cvb.AcquisitionStack.PreferVin)
List[cvb.DiscoveryInformation] discover_from_root(int flags=cvb.DiscoverFlags.FindAll, int time_span=300)

Note: Error handling has been omitted from the above example.

  1. Discover all VIN devices. By default all devices are discovered so by using the Cvb::DiscoverFlags::IgnoreTLs flag, the GenTL devices are excluded.
  2. Filter the found discovery information to select the correct one. As the reported data depends on the VIN driver in question, the first is selected for simplicity.
  3. Open the device as a Cvb::VinDevice using Cvb::AcquisitionStack::PreferVin.