first commit

This commit is contained in:
2023-06-06 19:34:45 +02:00
commit 356d7de2cf
29 changed files with 2629 additions and 0 deletions

101
app/FingerPrint_API.cpp Normal file
View File

@@ -0,0 +1,101 @@
#include <SmingCore.h>
#include "FingerPrint.h"
int CFingerPrint::VerifyPassword()
{
uint8_t aPayload[] = {
COMMAND_VFYPWD,
(uint8_t)(m_Password >> 24 & 0xFF),
(uint8_t)(m_Password >> 16 & 0xFF),
(uint8_t)(m_Password >> 8 & 0xFF),
(uint8_t)(m_Password >> 0 & 0xFF),
};
Write(IDENT_COMMAND, aPayload, sizeof(aPayload));
FingerPrintIdent ident;
uint8_t aResponse[1];
int ret = Recv(&ident, aResponse, sizeof(aResponse));
m_RecvState = RECV_DROP;
if(ret < 0)
return ret;
if(ident != IDENT_ACK)
return ERROR_COMMUNICATION;
uint8_t error = aResponse[0];
return error;
}
int CFingerPrint::ReadSystemParameters(uint8_t aResponse[17])
{
uint8_t aPayload[] = {
COMMAND_READSYSPARA,
};
Write(IDENT_COMMAND, aPayload, sizeof(aPayload));
FingerPrintIdent ident;
int ret = Recv(&ident, aResponse, 17);
m_RecvState = RECV_DROP;
if(ret < 0)
return ret;
if(ident != IDENT_ACK)
return ERROR_COMMUNICATION;
uint8_t error = aResponse[0];
return error;
}
int CFingerPrint::DeleteTemplate(uint16_t positionStart, uint16_t count)
{
uint8_t aPayload[] = {
COMMAND_DELETCHAR,
(uint8_t)(positionStart >> 8 & 0xFF),
(uint8_t)(positionStart >> 0 & 0xFF),
(uint8_t)(count >> 8 & 0xFF),
(uint8_t)(count >> 0 & 0xFF),
};
Write(IDENT_COMMAND, aPayload, sizeof(aPayload));
FingerPrintIdent ident;
uint8_t aResponse[1];
int ret = Recv(&ident, aResponse, sizeof(aResponse));
m_RecvState = RECV_DROP;
if(ret < 0)
return ret;
if(ident != IDENT_ACK)
return ERROR_COMMUNICATION;
uint8_t error = aResponse[0];
return error;
}
int CFingerPrint::EmptyDatabase()
{
uint8_t aPayload[] = {
COMMAND_EMPTY,
};
Write(IDENT_COMMAND, aPayload, sizeof(aPayload));
FingerPrintIdent ident;
uint8_t aResponse[1];
int ret = Recv(&ident, aResponse, sizeof(aResponse));
m_RecvState = RECV_DROP;
if(ret < 0)
return ret;
if(ident != IDENT_ACK)
return ERROR_COMMUNICATION;
uint8_t error = aResponse[0];
return error;
}