Class: GrabbaFingerprint

GrabbaFingerprint

Access this class via grabba.fingerprint

Constructor

new GrabbaFingerprint()

Access Grabba fingerprint reading capabilities through grabba.fingerprint

Members

ImageType

Grabba fingerprint image types.
Properties:
Name Type Description
NO_IMAGE int No image.
IMG_NO_COMPRESSION int Image without compression.
IMG_V1_COMPRESSION int Image with Sagem MorphoSmart(TM) Compression.
IMG_WSQ_COMPRESSION int Image with Wavelets Scalar Quantisation Compression.
IMG_PREVIEW int Preview image.
UNKNOWN int Unknown image.

preferences :GrabbaFingerprintPreferences

Grabba fingerprint preference identifiers.
Type:

preferences :GrabbaProxcardPreferences

Grabba proxcard preference identifiers.
Type:

TemplateType

Grabba fingerprint template types.
Properties:
Name Type Description
ISO_PK_DATA_ANSI_378 int ANSI INCITS 378-2004 Template.
ISO_PK_DATA_FMC_CS int ISO/IEC 19794-2 Finger Minutiae Card Record, Compact Size.
ISO_PK_DATA_FMC_NS int ISO/IEC 19794-2 Finger Minutiae Card Record, Normal Size.
ISO_PK_DATA_FMR int ISO/IEC 19794-2 Finger Minutiae Record.
ISO_PK_DATA_MINEX_A int MINEX A Specification (Restricted ANSI INCITS 378-2004) Template.
NO_TEMPLATE int No template.
PK_COMP_V2 int Sagem Compressed Template.
PK_COMP_V2_NORM int Sagem Compressed Template (Normalised).
PK_DIN_V66400 int DIN V66400 fingerprint template which complies with the DIN-V66400 Compact Size.
PK_MAT int Sagem Uncompressed Template
PK_MAT_NORM int Sagem Uncompressed Template (Normalised)
UNKNOWN int Unknown template.

UserMessageType

Grabba fingerprint user message types
Properties:
Name Type Description
PLACE_YOUR_FINGER int Place your finger
MOVE_UP int Move up
MOVE_DOWN int Move down
MOVE_LEFT int Move left
MOVE_RIGHT int Move right
PRESS_HARDER int Press harder
MOVE_YOUR_FINGER int Move your finger
REMOVE_YOUR_FINGER int Remove your finger
ACQUISITION_COMPLETE int Acquisition complete
IMAGE_MESSAGE int Image message
PLACE_FINGER_ACQUISITION int Place finger for acquisition
PLACE_1ST_FINGER_FOR_ACQUISITION int Place 1st finger for acquisition
PLACE_2ND_FINGER_FOR_ACQUISITION int Place 2nd finger for acquisition
MATCH_SUCCESSFUL int Match successful
MATCH_UNSUCCESSFUL_NOT_SAME_FINGER int Match unsuccessful, not same finger
MATCH_UNSUCCESSFUL_DATABASE_EMPTY int Match unsuccessful, database empty
MATCH_UNSUCCESSFUL_FALSE_FINGER_DETECTED int Match unsuccessful, false finger detected
MATCH_UNSUCCESSFUL_MOIST_FINGER int Match unsuccessful, finger too moist or scanner is wet
ERROR_ALREADY_ENROLLED int This user is already enrolled
ERROR_INVALID_USER_ID int The user ID is invalid
ERROR_INVALID_USER_DATA int The user data is invalid
IMAGE_PROGRESS int Image progress message
IMAGE_DETECT_QUALITY int Image detect quality message
IMAGE_CODE_QUALITY int Image code quality message
ERROR_TIMEOUT int Timed out
ERROR_SAME_FINGER int Same finger detected
ERROR_NO_DATABASE int Local database was not found
ERROR_COMMAND_IN_PROGRESS int Command currently in progress
ERROR_DATABASE_FULL int Local database is full
ERROR_ILV int Received ILV error
ERROR_NOT_SUPPORTED int This function is not supported on this device
ERROR_INVALID_TEMPLATE int Invalid template identifier

Methods

abort(onError)

