UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

ZFM20 Class

Module: groups.md

This class was tested on the Grove Fingerprint Sensor Module. It can store up to 163 fingerprints.
It is connected via a UART at 57,600 baud.
zfm20.jpg This example demonstrates how to register and store a new fingerprint This example demonstrates reading a fingerprint and locating it in the DB

Methods

ZFM20

(
  • uart
  • baud
)
Number

Provided by the zfm20 module.

ZFM20 constructor

Parameters:

  • uart Number

    Target mraa UART index to use (0 or 1)

  • baud Number

    Desired baud rate

Returns:

Number:

ZFM20

(
  • uart_raw
  • baud
)
Number

Provided by the zfm20 module.

ZFM20 constructor

Parameters:

  • uart_raw String

    undefined

  • baud Number

    Desired baud rate

Returns:

Number:

readData

(
  • buffer
  • len
)
Number

Provided by the zfm20 module.

Reads any available data in a user-supplied buffer. Note: the call blocks until data is available to be read. Use dataAvailable() to determine whether there is data available beforehand, to avoid blocking.

Parameters:

  • buffer String

    Buffer to hold the data read

  • len Number

    Length of the buffer

Returns:

Number:

Number of bytes read

writeData

(
  • buffer
  • len
)
Number

Provided by the zfm20 module.

Writes the data in the buffer to the device

Parameters:

  • buffer String

    Buffer to hold the data read

  • len Number

    Length of the buffer

Returns:

Number:

Number of bytes written

setupTty

(
  • baud
)
Boolean

Provided by the zfm20 module.

Sets up proper tty I/O modes and the baud rate. For this device, the default baud rate is 57,600.

Parameters:

  • baud Number

    Desired baud rate.

Returns:

Boolean:

True if successful

writeCmdPacket

(
  • pkt
  • len
)
Number

Provided by the zfm20 module.

Composes and writes a command packet

Parameters:

  • pkt Uint8_t *

    Packet

  • len Number

    Length of packet

Returns:

Number:

Number of bytes written

verifyPacket

(
  • pkt
  • len
)
Boolean

Provided by the zfm20 module.

Verifies the packet header and indicates its validity

Parameters:

  • pkt Uint8_t *

    Packet to check

  • len Number

    Length of packet

Returns:

Boolean:

True if the packet is valid, false otherwise

getMillis

() Number

Provided by the zfm20 module.

Returns the number of milliseconds elapsed since initClock() was last called

Returns:

Number:

Elapsed milliseconds

initClock

()

Provided by the zfm20 module.

Resets the clock

setAddress

(
  • addr
)

Provided by the zfm20 module.

Sets the address that should be used to access the module

Parameters:

  • addr Number

    Address to use

setPassword

(
  • pw
)

Provided by the zfm20 module.

Sets the password that should be used to access the module

Parameters:

  • pw Number

    Password to use

getResponse

(
  • pkt
  • len
)
Boolean

Provided by the zfm20 module.

Gets the returned data from a request

Parameters:

  • pkt Uint8_t *

    Buffer to store the returned data

  • len Number

    Expected response length; pkt should be at least this large

Returns:

Boolean:

True if successful

verifyPassword

() Boolean

Provided by the zfm20 module.

Verifies and authenticates to the module. The password used is the last one set by setPassword() .

Returns:

Boolean:

True if successful

getNumTemplates

() Number

Provided by the zfm20 module.

Queries the module for the number of stored templates (fingerprints).

Returns:

Number:

Number of currently stored templates

setNewPassword

(
  • pwd
)
Boolean

Provided by the zfm20 module.

Sets a new password for the module. This passowrd is stored in the module, and is required to access the module in the future.

Parameters:

  • pwd Number

    New password to set on the module

Returns:

Boolean:

True if successful

setNewAddress

(
  • addr
)
Boolean

Provided by the zfm20 module.

Sets a new address for the module. This address is stored in the module, and is required to access the module in the future.

