Browse Source

Z991239-5719 #comment 添加对File适配器名称的读取

80374374 11 months ago
parent
commit
a4c151b8ff

+ 17 - 5
Module/include/DevEntityCommBase.hpp

@@ -19,20 +19,24 @@ struct VendorLibInfo
 	CSimpleStringA strVendor;
 	CSimpleStringA strVersion;
 	CSimpleStringA strBatch;
+	bool fileServering;
+	CSimpleStringA strFileValue;
 
-
-	VendorLibInfo() :strDevice(true), strVendor(true), strVersion(true), strBatch(true) {}
-	VendorLibInfo(const CSimpleStringA& strDeviceName) :strDevice(strDeviceName), strVendor(true), strVersion(true), strBatch(true) {}
-	VendorLibInfo(const VendorLibInfo& rhs) :strDevice(rhs.strDevice), strVendor(rhs.strVendor), strVersion(rhs.strVersion), strBatch(rhs.strBatch) {}
+	VendorLibInfo() :strDevice(true), strVendor(true), strVersion(true), strBatch(true), fileServering(false), strFileValue(true){}
+	VendorLibInfo(const CSimpleStringA& strDeviceName) :strDevice(strDeviceName), strVendor(true), strVersion(true), strBatch(true), fileServering(false), strFileValue(true) {}
+	VendorLibInfo(const VendorLibInfo& rhs) :strDevice(rhs.strDevice), strVendor(rhs.strVendor), strVersion(rhs.strVersion), strBatch(rhs.strBatch), fileServering(rhs.fileServering), strFileValue(rhs.strFileValue) {}
 	VendorLibInfo& operator = (const VendorLibInfo& rhs) {
 		strDevice = rhs.strDevice;
 		strVendor = rhs.strVendor;
 		strVersion = rhs.strVersion;
 		strBatch = rhs.strBatch;
+		fileServering = rhs.fileServering;
+		strFileValue = rhs.strFileValue;
 		return *this;
 	}
 	bool IsValid() const
 	{
+		if (!strFileValue.IsNullOrEmpty()) return true;
 		return (!strDevice.IsNullOrEmpty()
 			&& !strVendor.IsNullOrEmpty()
 			&& !strVersion.IsNullOrEmpty()
@@ -41,7 +45,7 @@ struct VendorLibInfo
 
 	bool IsNotConfig() const
 	{
-		return(strVendor.IsNullOrEmpty() && strVersion.IsNullOrEmpty() && strBatch.IsNullOrEmpty());
+		return(strFileValue.IsNullOrEmpty() && strVendor.IsNullOrEmpty() && strVersion.IsNullOrEmpty() && strBatch.IsNullOrEmpty());
 	}
 
 	int GetVersionInt() const 
@@ -68,6 +72,11 @@ struct VendorLibInfo
 
 	CSimpleStringA toLibNameString() const
 	{
+
+		if (!strFileValue.IsNullOrEmpty()) {
+			return strFileValue;
+		}
+
 		CSimpleStringA strFullLibName(true);
 		if (!strDevice.IsNullOrEmpty()) 
 		{
@@ -176,6 +185,9 @@ inline ErrorCodeEnum CDevAdptEntityBase::ExtractVendorLibName()
 			}
 			CSimpleStringA strSection = CSimpleStringA("Device.") + strDeviceEntityName;
 			vendorLibInfo.strDevice = strDeviceEntityName;
+			CSimpleStringA strValue(true);
+			spRootConfig->ReadConfigValue(strSection, "File", strValue);
+			if (!strValue.IsNullOrEmpty()) { vendorLibInfo.strFileValue = strValue; vendorLibInfo.fileServering = true; }
 			spRootConfig->ReadConfigValue(strSection, "Vendor", vendorLibInfo.strVendor);
 			spRootConfig->ReadConfigValue(strSection, "Version", vendorLibInfo.strVersion);
 			spRootConfig->ReadConfigValue(strSection, "Batch", vendorLibInfo.strBatch);

+ 17 - 63
Module/include/DevFSMCommBase.hpp

@@ -92,6 +92,7 @@ do {\
 
 #define LOG_WATCHDOG_ERROR_MSG_MACRO(errCode, MethodSig)\
 	LOG_ERROR_MSG_MACRO(errCode, MethodSig, WATCHDOG)
+
 enum PageType
 {
 	PageType_Init,
@@ -99,66 +100,6 @@ enum PageType
 	PageType_UserDesktop,
 	PageType_Other,
 };
-enum VendorNameType 
-{
-	Vendor_Invalide,
-	Vendor_Sankyo,
-	Vendor_ChinaVision,
-	Vendor_Hyosung,
-	Vendor_Kxd,
-	Vendor_Keba,
-	Vendor_Nantian,
-	Vendor_yotap,
-	Vendor_ZSS,
-	Vendor_GreateWall,
-	Vendor_YiHua,
-	Vendor_GRG,
-	Vendor_CW,
-	Vendor_EastCom,
-	Vendor_HuaXin,
-	Vendor_MAX
-};
-
-static const char* VendorNameStr[] = {
-	"Unknown",
-	"Sankyo",
-	"ChinaVision",
-	"hyosung",
-	"kxd",
-	"keba",
-	"nantian",
-	"yotap",
-	"zss",
-	"gwi",
-	"yh", // "yihua"
-	"grg",
-	"CW",
-	"EastCom",
-	"hx"
-};
-
-inline static VendorNameType GetCurVendorType(LPCTSTR vendorName)
-{
-	if (vendorName == NULL || strlen(vendorName) == 0) {
-		return Vendor_Invalide;
-	}
-	int idx = -1;
-	for (int i = 0; i < sizeof(VendorNameStr) / sizeof(VendorNameStr[0]); ++i) {
-		if (strnicmp(vendorName, VendorNameStr[i], strlen(VendorNameStr[i])) == 0) {
-			idx = i;
-			break;
-		}
-	}
-	if (idx == -1) {
-		/*历史遗留原因,怡化厂商有两个适配器名字*/
-		if (strnicmp(vendorName, "yihua", strlen("yihua")) == 0) {
-			idx = Vendor_YiHua;
-		} else {
-			idx = Vendor_Invalide;
-		}
-	}
-	return (VendorNameType)idx;
-}
 
 template <typename TSubAdpt>
 struct DevAdptLibHelper
@@ -168,7 +109,7 @@ private:
 	bool CheckAndGetMapAdatperName(const CSimpleStringA& strPath, CSimpleStringA& replaceAdapterName)
 	{
 		bool result = false;
-		CSimpleStringA strTest = strPath.GetData();
+		CSimpleStringA strTest = m_strAdapterName.IsNullOrEmpty() ? strPath.GetData() : m_strAdapterName.GetData();
 		for (int i = 0; i < strTest.GetLength(); ++i) {
 			if (strTest[i] >= 'A' && strTest[i] <= 'Z') strTest[i] = strTest[i] + ('a' - 'A');
 		}
@@ -246,6 +187,8 @@ private:
 
 public:
 
+	void SetAdapterName(const CSimpleStringA& strEntityName) { m_strAdapterName = strEntityName; }
+
 	ErrorCodeEnum LoadLibAddress(const CSimpleStringA& strFullLibPath)
 	{
 		ErrorCodeEnum erroCode = Error_Succeed;
@@ -448,7 +391,7 @@ public:
 
 	DevAdptLibHelper()
 		: pFuncCreateAdapt(nullptr), pFuncReleaseAdapt(nullptr), pFuncGetPrefixErr(nullptr)
-		, m_AdptObjPtr(nullptr), m_VS2010BridgeMode(false)
+		, m_AdptObjPtr(nullptr), m_VS2010BridgeMode(false), m_strAdapterName(true)
 	{
 		memset(&m_lib, 0, sizeof(toolkit_lib_t));
 	}
@@ -472,6 +415,7 @@ private:
 
 	TSubAdpt* m_AdptObjPtr;
 	bool m_VS2010BridgeMode;
+	CSimpleStringA m_strAdapterName;
 };
 
 
@@ -489,11 +433,12 @@ public:
 	CSimpleStringA strInOutDir;
 	CSimpleStringA strCheckdata;
 	CSimpleStringA strKeysn;
+	CSimpleStringA strPureAdapterName;
 
 	AdaptorInfo() :strVendor(true), strVersion(true), strBatch(true)
 		, strPort(true), strBaudrate(true)
 		, strPortNum(true), strInOutDir(true)
-		, strCheckdata(true), strKeysn(true)
+		, strCheckdata(true), strKeysn(true), strPureAdapterName(true)
 	{
 	}
 
@@ -752,6 +697,7 @@ public:
 		m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("PinPad", 0x2060021f));
 		m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("Gpio", 0x20900203));
 		m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("HSPScanner", 0x2170020f));
+
 	}
 
 	ErrorCodeEnum GetAndSplitDevErrInfo(
@@ -849,12 +795,20 @@ public:
 		return;
 	}
 
+
+	ErrorCodeEnum LoadUpAdapterLibrary()
+	{
+		m_hDevHelper.SetAdapterName(this->GetEntityBase()->GetEntityName());
+		ErrorCodeEnum rc = m_hDevHelper.LoadUp(m_adapterInfo.adapterFilePath);
+		return rc;
+	}
 	/*fulfill adapter elem, open param and adapter file name&absolute path */
 	void FulfillAdapterInfoFrom(const VendorLibInfo& vendorLib)
 	{
 		m_adapterInfo.strVendor = vendorLib.strVendor;
 		m_adapterInfo.strVersion = vendorLib.strVersion;
 		m_adapterInfo.strBatch = vendorLib.strBatch;
+		m_adapterInfo.strPureAdapterName = vendorLib.strFileValue;
 
 		CSmartPointer<IConfigInfo> spConfigRoot;
 		this->GetEntityBase()->GetFunction()->OpenConfig(Config_Root, spConfigRoot);

+ 1 - 1
Module/mod_FingerPrint/FingerPrintFSM.cpp

@@ -384,7 +384,7 @@ int CFingerPrintFSM::Initial()
 		return 0;
 	}
 	pEntity->InitializeVendorLogSwitch();
-	err = m_hDevHelper.LoadUp(m_adapterInfo.adapterFilePath);
+	err = LoadUpAdapterLibrary();
 	if (!IS_SUCCEED(err))
 	{
 		if (err != Error_NotExist) { //文件存在,只是因为其他原因导致加载失败的