Enumerations | |
enum | fp_enroll_result { FP_ENROLL_COMPLETE = 1, FP_ENROLL_FAIL, FP_ENROLL_PASS, FP_ENROLL_RETRY = 100, FP_ENROLL_RETRY_TOO_SHORT, FP_ENROLL_RETRY_CENTER_FINGER, FP_ENROLL_RETRY_REMOVE_FINGER } |
Enrollment result codes returned from fp_enroll_finger(). More... | |
enum | fp_verify_result { FP_VERIFY_NO_MATCH = 0, FP_VERIFY_MATCH = 1, FP_VERIFY_RETRY = FP_ENROLL_RETRY, FP_VERIFY_RETRY_TOO_SHORT = FP_ENROLL_RETRY_TOO_SHORT, FP_VERIFY_RETRY_CENTER_FINGER = FP_ENROLL_RETRY_CENTER_FINGER, FP_VERIFY_RETRY_REMOVE_FINGER = FP_ENROLL_RETRY_REMOVE_FINGER } |
Verification result codes returned from fp_verify_finger(). More... | |
Functions | |
fp_dev * | fp_dev_open (struct fp_dscv_dev *ddev) |
Opens and initialises a device. | |
void | fp_dev_close (struct fp_dev *dev) |
Close a device. | |
fp_driver * | fp_dev_get_driver (struct fp_dev *dev) |
Get the driver for a fingerprint device. | |
int | fp_dev_get_nr_enroll_stages (struct fp_dev *dev) |
Gets the number of enroll stages required to enroll a fingerprint with the device. | |
uint32_t | fp_dev_get_devtype (struct fp_dev *dev) |
Gets the devtype for a device. | |
int | fp_dev_supports_print_data (struct fp_dev *dev, struct fp_print_data *data) |
Determines if a stored print is compatible with a certain device. | |
int | fp_dev_supports_dscv_print (struct fp_dev *dev, struct fp_dscv_print *data) |
Determines if a discovered print appears to be compatible with a certain device. | |
int | fp_dev_supports_imaging (struct fp_dev *dev) |
Determines if a device has imaging capabilities. | |
int | fp_dev_supports_identification (struct fp_dev *dev) |
Determines if a device is capable of identification through fp_identify_finger() and similar. | |
int | fp_dev_img_capture (struct fp_dev *dev, int unconditional, struct fp_img **image) |
Captures an image from a device. | |
int | fp_dev_get_img_width (struct fp_dev *dev) |
Gets the expected width of images that will be captured from the device. | |
int | fp_dev_get_img_height (struct fp_dev *dev) |
Gets the expected height of images that will be captured from the device. | |
int | fp_enroll_finger_img (struct fp_dev *dev, struct fp_print_data **print_data, struct fp_img **img) |
Performs an enroll stage. | |
int | fp_verify_finger_img (struct fp_dev *dev, struct fp_print_data *enrolled_print, struct fp_img **img) |
Performs a new scan and verify it against a previously enrolled print. | |
int | fp_identify_finger_img (struct fp_dev *dev, struct fp_print_data **print_gallery, size_t *match_offset, struct fp_img **img) |
Performs a new scan and attempts to identify the scanned finger against a collection of previously enrolled fingerprints. | |
static int | fp_enroll_finger (struct fp_dev *dev, struct fp_print_data **print_data) |
Performs an enroll stage. | |
static int | fp_verify_finger (struct fp_dev *dev, struct fp_print_data *enrolled_print) |
Performs a new scan and verify it against a previously enrolled print. | |
static int | fp_identify_finger (struct fp_dev *dev, struct fp_print_data **print_gallery, size_t *match_offset) |
Performs a new scan and attempts to identify the scanned finger against a collection of previously enrolled fingerprints. |
Some devices require the user to scan their finger multiple times in order to complete the enrollment process. libfprint must return control to your application inbetween each scan in order for your application to instruct the user to swipe their finger again. Each scan is referred to as a stage, so a device that requires 3 scans for enrollment corresponds to you running 3 enrollment stages using libfprint.
The fp_dev_get_nr_enroll_stages() function can be used to find out how many enroll stages are needed.
In order to complete an enroll stage, you call an enroll function such as fp_enroll_finger(). The return of this function does not necessarily indicate that a stage has completed though, as the user may not have produced a good enough scan. Each stage may have to be retried several times.
The exact semantics of the enroll functions are described in the fp_enroll_finger() documentation. You should pay careful attention to the details.
However, you must be aware that not all hardware supported by libfprint operates like this. Most hardware does operate simply by sending fingerprint images to the host computer for further processing, but some devices do all fingerprint processing in hardware and do not present images to the host computer.
You can use fp_dev_supports_imaging() to see if image capture is possible on a particular device. Your application must be able to cope with the fact that libfprint does support regular operations (e.g. enrolling and verification) on some devices which do not provide images.
The only reason you may be interested in retrieving the devtype for a device is for the purpose of checking if some print data is compatible with a device. libfprint uses the devtype as one way of checking that the print you are verifying is compatible with the device in question - the devtypes must be equal. This effectively allows drivers to support more than one type of device where the data from each one is not compatible with the other. Note that libfprint does provide you with helper functions to determine whether a print is compatible with a device, so under most circumstances, you don't have to worry about devtypes at all.
enum fp_enroll_result |
Enrollment result codes returned from fp_enroll_finger().
Result codes with RETRY in the name suggest that the scan failed due to user error. Applications will generally want to inform the user of the problem and then retry the enrollment stage. For more info on the semantics of interpreting these result codes and tracking enrollment process, see Enrolling.
enum fp_verify_result |
Verification result codes returned from fp_verify_finger().
Return codes are also shared with fp_identify_finger(). Result codes with RETRY in the name suggest that the scan failed due to user error. Applications will generally want to inform the user of the problem and then retry the verify operation.
struct fp_dev* fp_dev_open | ( | struct fp_dscv_dev * | ddev | ) |
Opens and initialises a device.
This is the function you call in order to convert a discovered device into an actual device handle that you can perform operations with.
ddev | the discovered device to open |
void fp_dev_close | ( | struct fp_dev * | dev | ) |
Close a device.
You must call this function when you are finished using a fingerprint device.
dev | the device to close. If NULL, function simply returns. |
struct fp_driver* fp_dev_get_driver | ( | struct fp_dev * | dev | ) |
Get the driver for a fingerprint device.
dev | the device |
int fp_dev_get_nr_enroll_stages | ( | struct fp_dev * | dev | ) |
Gets the number of enroll stages required to enroll a fingerprint with the device.
dev | the device |
uint32_t fp_dev_get_devtype | ( | struct fp_dev * | dev | ) |
int fp_dev_supports_print_data | ( | struct fp_dev * | dev, | |
struct fp_print_data * | data | |||
) |
Determines if a stored print is compatible with a certain device.
dev | the device | |
data | the stored print |
int fp_dev_supports_dscv_print | ( | struct fp_dev * | dev, | |
struct fp_dscv_print * | data | |||
) |
Determines if a discovered print appears to be compatible with a certain device.
dev | the device | |
data | the discovered print |
int fp_dev_supports_imaging | ( | struct fp_dev * | dev | ) |
Determines if a device has imaging capabilities.
If a device has imaging capabilities you are able to perform imaging operations such as retrieving scan images using fp_dev_img_capture(). However, not all devices are imaging devices - some do all processing in hardware. This function will indicate which class a device in question falls into.
dev | the fingerprint device |
int fp_dev_supports_identification | ( | struct fp_dev * | dev | ) |
Determines if a device is capable of identification through fp_identify_finger() and similar.
Not all devices support this functionality.
dev | the fingerprint device |
int fp_dev_img_capture | ( | struct fp_dev * | dev, | |
int | unconditional, | |||
struct fp_img ** | image | |||
) |
Captures an image from a device.
The returned image is the raw image provided by the device, you may wish to standardize it.
If set, the unconditional
flag indicates that the device should capture an image unconditionally, regardless of whether a finger is there or not. If unset, this function will block until a finger is detected on the sensor.
dev | the device | |
unconditional | whether to unconditionally capture an image, or to only capture when a finger is detected | |
image | a location to return the captured image. Must be freed with fp_img_free() after use. |
int fp_dev_get_img_width | ( | struct fp_dev * | dev | ) |
Gets the expected width of images that will be captured from the device.
This function will return -1 for devices that are not imaging devices. If the width of images from this device can vary, 0 will be returned.
dev | the device |
int fp_dev_get_img_height | ( | struct fp_dev * | dev | ) |
Gets the expected height of images that will be captured from the device.
This function will return -1 for devices that are not imaging devices. If the height of images from this device can vary, 0 will be returned.
dev | the device |
int fp_enroll_finger_img | ( | struct fp_dev * | dev, | |
struct fp_print_data ** | print_data, | |||
struct fp_img ** | img | |||
) |
Performs an enroll stage.
See Enrolling for an explanation of enroll stages.
If no enrollment is in process, this kicks of the process and runs the first stage. If an enrollment is already in progress, calling this function runs the next stage, which may well be the last.
A negative error code may be returned from any stage. When this occurs, further calls to the enroll function will start a new enrollment process, i.e. a negative error code indicates that the enrollment process has been aborted. These error codes only ever indicate unexpected internal errors or I/O problems.
The RETRY codes from fp_enroll_result may be returned from any enroll stage. These codes indicate that the scan was not succesful in that the user did not position their finger correctly or similar. When a RETRY code is returned, the enrollment stage is not advanced, so the next call into this function will retry the current stage again. The current stage may need to be retried several times.
The fp_enroll_result::FP_ENROLL_FAIL code may be returned from any enroll stage. This code indicates that even though the scans themselves have been acceptable, data processing applied to these scans produces incomprehensible results. In other words, the user may have been scanning a different finger for each stage or something like that. Like negative error codes, this return code indicates that the enrollment process has been aborted.
The fp_enroll_result::FP_ENROLL_PASS code will only ever be returned for non-final stages. This return code indicates that the scan was acceptable and the next call into this function will advance onto the next enroll stage.
The fp_enroll_result::FP_ENROLL_COMPLETE code will only ever be returned from the final enroll stage. It indicates that enrollment completed successfully, and that print_data has been assigned to point to the resultant enrollment data. The print_data parameter will not be modified during any other enrollment stages, hence it is actually legal to pass NULL as this argument for all but the final stage.
If the device is an imaging device, it can also return the image from the scan, even when the enroll fails with a RETRY or FAIL code. It is legal to call this function even on non-imaging devices, just don't expect them to provide images.
dev | the device | |
print_data | a location to return the resultant enrollment data from the final stage. Must be freed with fp_print_data_free() after use. | |
img | location to store the scan image. accepts NULL for no image storage. If an image is returned, it must be freed with fp_img_free() after use. |
int fp_verify_finger_img | ( | struct fp_dev * | dev, | |
struct fp_print_data * | enrolled_print, | |||
struct fp_img ** | img | |||
) |
Performs a new scan and verify it against a previously enrolled print.
If the device is an imaging device, it can also return the image from the scan, even when the verify fails with a RETRY code. It is legal to call this function even on non-imaging devices, just don't expect them to provide images.
dev | the device to perform the scan. | |
enrolled_print | the print to verify against. Must have been previously enrolled with a device compatible to the device selected to perform the scan. | |
img | location to store the scan image. accepts NULL for no image storage. If an image is returned, it must be freed with fp_img_free() after use. |
int fp_identify_finger_img | ( | struct fp_dev * | dev, | |
struct fp_print_data ** | print_gallery, | |||
size_t * | match_offset, | |||
struct fp_img ** | img | |||
) |
Performs a new scan and attempts to identify the scanned finger against a collection of previously enrolled fingerprints.
If the device is an imaging device, it can also return the image from the scan, even when identification fails with a RETRY code. It is legal to call this function even on non-imaging devices, just don't expect them to provide images.
This function returns codes from fp_verify_result. The return code fp_verify_result::FP_VERIFY_MATCH indicates that the scanned fingerprint does appear in the print gallery, and the match_offset output parameter will indicate the index into the print gallery array of the matched print.
This function will not necessarily examine the whole print gallery, it will return as soon as it finds a matching print.
Not all devices support identification. -ENOTSUP will be returned when this is the case.
dev | the device to perform the scan. | |
print_gallery | NULL-terminated array of pointers to the prints to identify against. Each one must have been previously enrolled with a device compatible to the device selected to perform the scan. | |
match_offset | output location to store the array index of the matched gallery print (if any was found). Only valid if FP_VERIFY_MATCH was returned. | |
img | location to store the scan image. accepts NULL for no image storage. If an image is returned, it must be freed with fp_img_free() after use. |
static int fp_enroll_finger | ( | struct fp_dev * | dev, | |
struct fp_print_data ** | print_data | |||
) | [inline, static] |
Performs an enroll stage.
See Enrolling for an explanation of enroll stages. This function is just a shortcut to calling fp_enroll_finger_img() with a NULL image parameter. Be sure to read the description of fp_enroll_finger_img() in order to understand its behaviour.
dev | the device | |
print_data | a location to return the resultant enrollment data from the final stage. Must be freed with fp_print_data_free() after use. |
static int fp_verify_finger | ( | struct fp_dev * | dev, | |
struct fp_print_data * | enrolled_print | |||
) | [inline, static] |
Performs a new scan and verify it against a previously enrolled print.
This function is just a shortcut to calling fp_verify_finger_img() with a NULL image output parameter.
dev | the device to perform the scan. | |
enrolled_print | the print to verify against. Must have been previously enrolled with a device compatible to the device selected to perform the scan. |
static int fp_identify_finger | ( | struct fp_dev * | dev, | |
struct fp_print_data ** | print_gallery, | |||
size_t * | match_offset | |||
) | [inline, static] |
Performs a new scan and attempts to identify the scanned finger against a collection of previously enrolled fingerprints.
This function is just a shortcut to calling fp_identify_finger_img() with a NULL image output parameter.
dev | the device to perform the scan. | |
print_gallery | NULL-terminated array of pointers to the prints to identify against. Each one must have been previously enrolled with a device compatible to the device selected to perform the scan. | |
match_offset | output location to store the array index of the matched gallery print (if any was found). Only valid if FP_VERIFY_MATCH was returned. |