DiscoveryProperties How to access it

Hi,
I am using CVBpy documentation and I see “DiscoveryProperties” that can be queried from DiscoveryInformation. How can I access “DiscoveryProperties”? Currently I am parsing DiscoveryInformation.access_token as JSON since I am not sure how to query it.

discovered_devices_list = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)

for i in range(camera_count):
    json_data = json.loads(discovered_devices_list[i].access_token)

Thanks!
Piotr

Hi Piotr,
you can access the device properties like so:
discovered_devices_list[0].read_property(cvb.DiscoveryProperties.DeviceAccessStatus)
or:
discovered_devices_list[0][cvb.DiscoveryProperties.DeviceAccessStatus]

see: http://help.commonvisionblox.com/API/Python/classcvb_1_1_discovery_information.html#aa35e99f9446ce3e99dde211e751e8921

If you are just looking for any USB camera, you could also do:

# Set a filter to ignore all GigE and CVB specific devices
device_info = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreGevFD
  | cvb.DiscoverFlags.IgnoreVins
  | cvb.DicoverFlags.IgnoreSD)
# There should not be much left except USB 3 Vision devices but you never know...
token = next((info.access_token for info in device_info 
  if "U3V" == info[cvb.DiscoverProperties.DeviceTransportLayerType]), None)
# Finally open it...
device = cvb.DeviceFactory.open(token)

(here are some adjustemnts to avoid missconceptions)

Sorry for my bad formatting, all spaces got removed. Please let me know if you have further questions.
Best Nico

3 Likes

Hi @usernv
I hope you don’t mind me editing your code. It was essentially right, however Discourse offers some formatting options :wink:

1 Like