What's the best way to handle camera disconnections in CVB

Please imagine following scenario:
While G2Grab is active, no matter if G2Wait is waiting or not, someone unplugs your networkable where your GigEVision camera is used to be connected to your PC (lets reduce it to GigEVision cameras).

How this can be handled in Common Vision Blox?

Best Greg

1 Like

Hi Greg,

How to do this is documented in Our CVB User Guide for the GenICam Driver and is called Connection Monitoring.
This is the link to our Online Version of the document:
https://help.commonvisionblox.com/NextGen/14.0/md_theory_of_operation_hardware__gen_i_cam__c_v_b__user_guide.html#gcug_chmtopic59

There you also find C++ and a C# example code which shows how to do it.

Hello @Sebastian,
thank you for your quick answer. Actually, my question was not about how to get informed about disconnections or reconnection, but more how to handle these events, even if these notifications be useful.
So may question was more related to the behaviour of G2Wait(), does it return immediately, what is the error code in this case, do I need to call G2Freeze(), etc…

Thank you very much in advance.

Cheers

Hi Greg,

OK, I understand.

You should call G2Freeze() when a disconnect was detected. Then G2Wait returns with a CVC_E_GRABABORTED error. If you do not call G2Freeze() in time the G2Wait will return with a CVC_E_TIMEOUT error.

Beyond that i realized that the current Online Help is wrong with one statement: You do not need to reload the driver when the reconnected event is fired. You only need to start the grab.

One more thing which is important with the callbacks and the G2Grab Interface functions: You should not call G2Freeze() and G2Grab() within the callback itself. These functions need to be called in another thread context. The callback functions should only be used to inform the thread which controls the acquisition that it need to be stopped or started.