Base class for receiving events related to the fingerprint reader on a Grabba device.
The following events are supported by this class:
Each event may invoke callbacks in two ways:
By default, each listener object will receive event notifications from the driver for its entire lifetime; the enable() and disable() methods may be used if control is required over whether notifications are received.
The default behaviour for each event, if not overridden, on an enabled listener object is as follows:
Overrides need not call the superclass' equivalent method unless it is necessary to preserve the delegation (i.e. to support both subclassing and delegation from a single object).
Thread safety: This class is intended to be thread-safe; any classes deriving from it should ensure that the relevant methods are callable from any thread.
Public Member Functions | |
FingerprintListener () | |
Default constructor - builds a listener object then enables receipt of events from the driver. | |
FingerprintListener (boolean startEnabled) | |
Constructor - builds a listener object then optionally enables receipt of events from the driver. More... | |
void | completionEvent () |
Callback which is invoked when an asynchronous fingerprint operation completes successfully. More... | |
final void | disable () |
Disable receipt of events from the driver by this object. More... | |
final void | enable () |
Enable receipt of events from the driver by this object. More... | |
void | errorEvent (@NonNull ErrorCode error) |
Callback which is invoked when an asynchronous fingerprint operation fails to complete. More... | |
void | imageEvent (@NonNull FingerprintImage image) |
Callback which is invoked when fingerprint image data is returned. More... | |
final void | setDelegate (Delegate newDelegate) |
Set the delegate which will receive event callbacks if default listener behaviour is not overridden. More... | |
void | templateEvent (@NonNull FingerprintTemplate templ) |
Callback which is invoked when fingerprint template data is returned. More... | |
void | userMessageEvent (@NonNull FingerprintUserMessage message) |
Callback which is invoked when there is a user message to display. More... | |
FingerprintListener | ( | boolean | startEnabled | ) |
Constructor - builds a listener object then optionally enables receipt of events from the driver.
startEnabled | If set, the listener object is enabled immediately (equivalent of default constructor), otherwise it is disabled until the first call to enable() |
void completionEvent | ( | ) |
Callback which is invoked when an asynchronous fingerprint operation completes successfully.
Each asynchronous operation will trigger either this or errorEvent (but not both) immediately prior to termination, providing the listener object is enabled.
Override this method to receive callbacks when the object is enabled (at construction or via enable()) and the event is triggered.
Implements FingerprintInterface.
|
inherited |
Disable receipt of events from the driver by this object.
This has no effect if the object was already disabled.
|
inherited |
Enable receipt of events from the driver by this object.
This has no effect if the object was already enabled.
void errorEvent | ( | @NonNull ErrorCode | error | ) |
Callback which is invoked when an asynchronous fingerprint operation fails to complete.
Each asynchronous operation will trigger either this or completionEvent (but not both) immediately prior to termination, providing the listener object is enabled.
Override this method to receive callbacks when the object is enabled (at construction or via enable()) and the event is triggered.
error | Details of the error which was detected |
Implements FingerprintInterface.
void imageEvent | ( | @NonNull FingerprintImage | image | ) |
Callback which is invoked when fingerprint image data is returned.
This event will be triggered by the driver when a fingerprint image is received by the driver, providing the listener object is enabled.
Override this method to receive callbacks when the object is enabled (at construction or via enable()) and the event is triggered.
image | Captured fingerprint image data, plus associated metadata |
Implements FingerprintInterface.
|
inherited |
Set the delegate which will receive event callbacks if default listener behaviour is not overridden.
Delegation may alternatively be disabled by providing a null reference here.
newDelegate | If null, disables delegation; if non-null, enables delegation and sets the delegate to the supplied object. |
void templateEvent | ( | @NonNull FingerprintTemplate | templ | ) |
Callback which is invoked when fingerprint template data is returned.
This event will be triggered by the driver when a fingerprint template is received, providing the listener object is enabled.
Override this method to receive callbacks when the object is enabled (at construction or via enable()) and the event is triggered.
templ | Captured fingerprint template data, plus associated metadata |
Implements FingerprintInterface.
void userMessageEvent | ( | @NonNull FingerprintUserMessage | message | ) |
Callback which is invoked when there is a user message to display.
This event will be triggered by the driver when a user message is generated by the driver, providing the listener object is enabled.
Override this method to receive callbacks when the object is enabled (at construction or via enable()) and the event is triggered.
message | Message which needs to be displayed |
Implements FingerprintInterface.