|
@@ -603,14 +603,7 @@ class CCommDevFSM : public FSMImpl<TFSM>
|
|
|
public:
|
|
|
CCommDevFSM() :m_FirstStart(TRUE), m_iInWhatPage(PageType_Init),m_bOpened(false), m_bOpening(true), m_eDevState(DEVICE_STATUS_NOT_READY),m_contiErrTimes(0)
|
|
|
{
|
|
|
- m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("CardIssuerStand", 0x2030021f));
|
|
|
- m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("CardIssuerStore", 0x2200021f));
|
|
|
- m_WarnCodeMap.insert(std::make_pair<std::string, DWORD>("ContactlessCard", 0x21300203));
|
|
|
- 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));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum GetAndSplitDevErrInfo(
|
|
@@ -788,115 +781,6 @@ public:
|
|
|
|
|
|
#endif //_MSC_VER
|
|
|
|
|
|
- /** upload adapter file's hash value and open param as well as dev category information, return if information has uploaded this time*/
|
|
|
- bool ToLogWarnInfoAboutTerm()
|
|
|
- {
|
|
|
- std::map<std::string, std::string> emptys;
|
|
|
- return ToLogWarnInfoAboutTermExtend(emptys);
|
|
|
- }
|
|
|
-
|
|
|
- /** upload adapter file's hash value and open param as well as dev category information, return if information has uploaded this time
|
|
|
- extend from ToLogWarnInfoAboutTerm
|
|
|
- */
|
|
|
- bool ToLogWarnInfoAboutTermExtend(std::map<std::string, std::string> additionalParams)
|
|
|
- {
|
|
|
- bool bUpload(false);
|
|
|
- int fileSize = 0;
|
|
|
- //calculate file hash value
|
|
|
- std::map<std::string, std::string> termInfo;
|
|
|
- char* strFileHash = new char[128];
|
|
|
- if (ExistsFileA(m_adapterInfo.adapterFilePath)) {
|
|
|
- BYTE fileHash[32];
|
|
|
- SM3File(const_cast<char*>(m_adapterInfo.adapterFilePath.GetData()), fileHash);
|
|
|
- ZeroMemory(strFileHash, 128);
|
|
|
- SP::Module::Util::HexBuf2StrBuf(fileHash, &strFileHash, 32);
|
|
|
-
|
|
|
-#if defined(_MSC_VER)
|
|
|
- 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(m_adapterInfo.adapterFilePath.GetData(), &statbuf);
|
|
|
- fileSize = statbuf.st_size;
|
|
|
-#endif //_MSC_VER
|
|
|
-
|
|
|
- } else {
|
|
|
- memset(strFileHash, '\0', sizeof(char) * 128);
|
|
|
- }
|
|
|
-
|
|
|
- //necessary elements about adapter
|
|
|
- CSimpleStringA csPortNum(true), csCheckData(true), csKeySN(true), csInOutDir(true);
|
|
|
- termInfo["VendorDllName"] = m_adapterInfo.adapterFilePath.GetData();
|
|
|
- termInfo["VendorDllFileHash"] = strFileHash;
|
|
|
- ZeroMemory(strFileHash, 128);
|
|
|
- termInfo["VendorDllFileSize"] = _itoa(fileSize, strFileHash, 10);
|
|
|
- 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;
|
|
|
- strFileHash = nullptr;
|
|
|
- }
|
|
|
-
|
|
|
- CSimpleStringA entityName(this->GetEntityBase()->GetEntityName());
|
|
|
- if (!entityName.Compare("Gpio")) {
|
|
|
- termInfo["PortNum"] = m_adapterInfo.strPortNum.GetData();
|
|
|
- }
|
|
|
- else if (!entityName.Compare("PinPad")) {
|
|
|
- termInfo["CheckData"] = m_adapterInfo.strCheckdata.GetData();
|
|
|
- termInfo["Keysn"] = m_adapterInfo.strKeysn.GetData();
|
|
|
- }
|
|
|
-
|
|
|
- if (!additionalParams.empty()) {
|
|
|
- for (auto it = additionalParams.cbegin(); it != additionalParams.cend(); ++it) {
|
|
|
- termInfo[it->first.c_str()] = it->second;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- std::pair<bool, std::string> strResult;
|
|
|
- strResult = generateJsonStr(termInfo);
|
|
|
-
|
|
|
- CSmartPointer<IConfigInfo> spConfigRun;
|
|
|
- CSimpleStringA csWarnMsg;
|
|
|
- this->GetEntityBase()->GetFunction()->OpenConfig(Config_Run, spConfigRun);
|
|
|
- spConfigRun->ReadConfigValue("Run", "WarnMsg", csWarnMsg);
|
|
|
- SYSTEMTIME localTime;
|
|
|
- GetLocalTime(&localTime);
|
|
|
- if (csWarnMsg.IsNullOrEmpty() || csWarnMsg.Compare(strResult.second.c_str()) != 0) {
|
|
|
- spConfigRun->WriteConfigValueInt("Run", "WarnDay", localTime.wDay);
|
|
|
- spConfigRun->WriteConfigValue("Run", "WarnMsg", strResult.second.c_str());
|
|
|
- if (!entityName.IsNullOrEmpty()) {
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, m_WarnCodeMap[entityName.GetData()], strResult.second.c_str());
|
|
|
- bUpload = true;
|
|
|
- } else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Entity Name is empty, please check!!!");
|
|
|
- }
|
|
|
- } else {
|
|
|
- int wDay = 99;
|
|
|
- spConfigRun->ReadConfigValueInt("Run", "WarnDay", wDay);
|
|
|
- if (wDay != localTime.wDay) {
|
|
|
- spConfigRun->WriteConfigValueInt("Run", "WarnDay", localTime.wDay);
|
|
|
- if (!entityName.IsNullOrEmpty()) {
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, m_WarnCodeMap[entityName.GetData()], strResult.second.c_str());
|
|
|
- bUpload = true;
|
|
|
- } else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Entity Name is empty, please check!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return bUpload;
|
|
|
- }
|
|
|
-
|
|
|
void ResetRepeatErrTimes()
|
|
|
{
|
|
|
m_contiErrTimes = 0;
|