Opening Multiple Devices at the same Time, no stream for 3 Devices

We are trying to Access 4 Dalsa Nanos in one of our Projects and cannot seem to achieve to open more than 1. While we discover all open interfaces and see that the Devices are discovered, we cannot seem to achieve to open more than 1 with DeviceFactory.TryOpen.
See below Code for reference implementation for 2 Devices. First Device is opened regularly, second is opened without a stream.

More Information:
We can open the devices through the GenICamBrowser Tool and acquire Images from each at the same time, but cant seem to do it through Code.

Is there any trick to open multiple Devices or does the current Iteration ov cvb.net not support multiple Devices at the same time?

Code
class Program
    {
        private static string ipAddress1 = "192.168.178.10";
        private static string ipAddress2 = "192.168.178.20";
        private static Device device1;
        private static Device device2;
        static void Main(string[] args)
        {
            var interfaces = DiscoverInterfaces();
            foreach (var iface in interfaces)
            {
                var devices = DiscoverDevicesOnInterface(iface);
                if(devices.Any(x => x[DiscoveryProperties.DeviceIP] == ipAddress1))
                {
                    DeviceFactory.TryOpen(devices.FirstOrDefault(x => x[DiscoveryProperties.DeviceIP] == ipAddress1), out device1);
                }
                if (devices.Any(x => x[DiscoveryProperties.DeviceIP] == ipAddress2))
                {
                    DeviceFactory.TryOpen(devices.FirstOrDefault(x => x[DiscoveryProperties.DeviceIP] == ipAddress2), out device2);
                }
            }
            Console.ReadLine();
        }

        private const DiscoverFlags discoverInterfaces = DiscoverFlags.UpToLevelInterface | DiscoverFlags.IgnoreGevSD;
        private static DiscoveryInformation[] DiscoverInterfaces()
        {
            return DeviceFactory.Discover(discoverInterfaces).Where(info => IsGigEInterface(info) && IsActiveInterface(info)).ToArray();
        }

        private const DiscoverFlags discoverAll = DiscoverFlags.IgnoreVins | DiscoverFlags.IgnoreGevSD | DiscoverFlags.IncludeInaccessible;
        private static DiscoveryInformation[] DiscoverDevicesOnInterface(DiscoveryInformation iface)
        {
            return DeviceFactory.Discover(iface, discoverAll).ToArray();
        }

        private static bool IsGigEInterface(DiscoveryInformation info)
        {
            return info.TryGetProperty(DiscoveryProperties.InterfaceTLType, out var type) && type?.ToUpper() == "GEV";
        }

        private static bool IsActiveInterface(DiscoveryInformation info)
        {
            return info.TryGetProperty(DiscoveryProperties.InterfaceSubNetList, out var subnets) && string.IsNullOrEmpty(subnets) == false;
        }
    }

Hi @MarcelS :slight_smile:

:cvb: definitely supports multiple devices at the same time. I just tested your code and it works fine on my machine.

Could you please explain what exactly you mean by that?
Does the TryOpen() not work, or aren’t you able to start the stream?

1 Like

When i open the first device all NodeMaps are filled and the StreamCollection is filled, which means i can start the Acquisition.
The second one on the other Hand is opened without any Stream in the stream Collection and several Features of the device are not accessable. (2 NodeMaps are missing, no notify Collection,…).
If I Try to reopen the device 2 this wont work either.

Here is an Image of the first device after the call to TryOpen:

Images


Here is an Image of the second Device after the call to TryOpen:

Image

if I Change the order in which the devices are opened, device2 is fully initialized and device1 isn’t.

Device2 as first Device:

Images


Device1 as second Device:

Image

I’ve installed CVB Version 13.01.006 and the Bindings as well.

Allright it looks like this is a bug in the CVFactory.dll.
This will be fixed in the next release (coming very soon…). In the meantime you can use a hot-fixed version, I will send to your mail address right now.
Please replace the old one at C:\Program Files\STEMMER IMAGING\Common Vision Blox and tell me if it helped.

2 Likes

That’s it. Works perfectly fine now. Appreciate the help. Thank you.

1 Like