Abort the current fingerprint operation.
This function only applies to fingerprint operations which utilise the fingerprint sensor.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
Example
//A button to abort the current fingerprint operation.
<button onclick="grabba.fingerprint.abort(onError)">Abort fingerprint operation</button>

clearFingerprintDatabase(onError)

Clear the local fingerprint database.
Warning: This is not reversible.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
Example
//A button which clears the local fingerprint database
 <button onclick="grabba.fingerprint.clearFingerprintDatabase(onError)">Clear database</button>

compareTemplates(onSuccess, onError, inputTemplate, Array, templateTypeInt)

Compare an input template with a list of fingerprint templates (maximum 20).
This operation may take some time to complete depending on the number of templates provided.
Note: This function is only available for iOS and Android so far.
Parameters:
Name Type Description
onSuccess function Called on success with the following parameters:
{int} an integer representing the index of the matched user record if a match is found, otherwise -1.
onError function Called on error with the following parameters:
{String} error description.
inputTemplate Array.<int> Array of integers representing template data bytes.
Array Array.<Array.<int>> of array of integers representing a list of the template data bytes (maximum 20)
templateTypeInt int TemplateType requested.
Example
//A function that store the return value.
var successMatch = function (result) {
//result is the return value of the position in the template list where the matched is successful
$("#fingerprintInfo2").text(result);
};

convertImageToBase64(onSuccess, onError, image)

Convert image data to a base64 string with a "data:image/png;base64," header, ready for presentation.
Parameters:
Name Type Description
onSuccess function Called on success with the following parameters:
{String} png image data encoded as a base64 String with "data:image/png;base64," header, ready for use as image source.
onError function Called on error with the following parameters:
{String} error description.
image type Image object returned by imageDataEvent fingerprint callback.
See:
Example
//Display the image data after receiving it in a fingerprint callback
 var fingerprintCallbacks = {
     templateDataEvent: function(template) {
     },
     imageDataEvent: function(image) {
         grabba.fingerprint.convertImageToBase64(fingerprintDecoderCallback, onError, image);
     },
     userMessageEvent: function(message, number, total){
     }
 };

 //Callback used in the image data event to set the fingerprint image to a document element.
 var fingerprintDecoderCallback = function (imageBase64){
         document.getElementById("fingerprintImage").src = imageBase64;
 };

enrolFingerprint(onError, templateTypeInt, imageTypeInt, numAcquisitions, numFingers)

Capture a fingerprint for fingerprint template or image data.
To receive the fingerprint events and data, first register for callbacks using GrabbaFingerprint#registerCallback.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
templateTypeInt int TemplateType requested.
imageTypeInt int ImageType requested.
numAcquisitions int Number of acquisitions requested - this must be 1 or 3.
numFingers int Number of fingers to capture.
See:
Example
//A button which captures a fingerprint template (Sagem Uncompressed Template) and an image without compression.
<button onclick="grabba.fingerprint.enrolFingerprint(onError, grabba.fingerprint.TemplateType.PK_MAT, grabba.fingerprint.ImageType.IMG_NO_COMPRESSION, 1, 1)">Capture fingerprint</button>

enrolFingerprintToDatabase(onError, templateTypeInt, imageTypeInt, numFingers, userID, userData)

Capture a fingerprint for fingerprint template or image data and enrol it into the local database on the Grabba.
To receive the fingerprint events and data, first register for callbacks using GrabbaFingerprint#registerCallback.
This command will always request three acquisitions as a requirement of the local database.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
templateTypeInt int TemplateType requested.
imageTypeInt int ImageType requested.
numFingers int Number of fingers to capture - either 1 or 2, for each user.
userID String The user ID for the record stored in the database.
This is retrieved upon a successful match in the identify process. It must be less than or equal to 24 characters.
userData Array.<int> A byte array of additional user data to be stored. Maximum size is 64 bytes.
See:
Example
//A button which enrols a user, tester, with the data 0x01, 0x02, 0x03 and requests a fingerprint template (Sagem Uncompressed Template) in the process.
<button onclick="grabba.fingerprint.enrolFingerprintToDatabase(onError, grabba.fingerprint.TemplateType.PK_MAT, grabba.fingerprint.ImageType.IMG_PREVIEW, 1, 'tester', [1, 2, 3])">Enrol To Local Database</button>

