Closed bth5 closed 1 year ago
Hello,
here is an example on how a camera change handler would work:
import vimba
import time
Camera
instance that changed, the secondDetected
, Reachable
,Unreachable
, and Missing
.def camera_change_callback(cam, event): print(f'Executed user camera_change_callback: {cam}, {str(event)}')
Vimba
singleton to register our callback function and to list our available camerasvmb = vimba.Vimba.get_instance()
vmb.register_camera_change_handler(camera_change_callback)
with vmb: while True:
# access mode for our cameras changes or the number of detected cameras changes, the
# registered callback will be executed automatically. We do not need to do anything here.
cams = vmb.get_all_cameras()
for cam in cams:
print(f'Camera {cam}: {cam.get_permitted_access_modes()}')
# Delay execution so we do not spam the output too much.
time.sleep(1)
I got it working with inspiration from your code, thank you very much!
I have a script where i use async frame acquisition and software trigger (action commands).
I'm trying to add a functionaly where i check the status of the camera connection. I would like to raise an error if the camera got disconnected somehow.
But so far what i've tried doesn't work: inside:
cam.is_streaming doesn't change to false I tried with events, but i didn't get that to work either.
Are there a functionality to register and handle a disconnect?