What is the correct way to handle the device object lifetime
I have written a class that wraps the RawReader class. I instantiate the reader as described in the documentation by first creating a device, setting all of the hal properties for the device, creating the reader from the device, and returning the reader. In this way I don't keep a copy of the device in the global scope.
Now what happens is that if the camera gets too many events, or if a certain portion of the code takes overly long to process, or for other various reasons, the usb might timeout for otherwise fail to transfer and that crashes my code. To get around this I thought that I could delete the reader and its underlying device and create a new instance, but then I get a usb access error.
So I need to know how to properly disconnect from the device and free the connection such that I can connect to it again. I've purchased a powered usb extension cable so hopefully I'll be able to improve the performance and not run into this issue as much, but it would still be good to know how to manage the device connection.
I've attached my code that wraps the reader and my code that handles the device connection for consideration.
Information
In this Community Forum, you can discuss products, technology and applications. Only registred users can post but everyone can read. To ask a private question, enter a support ticket in My Area
https://support.prophesee.ai/portal/en/newticket