misterhay / VISCA-IP-Controller

Python code for controlling PTZ cameras using VISCA commands over IP
The Unlicense
82 stars 28 forks source link

Are There any Exit Codes with VISCA? #22

Open dhtseany opened 8 months ago

dhtseany commented 8 months ago

Hi, I was wondering if there's a clean way of having a script wait for the camera to return some sort of "OK (0) " status when the camera is done executing the requested command?

For example, I'm trying to script a solution that sends the VISCA command to the camera, waits for that command to finish executing, and then switches the scene in OBS Studio. Some commands take longer than others to recall and some shots are already in position; perhaps I need to somehow know if the camera is in the middle of moving.

I'm presently using a sleep timer to accomplish this but it sleeps every time regardless, even if I'm going back to an already-framed shot, thus requiring no camera movement, so my scene changes still take 5 seconds when the camera is already framed.

Thanks for an awesome project!

dhtseany commented 8 months ago

I do see that we have a means of fetching the return code from the function _receive_response(self) in camera.py. I'm still working my way through learning Python, can anyone explain how I'd fetch these returned results and use them as a basis of pausing a script until it gives the all-clear? Thanks!