Grabber::addListener Method

This method registers a callback handler object for the specified events.
Syntax:
void addListener( GrabberListener* pListener, DWORD callback = -1 );
Parameter Description
pListener

Specifies a pointer to the callback handler object that is to be registered. The callback handler object has to be derived from GrabberListener.

callback

Specifies the events that will be handled by the object referred to by pListener. A combination of GrabberListener::tListenerTypes specifies the events. A binary OR is used to combine two or more listener types. It defaults to -1. -1 is the combination of all possible GrabberListener::tListenerTypes.

Remarks:

This method is used to add a GrabberListener object to an internal list of the grabber. If one of the events occur that is defined by GrabberListener::tListenerType, the grabber calls the callback methods of all listener objects in the list that were added for this event. One GrabberListener object may handle more than one event. The parameter callback specifies the set of events that will be handled by the listener object. For possible values of callback, refer to GrabberListener::tListenerType. For more informations about callbacks, refer to GrabberListener.

The GrabberListener::frameReady method will be called, if the sink is a FrameHandlerSink and snap mode is set to false or snap mode is set to true and FrameHandlerSink::snapImages was called.

The GrabberListener::frameReady method will only be called, if a MemBufferCollection is used. To do so, create and set a FrameHandlerSink with at least one image buffer.

Sample:

For an example of how to use the addListener method, see Using a Callback Function.

See also: Grabber, Grabber::removeListener, Grabber::isListenerRegistered, GrabberListener, GrabberListener::tListenerType, GrabberListener::frameReady, FrameHandlerSink, FrameHandlerSink::create, FrameHandlerSink::setSnapMode

<< Grabber