Fingerprint Scanner Library  0.5
Library for the Fingerprint Scanner (261
Functions
fingerprint.c File Reference

Simplifies reading the WaveShare fingerprint scanner module. More...

#include "fingerprint.h"

Functions

fpScanner * fingerprint_open (int pin_rx, int pin_tx)
 Open a connection to a WaveShare fingerprint scanner module. More...
 
void fingerprint_close (fpScanner *device)
 Close a connection and recover all memory set aside for the fingerprint scanner instance. More...
 
void fingerprint_sendCommand (fpScanner *device, char __fpCmd, char __fpParam1, char __fpParam2, char __fpParam3)
 Low-level function used to send a command to the Fingerprint Scanner. More...
 
void fingerprint_readResponse (fpScanner *device, char *__fpResponse)
 Low-level function used to read a response from the Fingerprint Scanner. More...
 
int fingerprint_allowOverwrite (fpScanner *device, char b)
 Allow overwriting of fingerprints already stored in the memory of the Fingerprint Scanner. More...
 
int fingerprint_add (fpScanner *device, int userId, char userLevel, int scanNumber)
 Add a user's fingerprint and info to the fingerprint scanner's memory. More...
 
int fingerprint_deleteUser (fpScanner *device, int userId)
 Deletes a user (or all users if no user is specified) from the fingerprint module's memory. More...
 
int fingerprint_countUsers (fpScanner *device)
 Returns the number or users stored in the fingerprint scanner's memory. More...
 
int fingerprint_scan (fpScanner *device, int userId, int *uid)
 Scans a user fingerprint and compares it to the provided User ID. If no User ID is provided, it finds and stores the User ID in the specified variable. More...
 
int fingerprint_lookupUserPrivlage (fpScanner *device, int userId)
 Looks up the stored user privalage for the provided User ID. More...
 
int fingerprint_setTimeout (fpScanner *device, int timeout)
 Sets the timeout for a single scan. More...
 
int fingerprint_setStrictness (fpScanner *device, char s_level)
 Sets the comparison strictness. More...
 

Detailed Description

Simplifies reading the WaveShare fingerprint scanner module.

Author
Matthew Matz
Version
0.50

Function Documentation

int fingerprint_add ( fpScanner *  device,
int  userId,
char  userLevel,
int  scanNumber 
)

Add a user's fingerprint and info to the fingerprint scanner's memory.

Parameters
*devicedevice identifier returned by fingerprint_open function.
userIda User Id number to assign to the user. May be any positive integer from 1 to 65535.
userLevelan abitrary level that can be attached to each user. Must be a (1), (2) or (3).
scanNumberTo record a fingerprint, the scanner must read it three times. Passing a (1), (2), or (3) tells the scanner to record the first, second, or third scans needed to record the fingerprint. Passing any integer other than (1), (2), or (3) will cause the fingerprint scanner to take all three scans in succession.
Returns
ACK_SUCCESS, ACK_FAIL, ACK_FULL, ACK_TIMEOUT, or ACK_USER_EXISTS.
int fingerprint_allowOverwrite ( fpScanner *  device,
char  b 
)

Allow overwriting of fingerprints already stored in the memory of the Fingerprint Scanner.

Parameters
*devicedevice identifier returned by fingerprint_open function.
bA (1) allows overwiting, a (0) prevents overwriting stored fingerprints.
Returns
ACK_SUCCESS or ACK_FAIL.
void fingerprint_close ( fpScanner *  device)

Close a connection and recover all memory set aside for the fingerprint scanner instance.

Parameters
*devicedevice identifier returned by fingerprint_open function.
int fingerprint_countUsers ( fpScanner *  device)

Returns the number or users stored in the fingerprint scanner's memory.

Parameters
*devicedevice identifier returned by fingerprint_open function.
Returns
ACK_SUCCESS or ACK_FAIL.
int fingerprint_deleteUser ( fpScanner *  device,
int  userId 
)

Deletes a user (or all users if no user is specified) from the fingerprint module's memory.

Parameters
*devicedevice identifier returned by fingerprint_open function.
userIda User Id of the user to delete. Passing an integer (0) or less than (0) will delete all users from the fingerprint module.
Returns
ACK_SUCCESS or ACK_FAIL.
int fingerprint_lookupUserPrivlage ( fpScanner *  device,
int  userId 
)

Looks up the stored user privalage for the provided User ID.

Parameters
*devicedevice identifier returned by fingerprint_open function.
userIdThe User ID to look up.
Returns
User privalage (1, 2, or 3) or ACK_FAIL.
fpScanner* fingerprint_open ( int  pin_rx,
int  pin_tx 
)

Open a connection to a WaveShare fingerprint scanner module.

Parameters
pin_rxPropeller I/O pin connected to fingerprint scanner's RX pin.
pin_txPropeller I/O pin connected to fingerprint scanner's TX pin.
Returns
Fingerprint Scanner device identifier for use with functions in fingerprint scanner library and functions with text_t parameter in simpletext library.
void fingerprint_readResponse ( fpScanner *  device,
char *  __fpResponse 
)

Low-level function used to read a response from the Fingerprint Scanner.

Parameters
*devicedevice identifier returned by fingerprint_open function.
__fpResponsechar array to store the response from the fingerprint scanner.
Note
Must follow the fingerprint_sendCommand() function.
int fingerprint_scan ( fpScanner *  device,
int  userId,
int *  uid 
)

Scans a user fingerprint and compares it to the provided User ID. If no User ID is provided, it finds and stores the User ID in the specified variable.

Parameters
*devicedevice identifier returned by fingerprint_open function.
userIdthe User ID to match the fingerprint being scanned to. If this is set to (0), it will check the scan against all of the stored user fingerprints.
*uida variable to store the matched User Id of the scanned fingerprint into. Stores (0) into the variable if no matching user was found.
Returns
User Privalage (1, 2, or 3) or ACK_FAIL.
void fingerprint_sendCommand ( fpScanner *  device,
char  __fpCmd,
char  __fpParam1,
char  __fpParam2,
char  __fpParam3 
)

Low-level function used to send a command to the Fingerprint Scanner.

Parameters
*devicedevice identifier returned by fingerprint_open function.
__fpCmdthe command to be sent.
__fpParam1the first parameter of the command.
__fpParam2the second parameter of the command.
__fpParam3the third parameter of the command.
Note
Must be immediately followed by the fingerprint_readResponse() function.
int fingerprint_setStrictness ( fpScanner *  device,
char  s_level 
)

Sets the comparison strictness.

Parameters
*devicedevice identifier returned by fingerprint_open function.
s_levelA positive integer to set the comparison level to: (0) [not very strict] to (9) [very strict].
Returns
ACK_SUCCESS or ACK_FAIL.
int fingerprint_setTimeout ( fpScanner *  device,
int  timeout 
)

Sets the timeout for a single scan.

Parameters
*devicedevice identifier returned by fingerprint_open function.
timeouthow long to keep trying before timing out. Units are approximately in milliseconds.
Returns
ACK_SUCCESS or ACK_FAIL.