|
@@ -234,6 +234,7 @@ ErrorCodeEnum CHSPScannerFSM::OnInit()
|
|
|
{
|
|
|
ErrorCodeEnum erroCode = Error_Succeed;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Source Code complied at: %s %s", __DATE__, __TIME__);
|
|
|
+ AddStateHooker(this);
|
|
|
InitialMaxResizeValue();
|
|
|
auto pEntity = GET_DEV_ENTITY_BASE_POINTER();
|
|
|
pEntity->InitializeVendorLogSwitch();
|
|
@@ -286,7 +287,6 @@ ErrorCodeEnum CHSPScannerFSM::OnExit()
|
|
|
|
|
|
void CHSPScannerFSM::s0_Idle_on_entry()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
m_nFatalTimes = 0;
|
|
|
m_ecSelfTest = Error_Succeed;
|
|
|
}
|
|
@@ -351,6 +351,7 @@ unsigned int CHSPScannerFSM::s0_Idle_on_event(FSMEvent* e)
|
|
|
e->SetHandled();
|
|
|
if(uRet == 1 && ++m_nFatalTimes <= MAX_ERROR_TIMES)
|
|
|
{
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("hold on, wait next time (%d/%d).", m_nFatalTimes, MAX_ERROR_TIMES);
|
|
|
uRet = 2;
|
|
|
}
|
|
|
else if(uRet == 0)
|
|
@@ -436,7 +437,7 @@ unsigned int CHSPScannerFSM::s0_Idle_on_event(FSMEvent* e)
|
|
|
|
|
|
void CHSPScannerFSM::s1_Preview_on_entry()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void CHSPScannerFSM::s1_Preview_on_exit()
|
|
@@ -489,13 +490,13 @@ unsigned int CHSPScannerFSM::s1_Preview_on_event(FSMEvent* e)
|
|
|
else if(++m_nFatalTimes <= MAX_ERROR_TIMES){
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("hold on, wait next time (%d/%d).", m_nFatalTimes, MAX_ERROR_TIMES);
|
|
|
uRet = 3;
|
|
|
+ if (IsDevConnected() == 0) {
|
|
|
+ PostEventFIFO(new FSMEvent(USER_EVT_DISCONNECT));
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- if (IsDevConnected() == 0) { PostEventFIFO(new FSMEvent(USER_EVT_DISCONNECT)); uRet = 3; }
|
|
|
- else {
|
|
|
- if (e->param2 == 1) m_desiredAction = USER_EVT_HIDEPREVIEW; else m_desiredAction = USER_EVT_STOPPREVIEW;
|
|
|
- uRet = 4;
|
|
|
- }
|
|
|
+ if (e->param2 == 1) m_desiredAction = USER_EVT_HIDEPREVIEW; else m_desiredAction = USER_EVT_STOPPREVIEW;
|
|
|
+ uRet = 4;
|
|
|
}
|
|
|
e->SetHandled();
|
|
|
}
|
|
@@ -514,9 +515,15 @@ unsigned int CHSPScannerFSM::s1_Preview_on_event(FSMEvent* e)
|
|
|
if (e->param1 == 0) { //拍照成功
|
|
|
if (e->param2 == 1) uRet = 2; //拍照后要求隐藏
|
|
|
else uRet = 1; //拍照后没有其他动作
|
|
|
+ m_nFatalTimes = 0;
|
|
|
+ }
|
|
|
+ else if (++m_nFatalTimes <= MAX_ERROR_TIMES) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("hold on, wait next time (%d/%d).", m_nFatalTimes, MAX_ERROR_TIMES);
|
|
|
+ uRet = 3;
|
|
|
}
|
|
|
else {
|
|
|
- //TODO: 失败不进行处理 [Gifur@2025320]
|
|
|
+ if (e->param2 == 1) m_desiredAction = USER_EVT_HIDEPREVIEW; else m_desiredAction = USER_EVT_STARTPREVIEW;
|
|
|
+ uRet = 4;
|
|
|
}
|
|
|
e->SetHandled();
|
|
|
}
|
|
@@ -700,7 +707,6 @@ unsigned int CHSPScannerFSM::s2_on_event(FSMEvent* e)
|
|
|
|
|
|
void CHSPScannerFSM::s3_Failed_on_entry()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
if (GetDevInitFlag()) {
|
|
|
SetLastUserCode(HSPScanner_UserErrorCode_FSM_INVALID);
|
|
|
const int nStatus = IsDevConnected();
|