ClassesClassesClassesClasses | | | | Operators

set_framegrabber_callbackset_framegrabber_callbackSetFramegrabberCallbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallback (Operator)

Name

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

Signature

set_framegrabber_callback( : : AcqHandle, CallbackType, CallbackFunction, UserContext : )

Herror set_framegrabber_callback(const Hlong AcqHandle, const char* CallbackType, const Hlong CallbackFunction, const Hlong UserContext)

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

Herror set_framegrabber_callback(const HTuple& AcqHandle, const HTuple& CallbackType, const HTuple& CallbackFunction, const HTuple& UserContext)

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

void SetFramegrabberCallback(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 HOperatorSetX.SetFramegrabberCallback(
[in] VARIANT AcqHandle, [in] VARIANT CallbackType, [in] VARIANT CallbackFunction, [in] VARIANT UserContext)

void HFramegrabberX.SetFramegrabberCallback(
[in] BSTR CallbackType, [in] Hlong CallbackFunction, [in] Hlong UserContext)

static void HOperatorSet.SetFramegrabberCallback(HTuple acqHandle, HTuple callbackType, HTuple callbackFunction, HTuple userContext)

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

Description

The operator set_framegrabber_callbackset_framegrabber_callbackSetFramegrabberCallbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallback registers a callback function for the image acquisition device specified by AcqHandleAcqHandleAcqHandleAcqHandleAcqHandleacqHandle. The parameter CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction contains a pointer to the function to register, while CallbackTypeCallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackType specifies to which function of the underlying API the callback should be connected.

Suggested values for CallbackTypeCallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackType 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_asyncgrab_image_asyncGrabImageAsyncgrab_image_asyncGrabImageAsyncGrabImageAsync.

Depending on the functionality of the underlying API, additional values for CallbackTypeCallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackType are possible. All actually supported callback types of a specific image acquisition device can be queried by calling get_framegrabber_paramget_framegrabber_paramGetFramegrabberParamget_framegrabber_paramGetFramegrabberParamGetFramegrabberParam 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 CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction will be called. If CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction 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 AcqHandleAcqHandleAcqHandleAcqHandleAcqHandleacqHandle, the second one provides a pointer to interface-specific context data, and the third parameter is a user-specific pointer that is specified in UserContextUserContextUserContextUserContextUserContextuserContext.

Attention

For a multithreaded application all image acquisition operators (as listed in open_framegrabberopen_framegrabberOpenFramegrabberopen_framegrabberOpenFramegrabberOpenFramegrabber) are an own group in which info_framegrabberinfo_framegrabberInfoFramegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabber, open_framegrabberopen_framegrabberOpenFramegrabberopen_framegrabberOpenFramegrabberOpenFramegrabber, close_framegrabberclose_framegrabberCloseFramegrabberclose_framegrabberCloseFramegrabberCloseFramegrabber and close_all_framegrabbersclose_all_framegrabbersCloseAllFramegrabbersclose_all_framegrabbersCloseAllFramegrabbersCloseAllFramegrabbers are executed exclusively.

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

Parallelization

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.

Parameters

AcqHandleAcqHandleAcqHandleAcqHandleAcqHandleacqHandle (input_control, state is modified)  framegrabber HFramegrabber, HTupleHTupleHFramegrabber, HTupleHFramegrabberX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the acquisition device to be used.

CallbackTypeCallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackType (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Callback type.

Default value: 'transfer_end' "transfer_end" "transfer_end" "transfer_end" "transfer_end" "transfer_end"

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

CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction (input_control)  pointer HTupleHTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Pointer to the callback function to be set.

UserContextUserContextUserContextUserContextUserContextuserContext (input_control)  pointer HTupleHTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (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_callbackset_framegrabber_callbackSetFramegrabberCallbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallback returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Possible Predecessors

open_framegrabberopen_framegrabberOpenFramegrabberopen_framegrabberOpenFramegrabberOpenFramegrabber, set_framegrabber_paramset_framegrabber_paramSetFramegrabberParamset_framegrabber_paramSetFramegrabberParamSetFramegrabberParam

Possible Successors

grab_imagegrab_imageGrabImagegrab_imageGrabImageGrabImage, grab_datagrab_dataGrabDatagrab_dataGrabDataGrabData, grab_image_startgrab_image_startGrabImageStartgrab_image_startGrabImageStartGrabImageStart, grab_image_asyncgrab_image_asyncGrabImageAsyncgrab_image_asyncGrabImageAsyncGrabImageAsync, grab_data_asyncgrab_data_asyncGrabDataAsyncgrab_data_asyncGrabDataAsyncGrabDataAsync, get_framegrabber_paramget_framegrabber_paramGetFramegrabberParamget_framegrabber_paramGetFramegrabberParamGetFramegrabberParam

See also

open_framegrabberopen_framegrabberOpenFramegrabberopen_framegrabberOpenFramegrabberOpenFramegrabber, get_framegrabber_callbackget_framegrabber_callbackGetFramegrabberCallbackget_framegrabber_callbackGetFramegrabberCallbackGetFramegrabberCallback

Module

Foundation


ClassesClassesClassesClasses | | | | Operators