Very slow DISCOVERY

I am trying to detect GEV-cameras on the network but on some machines it is very slow (>20s) but on “normal” machine it is 2s.
Tested with different flags, eg:

    Cvb::DiscoverFlags flags = Cvb::DiscoverFlags::UpToLevelDevice;
    //Cvb::DiscoverFlags::IgnoreVins | Cvb::DiscoverFlags::IncludeInaccessible;
    mDiscoveryList = Cvb::DeviceFactory::Discover(flags);

Any clue why?
Can you force to use a specific network, eg 192.168..?

  1. by setting your interfaces ip inside a specific network, you can only discover devices within that network.
  2. Use a timeout. https://help.commonvisionblox.com/NextGen/14.1/cvbpp/d4/d7c/class_cvb_1_1_device_factory.html#a3fa7741a20c46724070417638fa284c5

We use multiple NIC:s and also switches on our system but the cameras are using 192.168.128.* and 192.168.130.* (on two different NIC:s)…
How can it be used by Discover?

you can discover with the DiscoverFlags.UpToLevelInterface flag
(look up here) and filter interfaces from the access tokens and start a new discovery passing the access_token of the desired interface to the Discover function overload here for a search from level interface.

1 Like

Sorry to say but still takes a looooong time (>20s) to discover the interfaces only:

auto interfaceList = Cvb::DeviceFactory::Discover(Cvb::DiscoverFlags::UpToLevelInterface);

Is there a way to debug/log this?

Did you follow step 2 from this reply?

The timeout? No, but the Discover is fast on other systems!

Is there a quicker way to “ping” a specific camera?
The application will power on the camera and wait for it to be available (“listed”)…

When using the timeout. Do you get the desired results or not?

Sorry, did not try the timeout!

Btw, is there an Open with timeout?

        auto device = Cvb::DeviceFactory::Open<Cvb::GenICamDevice>(devInfoIt->AccessToken(), Cvb::AcquisitionStack::GenTL);

We do not have an Open function with a timeout. This should not be necessary anyway, as CVB raises an exception if the open fails after one try. And this should not take long.

Is there a simple “ping” using the DeviceId (not IP as DHCP is used) to check for a camera?
Our application controls the power to the camera and waits for the camera to be available ~5s (currently by Discover but it is too slow)…

Currently, the AccessToken (from Discover) is used to Open a device/camera…
Can the Device/UserId be used for Open? (Not Serial or IP)

Hi @IngFra
You need to use the token to open the camera. But you can use the given Cvb::DiscoveryInformation from Discover() to choose the right token based on some properties you can access without opening the camera.
e.g. you can access Cvb::DiscoveryProperties::DeviceUsername and Cvb::DiscoveryProperties::DeviceSerialNumber

An Example CVB++ code could look like this:

auto discoveryInformation = Cvb::DeviceFactory::Discover(Cvb::DiscoverFlags::IgnoreGevFD | Cvb::DiscoverFlags::IgnoreVins);
for (auto &deviceInfo : discoveryInformation)
{
  std::string userName;
  if (!deviceInfo.TryGetProperty(Cvb::DiscoveryProperties::DeviceUsername, userName))
  {
    std::cout << "no username readable for current device" << std::endl;
    continue;
  }
  if (userName == "MyCameraName")
  {
    auto device_ = Cvb::DeviceFactory::Open<Cvb::GenICamDevice>(accessToken, Cvb::AcquisitionStack::GenTL);
    break;
  }
}
          

Hmm, the problem is too slow Discover (>20s on a test-system, normally <2s)!
Is there a debug/log etc?