|
@@ -9,14 +9,16 @@
|
|
|
#include "DeviceBaseClass.h"
|
|
|
#include "publicFunExport.h"
|
|
|
#include <winpr/file.h>
|
|
|
+#include <map>
|
|
|
+#include <string>
|
|
|
|
|
|
-#if DEVICE_BASE_INTERFACE_FILE_VERSION == 2
|
|
|
-using DevAdaptObjCreateFunc = ErrorCodeEnum(*)(DWORD dwDevClassID, DeviceBaseClass * &pOutDevAptObj);
|
|
|
-using DevAdaptObjReleaseFunc = ErrorCodeEnum(*)(DWORD dwDevClassID, DeviceBaseClass * &pInDevAptObj);
|
|
|
-#else
|
|
|
-using DevAdaptObjCreateFunc = ErrorCodeEnum(*)(DeviceBaseClass * &pOutDevAptObj);
|
|
|
-using DevAdaptObjReleaseFunc = ErrorCodeEnum(*)(DeviceBaseClass * &pInDevAptObj);
|
|
|
-#endif
|
|
|
+#if defined(_MSC_VER)
|
|
|
+typedef ErrorCodeEnum(*DevAdaptObjCreateFunc)(DeviceBaseClass*& baseObj);
|
|
|
+typedef ErrorCodeEnum(*DevAdaptObjReleaseFunc)(DeviceBaseClass*& pBaseObj);
|
|
|
+#else //C/C++ Compiler
|
|
|
+using DevAdaptObjCreateFunc = ErrorCodeEnum(*)(DeviceBaseClass*& pOutDevAptObj);
|
|
|
+using DevAdaptObjReleaseFunc = ErrorCodeEnum(*)(DeviceBaseClass*& pInDevAptObj);
|
|
|
+#endif //_MSC_VER
|
|
|
|
|
|
#define HARDWARE_ENTITY_RESET_ENTITYID(ent, entityID) \
|
|
|
do{\
|
|
@@ -88,29 +90,6 @@ do {\
|
|
|
#define LOG_WATCHDOG_ERROR_MSG_MACRO(errCode, MethodSig)\
|
|
|
LOG_ERROR_MSG_MACRO(errCode, MethodSig, WATCHDOG)
|
|
|
|
|
|
-/*
|
|
|
-
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("") == Vendor_Invalide);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("buzhidao") == Vendor_Invalide);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("hyosung") == Vendor_Hyosung);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("KXD") == Vendor_Kxd);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("KEBa") == Vendor_Keba);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("nanTiAn") == Vendor_Nantian);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("YOTAP") == Vendor_yotap);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("zSs") == Vendor_ZSS);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("GWI") == Vendor_GreateWall);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("yihua") == Vendor_YiHua);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("yh") == Vendor_YiHua);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("GRG") == Vendor_GRG);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("cw") == Vendor_CW);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("eastCOM") == Vendor_EastCom);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("hx") == Vendor_HuaXin);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("sankyo") == Vendor_Sankyo);
|
|
|
-assert(DeviceBaseHelper::GetCurVendorType("chinavision") == Vendor_ChinaVision);
|
|
|
-
|
|
|
-
|
|
|
-*/
|
|
|
-
|
|
|
enum VendorNameType
|
|
|
{
|
|
|
Vendor_Invalide,
|
|
@@ -149,58 +128,26 @@ static const char* VendorNameStr[] = {
|
|
|
"hx"
|
|
|
};
|
|
|
|
|
|
-static std::map<CSimpleStringA, DWORD> WarnCodeMap = {
|
|
|
- {"CardIssuer", 0x2030021f},//在各实体entity_UserErrorCode.h头文件中定义
|
|
|
- {"ContactlessCard", 0x21300203},
|
|
|
- {"CardSwiper", 0x20200207},
|
|
|
- {"FingerPrint", 0x20400211},
|
|
|
- {"IDCertificate", 0x20100202},
|
|
|
- {"PinPad", 0x20600207},
|
|
|
- {"Gpio", 0x20900201},
|
|
|
- {"HSPScanner", 0x21700207},
|
|
|
- {"WatchDog", 0x20d00201},
|
|
|
- {"Ups", 0x20e00201}
|
|
|
-};
|
|
|
-
|
|
|
-static std::map<CSimpleStringA, DWORD> RootIniCodeMap = {
|
|
|
- {"CardIssuer", 0x20300299},
|
|
|
- {"ContactlessCard", 0x21300224},
|
|
|
- {"CardSwiper", 0x20200238},
|
|
|
- {"FingerPrint", 0x20400229},
|
|
|
- {"IDCertificate", 0x2010021f},
|
|
|
- {"PinPad", 0x2060021f},
|
|
|
- {"Gpio", 0x20900203},
|
|
|
- {"HSPScanner", 0x2170020f},
|
|
|
- {"WatchDog", 0x20d00204},
|
|
|
- {"Ups", 0x20e00204}
|
|
|
-};
|
|
|
-
|
|
|
inline static VendorNameType GetCurVendorType(LPCTSTR vendorName)
|
|
|
{
|
|
|
- if (vendorName == NULL || strlen(vendorName) == 0) {
|
|
|
+ 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) {
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
@@ -240,7 +187,6 @@ struct DevAdptLibHelper
|
|
|
{
|
|
|
TearDown();
|
|
|
}
|
|
|
-
|
|
|
return erroCode;
|
|
|
}
|
|
|
|
|
@@ -258,9 +204,7 @@ struct DevAdptLibHelper
|
|
|
DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Create device adapter object failed! EC=%s", SpStrError(erroCode));
|
|
|
return erroCode;
|
|
|
}
|
|
|
-
|
|
|
LOG_ASSERT(m_AdptObjPtr != nullptr);
|
|
|
-
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
@@ -288,11 +232,7 @@ struct DevAdptLibHelper
|
|
|
DeviceBaseClass* devBasePtr = static_cast<DeviceBaseClass*>(m_AdptObjPtr);
|
|
|
if (devBasePtr != nullptr) {
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("To Release DevAdapter Object...");
|
|
|
-#if DEVICE_BASE_INTERFACE_FILE_VERSION == 2
|
|
|
- pFuncReleaseAdapt(0, devBasePtr);
|
|
|
-#else
|
|
|
pFuncReleaseAdapt(devBasePtr);
|
|
|
-#endif
|
|
|
m_AdptObjPtr = nullptr;
|
|
|
} else {
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("static cast base dev class failed!");
|
|
@@ -304,7 +244,7 @@ struct DevAdptLibHelper
|
|
|
pFuncReleaseAdapt = pFuncCreateAdapt = nullptr;
|
|
|
}
|
|
|
|
|
|
- explicit operator bool() const { return (m_AdptObjPtr != nullptr); }
|
|
|
+ operator bool() const { return (m_AdptObjPtr != nullptr); }
|
|
|
operator DeviceBaseClass* () { return m_AdptObjPtr; }
|
|
|
|
|
|
TSubAdpt* GetDevPointer() { return m_AdptObjPtr; }
|
|
@@ -338,35 +278,69 @@ struct DevAdptLibHelper
|
|
|
TearDown();
|
|
|
}
|
|
|
|
|
|
- DevAdptLibHelper(const DevAdptLibHelper&) = delete;
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
+ DevAdptLibHelper(const DevAdptLibHelper&) = delete;
|
|
|
DevAdptLibHelper& operator=(const DevAdptLibHelper&) = delete;
|
|
|
+#endif //RVC_OS_LINUX
|
|
|
|
|
|
private:
|
|
|
|
|
|
toolkit_lib_t m_lib;
|
|
|
-
|
|
|
DevAdaptObjCreateFunc pFuncCreateAdapt;
|
|
|
DevAdaptObjReleaseFunc pFuncReleaseAdapt;
|
|
|
|
|
|
TSubAdpt* m_AdptObjPtr;
|
|
|
};
|
|
|
|
|
|
-struct AdapterInfo
|
|
|
+
|
|
|
+struct AdaptorInfo
|
|
|
{
|
|
|
+
|
|
|
+public:
|
|
|
+
|
|
|
+ CSimpleStringA strVendor;
|
|
|
+ CSimpleStringA strVersion;
|
|
|
+ CSimpleStringA strBatch;
|
|
|
+ CSimpleStringA strPort;
|
|
|
+ CSimpleStringA strBaudrate;
|
|
|
+ CSimpleStringA strPortNum;
|
|
|
+ CSimpleStringA strInOutDir;
|
|
|
+ CSimpleStringA strCheckdata;
|
|
|
+ CSimpleStringA strKeysn;
|
|
|
+
|
|
|
+ AdaptorInfo() :strVendor(true), strVersion(true), strBatch(true)
|
|
|
+ , strPort(true), strBaudrate(true)
|
|
|
+ , strPortNum(true), strInOutDir(true)
|
|
|
+ , strCheckdata(true), strKeysn(true)
|
|
|
+ {
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+struct AdapterInfo : public AdaptorInfo
|
|
|
+{
|
|
|
+ CSimpleStringA adapterFilePath;
|
|
|
CSimpleStringA adapterFileName;
|
|
|
+
|
|
|
DevCategoryInfo devCatInfo;
|
|
|
|
|
|
+ AdapterInfo() :adapterFilePath(true), adapterFileName(true)
|
|
|
+ {
|
|
|
+ ZeroMemory(devCatInfo.szModel, sizeof(devCatInfo.szModel));
|
|
|
+ ZeroMemory(devCatInfo.szType, sizeof(devCatInfo.szType));
|
|
|
+ ZeroMemory(devCatInfo.szVendor, sizeof(devCatInfo.szVendor));
|
|
|
+ }
|
|
|
+
|
|
|
void FulfillCategoryInfo(const DevCategoryInfo& rhs)
|
|
|
{
|
|
|
devCatInfo.eState = rhs.eState;
|
|
|
devCatInfo.version.wMajor = rhs.version.wMajor;
|
|
|
- devCatInfo.version.wMinor = rhs.version.wMinor;
|
|
|
- devCatInfo.version.wRevision = rhs.version.wRevision;
|
|
|
- devCatInfo.version.wBuild = rhs.version.wBuild;
|
|
|
+ devCatInfo.version.wMinor = rhs.version.wMinor;
|
|
|
+ devCatInfo.version.wRevision = rhs.version.wRevision;
|
|
|
+ devCatInfo.version.wBuild = rhs.version.wBuild;
|
|
|
|
|
|
strcpy(devCatInfo.szType, rhs.szType);
|
|
|
- strcpy(devCatInfo.szModel, rhs.szModel);
|
|
|
- strcpy(devCatInfo.szVendor, rhs.szVendor);
|
|
|
+ strcpy(devCatInfo.szModel, rhs.szModel);
|
|
|
+ strcpy(devCatInfo.szVendor, rhs.szVendor);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -376,6 +350,8 @@ struct ErrorPackage {
|
|
|
CSimpleStringA devSN;
|
|
|
ErrorCodeEnum devErrCode;
|
|
|
DWORD apiErrCode;
|
|
|
+
|
|
|
+ ErrorPackage() :msgHead(true), devSN(true), devErrCode(Error_Succeed), apiErrCode(0) {}
|
|
|
};
|
|
|
|
|
|
struct DevEntityErrorCode {
|
|
@@ -421,7 +397,30 @@ class CCommDevFSM : public FSMImpl<TFSM>
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
- CCommDevFSM() :m_FirstStart(TRUE), m_bOpened(FALSE), m_csAlarmMsg("No more information"), m_contiErrTimes(0) {}
|
|
|
+ CCommDevFSM() :m_FirstStart(TRUE), m_bOpened(false), m_bOpening(false), m_csAlarmMsg("No more information"), m_contiErrTimes(0)
|
|
|
+ {
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("CardIssuer", 0x2030021f));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("ContactlessCard", 0x21300203));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("CardSwiper", 0x20200207));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("FingerPrint", 0x20400211));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("IDCertificate", 0x20100202));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("PinPad", 0x20600207));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("Gpio", 0x20900201));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("HSPScanner", 0x21700207));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("WatchDog", 0x20d00201));
|
|
|
+ m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("Ups", 0x20e00201));
|
|
|
+
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("CardIssuer", 0x20300299));
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("ContactlessCard", 0x21300224));
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("CardSwiper", 0x20200238));
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("FingerPrint", 0x20400229));
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("IDCertificate", 0x2010021f));
|
|
|
+ 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));
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("WatchDog", 0x20d00204));
|
|
|
+ m_RootIniCodeMap.insert(std::make_pair<std::string, DWORD>("Ups", 0x20e00204));
|
|
|
+ }
|
|
|
|
|
|
ErrorCodeEnum GetAndSplitDevErrInfo(
|
|
|
CSimpleStringA& csErrMsg, WORD& wdDevErrCode, LPCTSTR lpszFuncNameForDisplay = "");
|
|
@@ -438,140 +437,247 @@ public:
|
|
|
ErrorCodeEnum eRet = GetAndSplitDevErrInfo(csMsg, wdErrorCode);
|
|
|
return (eRet == Error_Succeed);
|
|
|
}
|
|
|
- void SetErrPackage(ErrorPackage& errPkg, CSimpleStringA msgHead, CSimpleStringA devSN, ErrorCodeEnum errCode, DWORD apiCode)
|
|
|
+ void SetErrPackage(CSimpleStringA msgHead, CSimpleStringA devSN, ErrorCodeEnum errCode, DWORD apiCode)
|
|
|
{
|
|
|
- errPkg.msgHead = msgHead;
|
|
|
- errPkg.devSN = devSN;
|
|
|
- errPkg.devErrCode = errCode;
|
|
|
- errPkg.apiErrCode = apiCode;
|
|
|
+ m_errPkg.msgHead = msgHead;
|
|
|
+ m_errPkg.devSN = devSN;
|
|
|
+ m_errPkg.devErrCode = errCode;
|
|
|
+ m_errPkg.apiErrCode = apiCode;
|
|
|
}
|
|
|
|
|
|
- DWORD AlarmDEC(ErrorPackage errPkg, bool bToBusiness = false, bool alarmOrNot = true) {
|
|
|
+ DWORD AlarmDEC(bool bToBusiness = false, bool alarmOrNot = true) {
|
|
|
WORD wdErrCode = 0;
|
|
|
CSimpleStringA csErrMsg(true);
|
|
|
- ErrorCodeEnum ec = GetAndSplitDevErrInfo(csErrMsg, wdErrCode, (LPCTSTR)errPkg.msgHead);
|
|
|
+ ErrorCodeEnum ec = GetAndSplitDevErrInfo(csErrMsg, wdErrCode, (LPCTSTR)m_errPkg.msgHead);
|
|
|
if (ec == Error_Succeed && wdErrCode != 0) {
|
|
|
//oilyang@20200525 if have been set ErrorCode of entity defined (not device),use it directly
|
|
|
- if ((errPkg.apiErrCode >> 20) == m_entCode.dwEntityId)
|
|
|
- UpdateDEC(errPkg.apiErrCode);
|
|
|
+ if ((m_errPkg.apiErrCode >> 20) == m_entCode.dwEntityId)
|
|
|
+ UpdateDEC(m_errPkg.apiErrCode);
|
|
|
else
|
|
|
UpdateDEC(wdErrCode);
|
|
|
-
|
|
|
}
|
|
|
- else if (errPkg.apiErrCode != 0) {
|
|
|
- UpdateDEC(errPkg.apiErrCode);
|
|
|
+ else if (m_errPkg.apiErrCode != 0) {
|
|
|
+ UpdateDEC(m_errPkg.apiErrCode);
|
|
|
}
|
|
|
//oilyang@20200525 if have been set ErrorCode of entity defined (not device),use it directly
|
|
|
DWORD dwCode = GetAlarmDEC();
|
|
|
if (alarmOrNot) {
|
|
|
- LogErrMsgEx(errPkg, csErrMsg, dwCode, bToBusiness);
|
|
|
+ LogErrMsgEx(m_errPkg, csErrMsg, dwCode, bToBusiness);
|
|
|
} else {
|
|
|
const CSimpleStringA alarmMsg = CSimpleStringA::Format("{\"DevSN\":\"%s\", \"Prefix\":\"%s\", \"Code\":\"%s\", \"Msg\":\"%s\"}"
|
|
|
- , errPkg.devSN.GetData(), errPkg.msgHead.GetData(), SpStrError(errPkg.devErrCode), csErrMsg);
|
|
|
+ , m_errPkg.devSN.GetData(), m_errPkg.msgHead.GetData(), SpStrError(m_errPkg.devErrCode), csErrMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)(alarmMsg.GetData());
|
|
|
}
|
|
|
return dwCode;
|
|
|
}
|
|
|
+ /*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;
|
|
|
+
|
|
|
+ CSmartPointer<IConfigInfo> spConfigRoot;
|
|
|
+ this->GetEntityBase()->GetFunction()->OpenConfig(Config_Root, spConfigRoot);
|
|
|
+
|
|
|
+ CSimpleStringA entityName(this->GetEntityBase()->GetEntityName());
|
|
|
+ CSimpleStringA sectionName = CSimpleStringA::Format("Device.%s", entityName.GetData());
|
|
|
+ CSimpleStringA csVendor(true), csVersion(true), csBatch(true), csPort(true), csBaudrate(true);
|
|
|
+ //spConfigRoot->ReadConfigValue(sectionName.GetData(), "Vendor", csVendor);
|
|
|
+ //spConfigRoot->ReadConfigValue(sectionName.GetData(), "Version", csVersion);
|
|
|
+ //spConfigRoot->ReadConfigValue(sectionName.GetData(), "Batch", csBatch);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Port", csPort);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Baudrate", csBaudrate);
|
|
|
+
|
|
|
+ m_adapterInfo.strPort = csPort;
|
|
|
+ m_adapterInfo.strBaudrate = csBaudrate;
|
|
|
+
|
|
|
+ CSimpleStringA csPortNum(true), csCheckData(true), csKeySN(true), csInOutDir(true);
|
|
|
+ if (!entityName.Compare("Gpio")) {
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "PortNum", csPortNum);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "InOutDir", csInOutDir);
|
|
|
+ m_adapterInfo.strPortNum = csPortNum;
|
|
|
+ m_adapterInfo.strInOutDir = csInOutDir;
|
|
|
+ } else if (!entityName.Compare("PinPad")) {
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Checkdata", csCheckData);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Keysn", csKeySN);
|
|
|
+ m_adapterInfo.strCheckdata = csCheckData;
|
|
|
+ m_adapterInfo.strKeysn = csKeySN;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_adapterInfo.adapterFileName = vendorLib.toLibNameString();
|
|
|
+ CSimpleStringA strDepPath;
|
|
|
+ this->GetEntityBase()->GetFunction()->GetPath("Dep", strDepPath);
|
|
|
+ m_adapterInfo.adapterFilePath = CSimpleStringA::Format(
|
|
|
+ "%s" SPLIT_SLASH_STR "%s", (LPCTSTR)strDepPath, (LPCTSTR)m_adapterInfo.adapterFileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ ErrorCodeEnum FulfillAdapterDevCategory()
|
|
|
+ {
|
|
|
+ if (!!m_hDevHelper) {
|
|
|
+ ErrorCodeEnum result(Error_Succeed);
|
|
|
+ DevCategoryInfo devCat;
|
|
|
+ ZeroMemory(devCat.szModel, sizeof(devCat.szModel));
|
|
|
+ ZeroMemory(devCat.szType, sizeof(devCat.szType));
|
|
|
+ ZeroMemory(devCat.szVendor, sizeof(devCat.szVendor));
|
|
|
+ result = m_hDevHelper->GetDevCategory(devCat);
|
|
|
+ if (IS_SUCCEED(result)) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("szVendor:%s,szType:%s,szModel:%s,version:%d.%d.%d.%d", devCat.szVendor
|
|
|
+ , devCat.szType, devCat.szModel, devCat.version.wMajor, devCat.version.wMinor, devCat.version.wRevision, devCat.version.wBuild);
|
|
|
+ m_adapterInfo.FulfillCategoryInfo(devCat);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return Error_InvalidState;
|
|
|
+ }
|
|
|
+
|
|
|
+#if defined(_MSC_VER)
|
|
|
+
|
|
|
+ const char* LPCSTRSmartPrintString(const CSimpleStringA& str)
|
|
|
+ {
|
|
|
+ return str.IsNullOrEmpty() ? "" : str.GetData();
|
|
|
+ }
|
|
|
|
|
|
- void ToLogRootINIInfoOnce(FSMBase* pFSM)
|
|
|
+ CSimpleStringA GenerateJson(AdaptorInfo adaptorInfo, const CSimpleStringA& devDeviceName)
|
|
|
+ {
|
|
|
+ CSimpleStringA result(true);
|
|
|
+ if (0 == devDeviceName.Compare("Gpio", true)) {
|
|
|
+ result = CSimpleStringA::Format("{\"Vendor\":\"%s\", \"Version\":\"%s\", \"Batch\":\"%s\", \"Port\":\"%s\", \"Baudrate\":\"%s\", \"PortNum\":\"%s\", \"InOutDir\":\"%s\"}",
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strVendor), LPCSTRSmartPrintString(adaptorInfo.strVersion),
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strBatch), LPCSTRSmartPrintString(adaptorInfo.strPort), LPCSTRSmartPrintString(adaptorInfo.strBaudrate),
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strPortNum), LPCSTRSmartPrintString(adaptorInfo.strInOutDir));
|
|
|
+ } else if (0 == devDeviceName.Compare("PinPad", true)) {
|
|
|
+ result = CSimpleStringA::Format("{\"Vendor\":\"%s\", \"Version\":\"%s\", \"Batch\":\"%s\", \"Port\":\"%s\", \"Baudrate\":\"%s\", \"Checkdata\":\"%s\", \"Keysn\":\"%s\"}",
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strVendor), LPCSTRSmartPrintString(adaptorInfo.strVersion),
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strBatch), LPCSTRSmartPrintString(adaptorInfo.strPort), LPCSTRSmartPrintString(adaptorInfo.strBaudrate),
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strCheckdata), LPCSTRSmartPrintString(adaptorInfo.strKeysn));
|
|
|
+ } else {
|
|
|
+ result = CSimpleStringA::Format("{\"Vendor\":\"%s\", \"Version\":\"%s\", \"Batch\":\"%s\", \"Port\":\"%s\", \"Baudrate\":\"%s\"}",
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strVendor), LPCSTRSmartPrintString(adaptorInfo.strVersion),
|
|
|
+ LPCSTRSmartPrintString(adaptorInfo.strBatch), LPCSTRSmartPrintString(adaptorInfo.strPort), LPCSTRSmartPrintString(adaptorInfo.strBaudrate));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+#endif //_MSC_VER
|
|
|
+
|
|
|
+ void ToLogRootINIInfoOnce()
|
|
|
{
|
|
|
CSmartPointer<IConfigInfo> spConfig;
|
|
|
- pFSM->GetEntityBase()->GetFunction()->OpenConfig(Config_Cache, spConfig);
|
|
|
- CSimpleStringA entityName(pFSM->GetEntityBase()->GetEntityName());
|
|
|
+ this->GetEntityBase()->GetFunction()->OpenConfig(Config_Cache, spConfig);
|
|
|
+ CSimpleStringA entityName(this->GetEntityBase()->GetEntityName());
|
|
|
int nUploadTime(0);
|
|
|
spConfig->ReadConfigValueInt("RootUploadFlag", entityName, nUploadTime);
|
|
|
-
|
|
|
SYSTEMTIME stNow = CSmallDateTime::GetNow().ToSystemTime();
|
|
|
SYSTEMTIME lastUploadTime = CSmallDateTime(nUploadTime).ToSystemTime();
|
|
|
-
|
|
|
if (lastUploadTime.wYear != stNow.wYear || lastUploadTime.wMonth != stNow.wMonth || lastUploadTime.wDay != stNow.wDay) {
|
|
|
- ToLogRootINIInfo(pFSM);
|
|
|
+ ToLogRootINIInfo();
|
|
|
spConfig->WriteConfigValue("RootUploadFlag", entityName, CSimpleStringA::Format("0x%08X", (DWORD)CSmallDateTime::GetNow()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/** GPIO不调用此接口 [Gifur@20221025]*/
|
|
|
- void ToLogRootINIInfo(FSMBase* pFSM)
|
|
|
+ void ToLogRootINIInfo()
|
|
|
{
|
|
|
- CSmartPointer<IConfigInfo> spConfigRoot;
|
|
|
- pFSM->GetEntityBase()->GetFunction()->OpenConfig(Config_Root, spConfigRoot);
|
|
|
+ CSimpleStringA entityName(this->GetEntityBase()->GetEntityName());
|
|
|
+ std::map<std::string, std::string> rootInfo;
|
|
|
+#if 1
|
|
|
+ rootInfo["Vendor"] = m_adapterInfo.strVendor.GetData();
|
|
|
+ rootInfo["Version"] = m_adapterInfo.strVersion.GetData();
|
|
|
+ rootInfo["Batch"] = m_adapterInfo.strBatch.GetData();
|
|
|
+ rootInfo["Port"] = m_adapterInfo.strPort.GetData();
|
|
|
+ rootInfo["Baudrate"] = m_adapterInfo.strBaudrate.GetData();
|
|
|
|
|
|
- CSimpleStringA entityName(pFSM->GetEntityBase()->GetEntityName());
|
|
|
- CSimpleStringA sectionName = CSimpleStringA::Format("Device.%s", entityName.GetData());
|
|
|
- CSimpleStringA csVendor(true), csVersion(true), csBatch(true), csPort(true), csBaudrate(true);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Vendor", csVendor);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Version", csVersion);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Batch", csBatch);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Port", csPort);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Baudrate", csBaudrate);
|
|
|
+ if (!entityName.Compare("Gpio")) {
|
|
|
+ rootInfo["PortNum"] = m_adapterInfo.strPortNum.GetData();
|
|
|
+ rootInfo["InOutDir"] = m_adapterInfo.strInOutDir.GetData();
|
|
|
+ } else if (!entityName.Compare("PinPad")) {
|
|
|
+ rootInfo["Checkdata"] = m_adapterInfo.strCheckdata.GetData();
|
|
|
+ rootInfo["Keysn"] = m_adapterInfo.strKeysn.GetData();
|
|
|
+ }
|
|
|
+#else
|
|
|
+ CSmartPointer<IConfigInfo> spConfigRoot;
|
|
|
+ this->GetEntityBase()->GetFunction()->OpenConfig(Config_Root, spConfigRoot);
|
|
|
+ CSimpleStringA sectionName = CSimpleStringA::Format("Device.%s", entityName.GetData());
|
|
|
+ CSimpleStringA csVendor(true), csVersion(true), csBatch(true), csPort(true), csBaudrate(true);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Vendor", csVendor);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Version", csVersion);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Batch", csBatch);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Port", csPort);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Baudrate", csBaudrate);
|
|
|
|
|
|
- std::map<std::string, std::string> rootInfo;
|
|
|
- CSimpleStringA csPortNum(true), csCheckData(true), csKeySN(true), csInOutDir(true);
|
|
|
+ CSimpleStringA csPortNum(true), csCheckData(true), csKeySN(true), csInOutDir(true);
|
|
|
rootInfo["Vendor"] = csVendor;
|
|
|
rootInfo["Version"] = csVersion;
|
|
|
- rootInfo["Batch"] = csBatch;
|
|
|
- rootInfo["Port"] = csPort;
|
|
|
- rootInfo["Baudrate"] = csBaudrate;
|
|
|
-
|
|
|
- if (!entityName.Compare("Gpio")) {
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "PortNum", csPortNum);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "InOutDir", csInOutDir);
|
|
|
- rootInfo["PortNum"] = csPortNum;
|
|
|
- rootInfo["InOutDir"] = csInOutDir;
|
|
|
- } else if (!entityName.Compare("PinPad")) {
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Checkdata", csCheckData);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Keysn", csKeySN);
|
|
|
- rootInfo["Checkdata"] = csCheckData;
|
|
|
- rootInfo["Keysn"] = csKeySN;
|
|
|
- }
|
|
|
+ rootInfo["Batch"] = csBatch;
|
|
|
+ rootInfo["Port"] = csPort;
|
|
|
+ rootInfo["Baudrate"] = csBaudrate;
|
|
|
+
|
|
|
+ if (!entityName.Compare("Gpio")) {
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "PortNum", csPortNum);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "InOutDir", csInOutDir);
|
|
|
+ rootInfo["PortNum"] = csPortNum;
|
|
|
+ rootInfo["InOutDir"] = csInOutDir;
|
|
|
+ } else if (!entityName.Compare("PinPad")) {
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Checkdata", csCheckData);
|
|
|
+ spConfigRoot->ReadConfigValue(sectionName.GetData(), "Keysn", csKeySN);
|
|
|
+ rootInfo["Checkdata"] = csCheckData;
|
|
|
+ rootInfo["Keysn"] = csKeySN;
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
std::pair<bool, std::string> strResult;
|
|
|
strResult = generateJsonStr(rootInfo);
|
|
|
strResult.second.c_str();
|
|
|
|
|
|
if (!entityName.IsNullOrEmpty()) {
|
|
|
- LogWarn(Severity_Low, Error_Debug, RootIniCodeMap[entityName], strResult.second.c_str());
|
|
|
+ LogWarn(Severity_Low, Error_Debug, m_RootIniCodeMap[entityName.GetData()], strResult.second.c_str());
|
|
|
} else {
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Entity Name is empty, please check!!!");
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- void ToLogWarnInfoAboutTerm(FSMBase* pFSM, AdapterInfo adapterInfo)
|
|
|
+ /** upload adapter file's hash value and open param as well as dev category information*/
|
|
|
+ void ToLogWarnInfoAboutTerm()
|
|
|
{
|
|
|
- CSmartPointer<IConfigInfo> spConfigRoot;
|
|
|
- pFSM->GetEntityBase()->GetFunction()->OpenConfig(Config_Root, spConfigRoot);
|
|
|
-
|
|
|
- CSimpleStringA entityName = CSimpleStringA::Format("%s", pFSM->GetEntityBase()->GetEntityName());
|
|
|
- CSimpleStringA sectionName = CSimpleStringA::Format("Device.%s", entityName.GetData());
|
|
|
- CSimpleStringA csPort(true), csBaudrate(true);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Port", csPort);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Baudrate", csBaudrate);
|
|
|
-
|
|
|
+ CSimpleStringA entityName(this->GetEntityBase()->GetEntityName());
|
|
|
//calculate file hash value
|
|
|
std::map<std::string, std::string> termInfo;
|
|
|
char* strFileHash = new char[128];
|
|
|
ZeroMemory(strFileHash, 128);
|
|
|
BYTE fileHash[32];
|
|
|
- SM3File(const_cast<char*>(adapterInfo.adapterFileName.GetData()), fileHash);
|
|
|
+ SM3File(const_cast<char*>(m_adapterInfo.adapterFilePath.GetData()), fileHash);
|
|
|
SP::Module::Util::HexBuf2StrBuf(fileHash, &strFileHash, 32);
|
|
|
|
|
|
+#if defined(_MSC_VER)
|
|
|
+ int fileSize = 0;
|
|
|
+ HANDLE hFile;
|
|
|
+ hFile = CreateFile(m_adapterInfo.adapterFilePath.GetData(), 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
+ if (hFile == INVALID_HANDLE_VALUE) {
|
|
|
+ fileSize = 0;
|
|
|
+ } else {
|
|
|
+ fileSize = GetFileSize(hFile, NULL);
|
|
|
+ CloseHandle(hFile);
|
|
|
+ }
|
|
|
+#else
|
|
|
//calculate file size
|
|
|
struct stat statbuf;
|
|
|
ZeroMemory(&statbuf, sizeof(statbuf));
|
|
|
- stat(adapterInfo.adapterFileName.GetData(), &statbuf);
|
|
|
+ stat(m_adapterInfo.adapterFilePath.GetData(), &statbuf);
|
|
|
int fileSize = statbuf.st_size;
|
|
|
+#endif //_MSC_VER
|
|
|
|
|
|
//necessary elements about adapter
|
|
|
CSimpleStringA csPortNum(true), csCheckData(true), csKeySN(true), csInOutDir(true);
|
|
|
- termInfo["VendorDllName"] = adapterInfo.adapterFileName;
|
|
|
+ termInfo["VendorDllName"] = m_adapterInfo.adapterFilePath.GetData();
|
|
|
termInfo["VendorDllFileHash"] = strFileHash;
|
|
|
ZeroMemory(strFileHash, 128);
|
|
|
termInfo["VendorDllFileSize"] = _itoa(fileSize, strFileHash, 10);
|
|
|
- termInfo["szModel"] = adapterInfo.devCatInfo.szModel;
|
|
|
- termInfo["szType"] = adapterInfo.devCatInfo.szType;
|
|
|
- termInfo["Port"] = csPort;
|
|
|
- termInfo["Baudrate"] = csBaudrate;
|
|
|
+ termInfo["szModel"] = m_adapterInfo.devCatInfo.szModel;
|
|
|
+ termInfo["szType"] = m_adapterInfo.devCatInfo.szType;
|
|
|
+ termInfo["Port"] = m_adapterInfo.strPort.GetData();
|
|
|
+ termInfo["Baudrate"] = m_adapterInfo.strBaudrate.GetData();
|
|
|
|
|
|
if (strFileHash != nullptr) {
|
|
|
delete[] strFileHash;
|
|
@@ -579,24 +685,21 @@ public:
|
|
|
}
|
|
|
|
|
|
if (!entityName.Compare("Gpio")) {
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "PortNum", csPortNum);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "InOutDir", csInOutDir);
|
|
|
- termInfo["PortNum"] = csPortNum;
|
|
|
- termInfo["InOutDir"] = csInOutDir;
|
|
|
+ termInfo["PortNum"] = m_adapterInfo.strPortNum.GetData();
|
|
|
+ termInfo["InOutDir"] = m_adapterInfo.strInOutDir.GetData();
|
|
|
}
|
|
|
else if (!entityName.Compare("PinPad")) {
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "CheckData", csCheckData);
|
|
|
- spConfigRoot->ReadConfigValue(sectionName.GetData(), "Keysn", csKeySN);
|
|
|
+ termInfo["CheckData"] = m_adapterInfo.strCheckdata.GetData();
|
|
|
+ termInfo["Keysn"] = m_adapterInfo.strKeysn.GetData();
|
|
|
}
|
|
|
+
|
|
|
std::pair<bool, std::string> strResult;
|
|
|
strResult = generateJsonStr(termInfo);
|
|
|
strResult.second.c_str();
|
|
|
|
|
|
- if (!entityName.IsNullOrEmpty())
|
|
|
- {
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, WarnCodeMap[entityName], strResult.second.c_str());
|
|
|
- }
|
|
|
- else {
|
|
|
+ if (!entityName.IsNullOrEmpty()) {
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, m_WarnCodeMap[entityName.GetData()], strResult.second.c_str());
|
|
|
+ } else {
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Entity Name is empty, please check!!!");
|
|
|
}
|
|
|
return;
|
|
@@ -621,14 +724,46 @@ public:
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ virtual ErrorCodeEnum PreOpenDevice() { return Error_Succeed; }
|
|
|
+ virtual ErrorCodeEnum ToOpenDevice() { return Error_NotImpl; }
|
|
|
+ virtual ErrorCodeEnum PostOpenDevice() { return Error_Succeed; }
|
|
|
+
|
|
|
+ ErrorCodeEnum OpenDevice()
|
|
|
+ {
|
|
|
+ if (m_bOpening) {
|
|
|
+ return Error_Pending;
|
|
|
+ }
|
|
|
+ if (m_bOpened) {
|
|
|
+ return Error_DevAlreadyConnected;
|
|
|
+ }
|
|
|
+ m_bOpening = true;
|
|
|
+ ErrorCodeEnum result = PreOpenDevice();
|
|
|
+ if (IS_SUCCEED(result)) {
|
|
|
+ result = ToOpenDevice();
|
|
|
+ if (IS_SUCCEED(result)) {
|
|
|
+ m_bOpened = true;
|
|
|
+ result = PostOpenDevice();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m_bOpening = false;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+public:
|
|
|
+
|
|
|
+ bool m_bOpened;
|
|
|
+ bool m_bOpening;
|
|
|
+
|
|
|
protected:
|
|
|
|
|
|
DevAdptLibHelper<TDevClass> m_hDevHelper;
|
|
|
DevEntityErrorCode m_entCode;
|
|
|
BOOL m_FirstStart;
|
|
|
- BOOL m_bOpened;
|
|
|
+
|
|
|
+ ErrorPackage m_errPkg;
|
|
|
CSimpleStringA m_csAlarmMsg;
|
|
|
unsigned int m_contiErrTimes;
|
|
|
+ AdapterInfo m_adapterInfo;
|
|
|
|
|
|
void UpdateEntityIDIfZero()
|
|
|
{
|
|
@@ -640,8 +775,7 @@ protected:
|
|
|
void UpdateEntityID()
|
|
|
{
|
|
|
CEntityStaticInfo esi = { 0 };
|
|
|
- ErrorCodeEnum ec = this->GetEntityBase()->GetFunction()->GetEntityStaticInfo(
|
|
|
- this->GetEntityBase()->GetEntityName(), esi);
|
|
|
+ ErrorCodeEnum ec = this->GetEntityBase()->GetFunction()->GetEntityStaticInfo(this->GetEntityBase()->GetEntityName(), esi);
|
|
|
|
|
|
if (ec == Error_Succeed) {
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("wEntityDevelopID: 0x%X", esi.wEntityDevelopID);
|
|
@@ -711,7 +845,7 @@ protected:
|
|
|
}
|
|
|
|
|
|
void LogErrMsg(const char* pMsgHead, ErrorCodeEnum eErrCode, DWORD defaultDevCode = 0, BOOL bAlarm = FALSE);
|
|
|
- void LogErrMsgEx(ErrorPackage errPkg, const char* pMsgBody, DWORD finalErrCode /*= 0*/, BOOL bToBusiness = FALSE);
|
|
|
+ void LogErrMsgEx(const ErrorPackage& errPkg, const char* pMsgBody, DWORD finalErrCode /*= 0*/, BOOL bToBusiness = FALSE);
|
|
|
|
|
|
void GetFileSizeAndCalcHashValue(const char* fileName, int& fileSize, BYTE fileHash[32])
|
|
|
{
|
|
@@ -732,6 +866,11 @@ protected:
|
|
|
}
|
|
|
|
|
|
int CountDevError(CEntityBase *pEntityBase);
|
|
|
+
|
|
|
+ private:
|
|
|
+
|
|
|
+ std::map<std::string, DWORD> m_WarnCodeMap;
|
|
|
+ std::map<std::string, DWORD> m_RootIniCodeMap;
|
|
|
};
|
|
|
|
|
|
|
|
@@ -817,7 +956,7 @@ inline void CCommDevFSM<TFSM, TDevClass>::LogErrMsg(
|
|
|
}
|
|
|
|
|
|
template<class TFSM, class TDevClass>
|
|
|
-inline void CCommDevFSM<TFSM, TDevClass>::LogErrMsgEx(ErrorPackage errPkg, const char* pMsgBody, DWORD finalErrCode /*= 0*/, BOOL bToBusiness)
|
|
|
+inline void CCommDevFSM<TFSM, TDevClass>::LogErrMsgEx(const ErrorPackage& errPkg, const char* pMsgBody, DWORD finalErrCode /*= 0*/, BOOL bToBusiness)
|
|
|
{
|
|
|
const CSimpleStringA alarmMsg = CSimpleStringA::Format("{\"DevSN\":\"%s\", \"Prefix\":\"%s\", \"Code\":\"%s\", \"Msg\":\"%s\"}"
|
|
|
, errPkg.devSN.GetData(), errPkg.msgHead.GetData(), SpStrError(errPkg.devErrCode), pMsgBody);
|
|
@@ -845,17 +984,18 @@ int CCommDevFSM<TFSM, TDevClass>::CountDevError(CEntityBase* pEntityBase)
|
|
|
} else {
|
|
|
int value(0);
|
|
|
spCenterConfig->ReadConfigValueInt("Common", "ErrUpperLimit", value);
|
|
|
- if (0 <= value) {
|
|
|
+ if (0 == value) {
|
|
|
iErrNumLimit = 5;
|
|
|
+ } else if (0 > value) {
|
|
|
+ iErrNumLimit = 0;
|
|
|
} else {
|
|
|
iErrNumLimit = value;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("iErrNumLimit=%d", iErrNumLimit);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
m_contiErrTimes++;
|
|
|
- if (m_contiErrTimes >= iErrNumLimit) {
|
|
|
+ if (iErrNumLimit > 0 && m_contiErrTimes >= iErrNumLimit) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
return 0;
|