This commit is contained in:
2025-12-12 08:35:20 +01:00
parent 356d7de2cf
commit 8a97b01622
21 changed files with 445 additions and 110 deletions

View File

@@ -32,7 +32,7 @@ void CFingerLogic::SetState(FingerLogicState state)
m_State = state;
if(m_State == STATE_READY || m_State == STATE_ERROR)
m_PowerOffTimer.start(false);
m_PowerOffTimer.startOnce();
else
{
m_PowerOffTimer.stop();
@@ -64,9 +64,9 @@ void CFingerLogic::PowerOn()
delayMilliseconds(100);
}
void CFingerLogic::OnFingerInterrupt(bool finger)
void CFingerLogic::OnFinger(bool finger)
{
debugf("OnFingerInterrupt: %s", finger ? "DOWN" : "UP");
debugf("OnFinger: %s", finger ? "DOWN" : "UP");
m_Finger = finger;
if(finger)
@@ -157,6 +157,27 @@ void CFingerLogic::InitFinger_OnReadSystemParameters(CFingerLogic *pThis, Finger
debugf("packetLength: %d", param->packetLength);
debugf("baudRate: %d", param->baudRate);
if(param->securityLevel != pThis->Main().Settings().m_SecurityLevel)
{
pThis->SetState(STATE_INIT_SETSYSTEM_SECURITYLEVEL);
pThis->FingerPrint().AsyncSetSystemParameter((SetSystemParameterCallback)InitFinger_OnSetSystemSecurityLevel, pThis, FINGERPRINT_SECURITY_REG_ADDR, pThis->Main().Settings().m_SecurityLevel);
}
else
{
pThis->SetState(STATE_INIT_READTEMPLATEMAP);
pThis->FingerPrint().AsyncReadTemplateMap((ReadTemplateMapCallback)InitFinger_OnReadTemplateMap, pThis, 0);
}
}
else
pThis->SetState(STATE_ERROR);
}
void CFingerLogic::InitFinger_OnSetSystemSecurityLevel(CFingerLogic *pThis, FingerPrintError error, const char *errorStr)
{
debugf("InitFinger_OnSetSystemSecurityLevel: (%d) %s", error, errorStr);
if(error == ERROR_OK)
{
pThis->SetState(STATE_INIT_READTEMPLATEMAP);
pThis->FingerPrint().AsyncReadTemplateMap((ReadTemplateMapCallback)InitFinger_OnReadTemplateMap, pThis, 0);
}
@@ -596,3 +617,15 @@ void CFingerLogic::EnrollFinger_OnDownloadCharacteristics(CFingerLogic *pThis, F
pThis->SetState(STATE_READY);
}
void CFingerLogic::SetSecurityLevel(int securityLevel)
{
SetState(STATE_SETSYSTEM_SECURITYLEVEL);
FingerPrint().AsyncSetSystemParameter((SetSystemParameterCallback)SetSecurityLevel_OnSetSystemSecurityLevel, this, FINGERPRINT_SECURITY_REG_ADDR, securityLevel);
}
void CFingerLogic::SetSecurityLevel_OnSetSystemSecurityLevel(CFingerLogic *pThis, FingerPrintError error, const char *errorStr)
{
debugf("SetSecurityLevel_OnSetSystemSecurityLevel: (%d) %s", error, errorStr);
pThis->SetState(STATE_READY);
}