Parameters:

  • addr Number

    New address to set on the module

Returns:

Boolean:

True if successful

generateImage

() Number

Provided by the zfm20 module.

Generates a new fingerprint image (scans a fingerprint)

Returns:

Number:

One of the ZFM20_ERRORS_T values

image2Tz

(
  • slot
)
Number

Provided by the zfm20 module.

Converts the image in the image buffer (generated by generateImage() ) and stores it in one of the two characteristics buffers, 1 or 2

Parameters:

  • slot Number

    Characteristics buffer to use; must be 1 or 2

Returns:

Number:

One of the ZFM20_ERRORS_T values

createModel

() Number

Provided by the zfm20 module.

Based on the two characteristics buffers (1 & 2), creates a fingerprint model. Once a model is successfully created, it can be stored in the module with storeModel() .

Returns:

Number:

One of the ZFM20_ERRORS_T values

storeModel

(
  • slot
  • id
)
Number

Provided by the zfm20 module.

Once a fingerprint model is created, this method can be used to store it (via one of the characteristics buffers) in a given location.

Parameters:

  • slot Number

    Characteristics buffer to store the model, 1 or 2

  • id Number

    Location to store the model

Returns:

Number:

One of the ZFM20_ERRORS_T values

deleteModel

(
  • id
)
Number

Provided by the zfm20 module.

Deletes a stored model

Parameters:

  • id Number

    Location containing the model to delete

Returns:

Number:

One of the ZFM20_ERRORS_T values

deleteDB

() Number

Provided by the zfm20 module.

Deletes the model database (DB)

Returns:

Number:

One of the ZFM20_ERRORS_T values

match

(
  • score
)
Number

Provided by the zfm20 module.

Compares the features in characteristics buffers 1 and 2 and returns a score if they match

Parameters:

  • score Uint16_t *

    Score

Returns:

Number:

One of the ZFM20_ERRORS_T values

Properties

CMD_GEN_IMAGE

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_IMG2TZ

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_MATCH

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_REGMODEL

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_STORE

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_LOAD_TMPL

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_UPLOAD_TMPL

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_DOWNLOAD_TMPL

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_UPLOAD_IMAGE

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_DOWNLOAD_IMAGE

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_DELETE_TMPL

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_EMPTYDB

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_SET_SYSPARAMS

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_GET_SYSPARAMS

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_SET_PASSWORD

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_VERIFY_PASSWORD

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_GET_RANDOM_NUMBER

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_SET_ADDRESS

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_GET_TMPL_COUNT

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

CMD_GET_INDEX_TABLE

Enum ZFM20_COMMAND_T

Provided by the zfm20 module.

ERR_OK

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_PACKET_RX_ERROR

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_NO_FINGER

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_FP_IMAGE_FAILED

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_FP_TOO_MESSY

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_FP_IMAGE_FEW_FEATURES

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_FP_NOMATCH

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_FP_NOTFOUND

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_FP_ENROLLMISMATCH

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_BAD_LOCATION

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_DB_ERROR

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_UPLOAD_FEAT_FAILED

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_NO_MORE_PACKETS

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_UPLOAD_IMG_FAILED

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_RM_TMPL_FAILED

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_EMPTY_DB_FAILED

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_INVALID_PWD

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_INVALID_IMAGE

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_RW_FLASH_ERROR

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_INVALID_REG

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_INVALID_ADDR

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_NEEDS_PWD

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

ERR_INTERNAL_ERR

Enum ZFM20_ERRORS_T

Provided by the zfm20 module.

PKT_COMMAND

Enum ZFM20_PKTCODES_T

Provided by the zfm20 module.

PKT_DATA

Enum ZFM20_PKTCODES_T

Provided by the zfm20 module.

PKT_ACK

Enum ZFM20_PKTCODES_T

Provided by the zfm20 module.

PKT_END_DATA

Enum ZFM20_PKTCODES_T

Provided by the zfm20 module.