I am writing an application (Cvb++, Qt, GenICam) and I would like to present a list of cameras to the user so that the user can chose one of the detected cameras and use it.
Obtaining a list of cameras via Cvb::DeviceFactory::Discover() works nicely; however, I did not find a way to Cvb::DeviceFactory::Open() a specific camera detected.
Is there a way to obtain the Vin driver path (optional, I could of course provide this) and open one of the detected camaras (e.g. via serial number, Id, …)?
Alternatively, is there a way to list the cameras on a vin driver and select one of them?
I would like to avoid having to use an external tool to select the camera to be used.
yes that is safe. It is the intended way (or let the std::shared_ptr run out of scope).
But keep in mind that you have shared ownership with the returned device (std::shared_ptr<Cvb::Device>). That means if you have stored the device std::shared_ptr in multiple places (e.g. objects), the Device is unloaded when the last std::shared_ptr is .reset or runs out of scope.
Regarding inaccessible devices (e.g. opened): if the transport technology supports it, .Discover() filters these out. You can still show them by providing the DiscoverFlags::IncludeInaccessible to the .Discover() call. But you still won’t be able to open the device in a different process.
Also note that if you simply call .Discover(), it is the same as calling .Discover(DiscoverFlags::IgnoreVins | DiscoverFlags::IgnoreGevSD). This is the same as the default Management Console/GenICam Browser output.
Ok, that´s fine then - I can keep track of the number of references to the pointer, I was just afraid there might be copies stored somewhere in the Cvb++ part.