identifyFingerprint(onError)

Identifies a user that is enrolled in the local fingerprint database on the Grabba.
To receive the fingerprint events and data, first register for callbacks using GrabbaFingerprint#registerCallback.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
Example
//A button which starts an identify fingerprint in the local database process.
<button onclick="grabba.fingerprint.identifyFingerprint(onError)">Identify in local database</button>

isSupported(onSuccess, onError)

Determines if the currently connected Grabba supports fingerprint reading functionality.
Parameters:
Name Type Description
onSuccess function Called on success with the following parameters:
{boolean} Boolean indicating if GrabbaFingerprint is supported.
onError function Called on error with the following parameters:
{String} error description.
Example
//Button to check if the connected Grabba supports fingerprinting functionality.
 <button onclick="grabba.fingerprint.isSupported(function(supported){
 alert('Grabba fingerprint supported is ' + supported);
 },
 function(errorString) {
     alert('on error ' + errorString);
 });">Is fingerprint supported?</button>

registerCallback(callback, onError)

Register callbacks for fingerprint related events.
If no callbacks are passed to this function, all present callbacks will be cleared.
Parameters:
Name Type Description
callback Object An object which implements the following functions:
templateDataEvent : function(template){}
Called when a fingerprint template is captured.
The returned object contains properties as follows:
{Array.<int>} template.data Template data
{String} template.type String representation of the TemplateType.
{int} template.typeInt TemplateType of the template returned.

imageDataEvent : function(image){}
Called when a fingerprint image is captured.
The returned object contains properties as follows:
{Array.<int>} image.data Image data.
{int} image.numRows Number of rows in the image.
{int} image.numColumns Number of columns in the image.
{String} image.type String representation of the image type.
{int} image.typeInt Integer representation of the image type.

userMessageEvent : function(message){}
Called when a fingerprint event occurs.
The returned object contains variables as follows:
{String} message.text User message text.
{int} message.id User message ID integer.
{int} message.number Scan count in an enrolment/verify procedure or the progress for an image progress message.
{int} message.total Total number of scans that will occur for the enrolment or verify procedure.
{Object} message.userRecord This is a user record object associated with a successful match in an identify function call.
This object contains the following properties:
{userRecord.userID} Database user ID of the user record.
{userRecord.userData} User record data.
onError function Called on error with the following parameters:
{String} error description.
Example
//Callbacks to alert the user of the template data type, display the image and user message text.
 var fingerprintCallbacks = {
     templateDataEvent: function(template) {
         alert('Template data event \n' + 'Template type: ' + template.type);
     },
     imageDataEvent: function(image) {
         grabba.fingerprint.convertImageToBase64(fingerprintDecoderCallback, onError, image);
     },
     userMessageEvent: function(message, number, total){
         document.getElementById("fingerprintMessage").innerHTML = message.text;
     }
 };

 //Callback used in the image data event to set the fingerprint image to a document element.
 var fingerprintDecoderCallback = function (imageBase64){
         document.getElementById("fingerprintImage").src = imageBase64;
 };

resetFingerprintDatabase(onError)

Clear and reset the local fingerprint database.
Warning: This is not reversible.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
Example
//A button which resets the local database
 <button onclick="grabba.fingerprint.resetFingerprintDatabase(onError)">Reset database</button>

verifyFingerprint(onError, templateData, templateTypeInt)

Verify the fingerprint presented against a fingerprint template.
Parameters:
Name Type Description
onError function Called on error with the following parameters:
{String} error description.
templateData Array.<int> Array of integers representing template data bytes.
templateTypeInt int TemplateType of the template data.
Example
//Callback used to verify a fingerprint template after receiving it in the templateDataEvent
     var fingerprintCallbacks = {
         templateDataEvent: function(template) {
         grabba.fingerprint.verifyFingerprint(onError, template.data, template.typeInt);
     },
     imageDataEvent: function(image) {
     },
     userMessageEvent: function(message, number, total, userRecord){
     }
 };