Skip to content

set_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callbackT_set_framegrabber_callback🔗

Short description🔗

set_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callbackT_set_framegrabber_callback — Register a callback function for an image acquisition device.

Signature🔗

set_framegrabber_callback( framegrabber AcqHandle, string CallbackType, pointer CallbackFunction, pointer UserContext )void SetFramegrabberCallback( const HTuple& AcqHandle, const HTuple& CallbackType, const HTuple& CallbackFunction, const HTuple& UserContext )static void HOperatorSet.SetFramegrabberCallback( HTuple acqHandle, HTuple callbackType, HTuple callbackFunction, HTuple userContext )def set_framegrabber_callback( acq_handle: HHandle, callback_type: str, callback_function: int, user_context: int ) -> None

Herror T_set_framegrabber_callback( const Htuple AcqHandle, const Htuple CallbackType, const Htuple CallbackFunction, const Htuple UserContext )

void HFramegrabber::SetFramegrabberCallback( const HString& CallbackType, void* CallbackFunction, void* UserContext ) const

void HFramegrabber::SetFramegrabberCallback( const char* CallbackType, void* CallbackFunction, void* UserContext ) const

void HFramegrabber::SetFramegrabberCallback( const wchar_t* CallbackType, void* CallbackFunction, void* UserContext ) const (Windows only)

void HFramegrabber.SetFramegrabberCallback( string callbackType, IntPtr callbackFunction, IntPtr userContext )

Description🔗

The operator set_framegrabber_callbackSetFramegrabberCallback registers a callback function for the image acquisition device specified by AcqHandleacqHandleacq_handle. The parameter CallbackFunctioncallbackFunctioncallback_function contains a pointer to the function to register, while CallbackTypecallbackTypecallback_type specifies to which function of the underlying API the callback should be connected.

Suggested values for CallbackTypecallbackTypecallback_type are:

  • ‘exception’: The image acquisition has raised an exception.

  • ‘exposure_end’: The exposure of the next image has been finished.

  • ‘exposure_start’: The exposure of the next image has been started.

  • ‘transfer_end’: A new image is ready to be fetched by grab_image_asyncGrabImageAsync.

Depending on the functionality of the underlying API, additional values for CallbackTypecallbackTypecallback_type are possible. All actually supported callback types of a specific image acquisition device can be queried by calling get_framegrabber_paramGetFramegrabberParam 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 CallbackFunctioncallbackFunctioncallback_function will be called. If CallbackFunctioncallbackFunctioncallback_function 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)

The first parameter of the callback function contains the handle to the image acquisition device passed in AcqHandleacqHandleacq_handle, the second one provides a pointer to interface-specific context data, and the third parameter is a user-specific pointer that is specified in UserContextuserContextuser_context.

Attention🔗

For a multithreaded application, info_framegrabberInfoFramegrabber, open_framegrabberOpenFramegrabber, and close_framegrabberCloseFramegrabber are executed exclusively.

set_framegrabber_callbackSetFramegrabberCallback runs in parallel with all non-exclusive operators inside and outside of this group.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

AcqHandleacqHandleacq_handle (input_control, state is modified) framegrabber → (handle)HTuple (HHandle)HFramegrabber, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the acquisition device to be used.

CallbackTypecallbackTypecallback_type (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Callback type.

Default: 'transfer_end'"transfer_end"
Suggested values: 'exception', 'exposure_end', 'exposure_start', 'transfer_end'"exception", "exposure_end", "exposure_start", "transfer_end"

CallbackFunctioncallbackFunctioncallback_function (input_control) pointer → (integer)HTuple (Hlong)HTuple (IntPtr)intHtuple (Hlong)

Pointer to the callback function to be set.

UserContextuserContextuser_context (input_control) pointer → (integer)HTuple (Hlong)HTuple (IntPtr)intHtuple (Hlong)

Pointer to user-specific context data.

Result🔗

If the image acquisition device is open and the specified callback was registered successfully, the operator set_framegrabber_callbackSetFramegrabberCallback returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

open_framegrabberOpenFramegrabber, set_framegrabber_paramSetFramegrabberParam

Possible successors

grab_imageGrabImage, grab_dataGrabData, grab_image_startGrabImageStart, grab_image_asyncGrabImageAsync, grab_data_asyncGrabDataAsync, get_framegrabber_paramGetFramegrabberParam

See also

open_framegrabberOpenFramegrabber, get_framegrabber_callbackGetFramegrabberCallback

Module🔗

Foundation