Crate hzgrow_r502

Source
Expand description

hzgrow-r502 is an embedded-hal driver for the HZ Grow R502 (and likely similar) fingerprint module.

This is a work in progress and does not strive to meet all use cases of the device. However, it should cover the basics, and may possibly become a basis for other drivers for HZ Grow and similar modules, provided that the suppliers of those use a rougly similar API.

§Basics

See the commands implemented by the driver in Command.

Response types are all linked from Reply.

§Example

To authenticate with the R502:

use hzgrow_r502::{R502, Command, Reply};

// Obtain tx, rx from some serial port implementation
let mut r502 = R502::new(tx, rx, 0xffffffff);
match r502.send_command(Command::VfyPwd { password: 0x00000000 }) {
    Ok(Reply::VfyPwd(result)) => println!("Status: {:#?}", result.confirmation_code),
    Err(error) => panic!("Error: {:#?}", error),
    _ => {},
}

For more examples, see the examples directory.

Structs§

DeletCharResult
Result of deleting a fingerprint template.
GenImgResult
Result struct for the GenImg call
Img2TzResult
Result struct for the Img2Tz struct
LoadCharResult
Structure containing the status code of the LoadChar call
MatchResult
Structure containing the status code of the Match call
R502
Represents a R502 device connected to a U(S)ART.
ReadSysParaResult
Result struct for the ReadSysPara call
RegModelResult
Result of generating the fingerprint template for enrollment.
SearchResult
Result struct for the Search call
StoreResult
Result of storing a fingerprint template.
SystemParameters
System status and configuration.
TemplateNumResult
Contains the next available template number, or index in the library at which a fingerprint can be enrolled.
VfyPwdResult
Result struct for the VfyPwd call

Enums§

Command
Commands that one can send to the R502.
DeletCharStatus
DeletChar status code
Error
Error type for low-level R502 operations. Wraps transport-level errors as well.
GenImgStatus
Enum for the GenImg status code
Img2TzStatus
Enum for the Img2Tz status code
LoadCharStatus
LoadChar status code
MatchStatus
Match status code
PasswordVerificationState
Enum for the password handshake result
RegModelStatus
RegModel status code
Reply
Responses to commands returned by the R502. Names are the same as commands.
SearchStatus
Enum for the Search status code
StoreStatus
Store status code
TemplateNumStatus
TemplateNum status code