Procházet zdrojové kódy

!10720 准入时间同步日志优化&高拍仪增加图片大小日志打印&GPIO去除握手重启逻辑
Merge pull request !10720 from 80374374/feature_hsps_js

杨诗友80174847 před 5 měsíci
rodič
revize
cb813ad982

+ 2 - 0
Module/mod_HSPScanner/HSPScannerFSM.cpp

@@ -1651,6 +1651,7 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
 				fclose(fHandle);
 				nRes = 4;
 			} else {
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("picture size:%ld", fileSize);
 				cbData.Alloc(fileSize);
 				fseek(fHandle, 0, SEEK_SET);
 				fread(cbData.m_pData, 1, fileSize, fHandle);
@@ -2211,6 +2212,7 @@ int CHSPScannerFSM::ScanImageJS(SpReqAnsContext<HSPScannerService_ScanImageJS_Re
 					tmpMsg = CSimpleStringA::Format("ftell(%s) error after invoking scanimage: %ld.", (LPCTSTR)csImageFile, fileSize);
 				}
 				else {
+					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("picture size:%ld", fileSize);
 					cbData.Alloc(fileSize);
 					fseek(fHandle, 0, SEEK_SET);
 					fread(cbData.m_pData, 1, fileSize, fHandle);

+ 6 - 9
Module/mod_accessauth/AccessAuthFSM.cpp

@@ -724,25 +724,22 @@ DWORD CAccessAuthFSM::HandleTimeSyn(long nTimeDiff, BYTE* nSessionKey)
 	const long dwTimeDiff = nTimeDiff > 0 ? nTimeDiff : 0 - nTimeDiff;
 	const long torelateTime = m_torelateDiffSyncTimeSecs > 0 ? m_torelateDiffSyncTimeSecs : 0 - m_torelateDiffSyncTimeSecs;
 	if (torelateTime < dwTimeDiff) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("HandleTimeSyn")
-			("time diff is too large (%ds), sync time now", nTimeDiff);
-
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("HandleTimeSyn")("time diff is too large (%ds), sync time now", nTimeDiff);
 		CSmallDateTime dtServerTime((DWORD)(CSmallDateTime::GetNow()) + nTimeDiff);
 		SYSTEMTIME stServerTime = dtServerTime.ToSystemTime();
+		CSmallDateTime dtLocalTime((DWORD)(CSmallDateTime::GetNow()));
 #ifdef RVC_OS_WIN
 		if (SetLocalTime(&stServerTime)) {
 #else
 		if (set_system_time_by_sec(nTimeDiff)) {
 #endif // RVC_OS_WIN
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sync time with server succeed, server time: [%s]", dtServerTime.ToTimeString().GetData());
-			LogWarn(Severity_Low, Error_Debug, AccessAuthorization_UserErrorCode_Sync_Time_Succ,
-				CSimpleStringA::Format("sync time succ:  server time: [%s],diff[%ld],threshold:[%d]", 
-					dtServerTime.ToTimeString().GetData(), nTimeDiff, m_torelateDiffSyncTimeSecs));
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sync time with server succeed, before local time:[%s], server time: [%s]", dtLocalTime.ToTimeString().GetData(), dtServerTime.ToTimeString().GetData());
+			LogWarn(Severity_Low, Error_Debug, AccessAuthorization_UserErrorCode_Sync_Time_Succ, CSimpleStringA::Format("%ld",nTimeDiff));
 		}
 		else {
 			LogWarn(Severity_Middle, Error_Unexpect, AccessAuthorization_UserErrorCode_Sync_Time_Failed,
-				CSimpleStringA::Format("sync time failed:  server time: [%s],diff[%ld],threshold:[%d](GLE=%u)",
-					dtServerTime.ToTimeString().GetData(), nTimeDiff, m_torelateDiffSyncTimeSecs, GetLastError()));
+				CSimpleStringA::Format("sync time failed:  local time:[%s], server time: [%s],diff[%ld],threshold:[%d](GLE=%u)",
+					dtLocalTime.ToTimeString().GetData(), dtServerTime.ToTimeString().GetData(), nTimeDiff, m_torelateDiffSyncTimeSecs, GetLastError()));
 			return ERR_ACCESSAUTH_SET_LOCALE_TIME;
 		}
 	} 

+ 5 - 3
Module/mod_gpio/GpioFSM.cpp

@@ -8,6 +8,7 @@ const int INPUT_PORT_2 = 2;
 const int MAX_MOVE_HOLD_TIMES = 5000;
 const int ON_EVENT_DETECT_TIMOUE_MILLSECS = 500;
 const int REPEAT_FIRE_TIMEOUT_VALUE = 10000; //10s
+const int TRY_FILED_TIMES_VALUE = 10;
 
 #define SETBIT(x,y) x|=(1<<(y))
 #define CLEARBIT(x,y) x&=((1<<(y))^0xffffff)
@@ -905,9 +906,10 @@ void CGPIOFSM::OnEventDetect(void* pData)
 	}
 	if (err != Error_Succeed) {
 		m_btLastRevcInput = (BYTE)(-1);
-		if (++m_RecvErrTims >= 10) {
-			SetDevState(DEVICE_STATUS_FAULT);
-			LogWarn(Severity_Middle, Error_Debug, GPIO_UserErrorCode_EvtDetect_Error, "DevAdapterApi[DetectStatus/ReadPort] error already exceeds 10 times, give up");
+		if (++m_RecvErrTims >= TRY_FILED_TIMES_VALUE) {
+			//SetDevState(DEVICE_STATUS_FAULT);
+			LogWarn(Severity_Middle, Error_Debug, GPIO_UserErrorCode_EvtDetect_Error, 
+				CSimpleStringA::Format("DevAdapterApi[DetectStatus/ReadPort] error already exceeds %d times, give up", TRY_FILED_TIMES_VALUE));
 			GetEntityBase()->GetFunction()->KillTimer(pGci->timerID);
 		}
 		else {