Skip to content

Commit

Permalink
Improved finding devices, e.g. by IP if GenTL provider supports this
Browse files Browse the repository at this point in the history
  • Loading branch information
heikohimu committed Jul 27, 2020
1 parent 73d5a49 commit a65f0a3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rc_genicam_api/interface.cc
Expand Up @@ -236,6 +236,27 @@ std::shared_ptr<Device> Interface::getDevice(const char *devid)
}
}

if (!ret && ifh != 0)
{
// try to open the device in a last attempt to check if the producer is
// able to find it

GenTL::DEV_HANDLE dev=0;

GenTL::GC_ERROR err=gentl->IFOpenDevice(ifh, devid, GenTL::DEVICE_ACCESS_READONLY, &dev);

if (err == GenTL::GC_ERR_SUCCESS)
{
gentl->DevClose(dev);
}

if (err == GenTL::GC_ERR_SUCCESS || err == GenTL::GC_ERR_RESOURCE_IN_USE ||
err == GenTL::GC_ERR_ACCESS_DENIED)
{
ret=std::shared_ptr<Device>(new Device(shared_from_this(), gentl, devid));
}
}

return ret;
}

Expand Down

0 comments on commit a65f0a3

Please sign in to comment.