This commit is contained in:
2025-12-12 08:35:20 +01:00
committed by example
parent 356d7de2cf
commit 0ce45a133b
23 changed files with 616 additions and 135 deletions

View File

@@ -69,6 +69,36 @@ enum FingerPrintError
ERROR_COMMUNICATIONPORT = 0x1D, // fail to operate the communication port
};
#define FINGERPRINT_BAUD_REG_ADDR 0x4 //!< BAUDRATE register address
#define FINGERPRINT_BAUDRATE_9600 0x1 //!< UART baud 9600
#define FINGERPRINT_BAUDRATE_19200 0x2 //!< UART baud 19200
#define FINGERPRINT_BAUDRATE_28800 0x3 //!< UART baud 28800
#define FINGERPRINT_BAUDRATE_38400 0x4 //!< UART baud 38400
#define FINGERPRINT_BAUDRATE_48000 0x5 //!< UART baud 48000
#define FINGERPRINT_BAUDRATE_57600 0x6 //!< UART baud 57600
#define FINGERPRINT_BAUDRATE_67200 0x7 //!< UART baud 67200
#define FINGERPRINT_BAUDRATE_76800 0x8 //!< UART baud 76800
#define FINGERPRINT_BAUDRATE_86400 0x9 //!< UART baud 86400
#define FINGERPRINT_BAUDRATE_96000 0xA //!< UART baud 96000
#define FINGERPRINT_BAUDRATE_105600 0xB //!< UART baud 105600
#define FINGERPRINT_BAUDRATE_115200 0xC //!< UART baud 115200
#define FINGERPRINT_SECURITY_REG_ADDR 0x5 //!< Security level register address
// The safety level is 1 The highest rate of false recognition , The rejection
// rate is the lowest . The safety level is 5 The lowest tate of false
// recognition, The rejection rate is the highest .
#define FINGERPRINT_SECURITY_LEVEL_1 0X1 //!< Security level 1
#define FINGERPRINT_SECURITY_LEVEL_2 0X2 //!< Security level 2
#define FINGERPRINT_SECURITY_LEVEL_3 0X3 //!< Security level 3
#define FINGERPRINT_SECURITY_LEVEL_4 0X4 //!< Security level 4
#define FINGERPRINT_SECURITY_LEVEL_5 0X5 //!< Security level 5
#define FINGERPRINT_PACKET_REG_ADDR 0x6 //!< Packet size register address
#define FINGERPRINT_PACKET_SIZE_32 0X0 //!< Packet size is 32 Byte
#define FINGERPRINT_PACKET_SIZE_64 0X1 //!< Packet size is 64 Byte
#define FINGERPRINT_PACKET_SIZE_128 0X2 //!< Packet size is 128 Byte
#define FINGERPRINT_PACKET_SIZE_256 0X3 //!< Packet size is 256 Byte
enum RecvStates
{
RECV_DONE = 0,
@@ -92,6 +122,7 @@ typedef void (CFingerPrint::*RecvCallback)(FingerPrintIdent ident, uint8_t *pDat
typedef void (*VerifyPasswordCallback)(void *pUser, FingerPrintError error, const char *errorStr);
typedef void (*ReadSystemParametersCallback)(void *pUser, FingerPrintError error, const char *errorStr, CFingerSystemParameters *param);
typedef void (*SetSystemParameterCallback)(void *pUser, FingerPrintError error, const char *errorStr);
typedef void (*ReadImageCallback)(void *pUser, FingerPrintError error, const char *errorStr);
typedef void (*ConvertImageCallback)(void *pUser, FingerPrintError error, const char *errorStr);
typedef void (*SearchTemplateCallback)(void *pUser, FingerPrintError error, const char *errorStr, int16_t position, int16_t score);
@@ -112,11 +143,13 @@ public:
int VerifyPassword();
int ReadSystemParameters(uint8_t aResponse[17]);
int SetSystemParameter(uint8_t regAddr, uint8_t value);
int DeleteTemplate(uint16_t positionStart, uint16_t count);
int EmptyDatabase();
int AsyncVerifyPassword(VerifyPasswordCallback fnCallback, void *pUser);
int AsyncReadSystemParameters(ReadSystemParametersCallback fnCallback, void *pUser);
int AsyncSetSystemParameter(SetSystemParameterCallback fnCallback, void *pUser, uint8_t regAddr, uint8_t value);
int AsyncReadImage(ReadImageCallback fnCallback, void *pUser);
int AsyncConvertImage(ConvertImageCallback fnCallback, void *pUser, uint8_t numCharBuffer);
int AsyncSearchTemplate(SearchTemplateCallback fnCallback, void *pUser, uint8_t numCharBuffer, uint16_t positionStart, uint16_t numTemplates);
@@ -130,6 +163,7 @@ public:
private:
void OnAsyncVerifyPassword(FingerPrintIdent ident, uint8_t *pData, uint16_t length);
void OnAsyncReadSystemParameters(FingerPrintIdent ident, uint8_t *pData, uint16_t length);
void OnAsyncSetSystemParameter(FingerPrintIdent ident, uint8_t *pData, uint16_t length);
void OnAsyncReadImage(FingerPrintIdent ident, uint8_t *pData, uint16_t length);
void OnAsyncConvertImage(FingerPrintIdent ident, uint8_t *pData, uint16_t length);
void OnAsyncSearchTemplate(FingerPrintIdent ident, uint8_t *pData, uint16_t length);