Эх сурвалжийг харах

Z991239-5580 #comment feat: pinpad调用getdevInfo状态判断调整

陈纪林80310970 1 жил өмнө
parent
commit
3e420012f0

+ 58 - 61
Module/mod_accessauth/mod_AccessAuth.cpp

@@ -1028,77 +1028,74 @@ int CAccessAuthEntity::GetPinPadIDAndDeviceID(CSimpleStringA &strPinPadID, CSimp
 		rc = pPinPadClient->GetDevInfo(req, ans, 3000);
 		if (rc == Error_Succeed)
 		{
-			if (ans.state == DEVICE_STATUS_NORMAL)
+			bPinPadOnline = true;
+			nRet = 0;
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pinpad model: %s", (const char*)ans.model);
+
+			// CM = V2.0#PM = V1.0#MID = 75500001#PID = 12345678#FWID = V1234567#Vendor = nantian
+			// 密码键盘ID,PID,8到16字节;  设备ID,MID,8到16字节;  固件版本号,FWID,8字节
+			CSimpleStringA str = ans.model;
+			if (!str.IsNullOrEmpty())
 			{
-				bPinPadOnline = true;
-				nRet = 0;
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pinpad model: %s", (const char*)ans.model);
-
-				// CM = V2.0#PM = V1.0#MID = 75500001#PID = 12345678#FWID = V1234567#Vendor = nantian
-				// 密码键盘ID,PID,8到16字节;  设备ID,MID,8到16字节;  固件版本号,FWID,8字节
-				CSimpleStringA str = ans.model;
-				if (!str.IsNullOrEmpty())
+				auto arr = str.Split('#');
+				if (arr.GetCount() > 0)
 				{
-					auto arr = str.Split('#');
-					if (arr.GetCount() > 0)
+					for (int i = 0; i < arr.GetCount(); i++)
 					{
-						for (int i = 0; i < arr.GetCount(); i++)
+						auto arr2 = arr[i].Split('=');
+						if (arr2.GetCount() != 2)
+							continue;
+
+						//if (arr2[0] == "PID")
+						if (!strnicmp((LPCTSTR)arr2[0], "PID", strlen("PID")))
+						{
+							strPID = arr2[1];
+
+							if (!strPID.IsNullOrEmpty())
+								bPinPadID = true;
+						}
+						//else if (arr2[0] == "MID")
+						else if (!strnicmp((LPCTSTR)arr2[0], "MID", strlen("MID")))
 						{
-							auto arr2 = arr[i].Split('=');
-							if (arr2.GetCount() != 2)
-								continue;
-
-							//if (arr2[0] == "PID")
-							if (!strnicmp((LPCTSTR)arr2[0], "PID", strlen("PID")))
-							{
-								strPID = arr2[1];
-
-								if (!strPID.IsNullOrEmpty())
-									bPinPadID = true;
-							}
-							//else if (arr2[0] == "MID")
-							else if (!strnicmp((LPCTSTR)arr2[0], "MID", strlen("MID")))
-							{
-								strMID = arr2[1];
-
-								if (!strMID.IsNullOrEmpty())
-									bDeviceID = true;
-							}
-							//else if (arr2[0] == "Vendor")
-							else if (!strnicmp((LPCTSTR)arr2[0], "Vendor", strlen("Vendor")))
-							{
-								strVendor = arr2[1];
-
-								if (!strVendor.IsNullOrEmpty())
-									bVendor = true;
-							}
-							else if (!strnicmp((LPCTSTR)arr2[0], "FWBID", strlen("FWBID")))
-							{
-								strBluetoothID = arr2[1];
-								DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strBluetoothID=%s", strBluetoothID);
-								if (!strBluetoothID.IsNullOrEmpty())
-									bBluetooth = true;
-							}
+							strMID = arr2[1];
+
+							if (!strMID.IsNullOrEmpty())
+								bDeviceID = true;
+						}
+						//else if (arr2[0] == "Vendor")
+						else if (!strnicmp((LPCTSTR)arr2[0], "Vendor", strlen("Vendor")))
+						{
+							strVendor = arr2[1];
+
+							if (!strVendor.IsNullOrEmpty())
+								bVendor = true;
+						}
+						else if (!strnicmp((LPCTSTR)arr2[0], "FWBID", strlen("FWBID")))
+						{
+							strBluetoothID = arr2[1];
+							DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strBluetoothID=%s", strBluetoothID);
+							if (!strBluetoothID.IsNullOrEmpty())
+								bBluetooth = true;
+						}
 #ifdef RVC_OS_WIN
-							else if (!strnicmp((LPCTSTR)arr2[0], "PM", strlen("PM")))
-							{
-								CSimpleStringA strPM = arr2[1];
+						else if (!strnicmp((LPCTSTR)arr2[0], "PM", strlen("PM")))
+						{
+							CSimpleStringA strPM = arr2[1];
 
-								if (!strPM.IsNullOrEmpty() && strPM.Compare("V3.0", true) == 0)
-									m_bNewSMFWB = true;
-							}
-#endif // RVC_OS_WIN
+							if (!strPM.IsNullOrEmpty() && strPM.Compare("V3.0", true) == 0)
+								m_bNewSMFWB = true;
 						}
+#endif // RVC_OS_WIN
 					}
 				}
 			}
-			else
-			{
-				if (!HasPinPad())
-					isPinPadMac = false;
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pinpad STATUS ERROR!, state: %d", ans.state);
-				return nRet; //此时nRet = -1, pinpad调用失败
-			}
+		}
+		else if (rc == Error_NotInit)
+		{
+			if (!HasPinPad())
+				isPinPadMac = false;
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pinpad NOT INIT!");
+			return nRet; //此时nRet = -1, pinpad调用失败
 		}
 		else
 		{