Operators |
set_framegrabber_callback — Register a callback function for an image acquisition device.
set_framegrabber_callback( : : AcqHandle, CallbackType, CallbackFunction, UserContext : )
The operator set_framegrabber_callback registers a callback function for the image acquisition device specified by AcqHandle. The parameter CallbackFunction contains a pointer to the function to register, while CallbackType specifies to which function of the underlying API the callback should be connected.
Suggested values for CallbackType are:
The image acquisition has raised an exception.
The exposure of the next image has been finished.
The exposure of the next image has been started.
A new image is ready to be fetched by grab_image_async.
Depending on the functionality of the underlying API, additional values for CallbackType are possible. All actually supported callback types of a specific image acquisition device can be queried by calling get_framegrabber_param with the parameter 'available_callback_types'. For more details see the documentation of the specific image acquisition interface.
Once the callback is registered, on every occurrence of the underlying event (e.g., the notification that the exposure has finished) the specified callback function CallbackFunction will be called. If CallbackFunction is set to NULL, the corresponding callback will be unregistered.
The signature of the callback function is the following:
Herror HAcqCallback(void *AcqHandle, void *Context, void *UserContext)On Windows 32 bit systems, the __stdcall naming convention is used:
Herror (__stdcall HAcqCallback)(void *AcqHandle, void *Context, void *UserContext)
The first parameter of the callback function contains the handle to the image acquisition device passed in AcqHandle, the second one provides a pointer to interface-specific context data, and the third parameter is a user-specific pointer that is specified in UserContext.
For a multithreaded application all image acquisition operators (as listed in open_framegrabber) are an own group in which info_framegrabber, open_framegrabber, close_framegrabber and close_all_framegrabbers are executed exclusively.
set_framegrabber_callback runs in parallel with all non-exclusive operators inside and outside of this group.
This operator modifies the state of the following input parameter:
The value of this parameter may not be shared across multiple threads without external synchronization.Handle of the acquisition device to be used.
Callback type.
Default value: 'transfer_end'
Suggested values: 'exception' , 'exposure_end' , 'exposure_start' , 'transfer_end'
Pointer to the callback function to be set.
Pointer to user-specific context data.
If the image acquisition device is open and the specified callback was registered successfully, the operator set_framegrabber_callback returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.
open_framegrabber, set_framegrabber_param
grab_image, grab_data, grab_image_start, grab_image_async, grab_data_async, get_framegrabber_param
open_framegrabber, get_framegrabber_callback
Foundation
Operators |