|
@@ -6,8 +6,15 @@
|
|
|
#include "ModuleMix.h"
|
|
#include "ModuleMix.h"
|
|
|
#include "PinPad_UserErrorCode.h"
|
|
#include "PinPad_UserErrorCode.h"
|
|
|
#include "CommDevEntityErrorCode.h"
|
|
#include "CommDevEntityErrorCode.h"
|
|
|
|
|
+#include "mod_DevAdptEntityBase.hpp"
|
|
|
#include <map>
|
|
#include <map>
|
|
|
#include <thread>
|
|
#include <thread>
|
|
|
|
|
+#include "path.h"
|
|
|
|
|
+
|
|
|
|
|
+#include <winpr/library.h>
|
|
|
|
|
+#include <winpr/sysinfo.h>
|
|
|
|
|
+#include <winpr/thread.h>
|
|
|
|
|
+
|
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
|
|
const int PINPAD_INIT_TRIES = 3;
|
|
const int PINPAD_INIT_TRIES = 3;
|
|
@@ -15,29 +22,13 @@ const int PINPAD_ANY_INPUT_TIMER = 1;
|
|
|
const int PINPAD_ANY_INPUT_TIMEOUT = 100;
|
|
const int PINPAD_ANY_INPUT_TIMEOUT = 100;
|
|
|
const int MAX_PINPAD_INPUT_TIMEOUT = 60000;
|
|
const int MAX_PINPAD_INPUT_TIMEOUT = 60000;
|
|
|
const int MAX_INPUT_TIMER_TIMEOUT = 600000;
|
|
const int MAX_INPUT_TIMER_TIMEOUT = 600000;
|
|
|
-//#pragma comment(lib,"../../dev/PinPad/PinPad.lib")
|
|
|
|
|
-bool isnostr(const char *str)
|
|
|
|
|
-{
|
|
|
|
|
- int len = strlen(str);
|
|
|
|
|
- if (len == 0)
|
|
|
|
|
- return true;
|
|
|
|
|
- for (int i = 0; i < len; ++i)
|
|
|
|
|
- {
|
|
|
|
|
- if (*(str+i) != ' ')
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
ErrorCodeEnum CPinPadFSM::OnInit()
|
|
ErrorCodeEnum CPinPadFSM::OnInit()
|
|
|
{
|
|
{
|
|
|
LOG_FUNCTION();
|
|
LOG_FUNCTION();
|
|
|
- /*------2020-02-13-------*/
|
|
|
|
|
- //modify by LZM
|
|
|
|
|
- if (VendorLogControler(this,"PinPad")!=Error_Succeed)
|
|
|
|
|
- {
|
|
|
|
|
- Dbg("VendorLogControler Failed...");
|
|
|
|
|
- }
|
|
|
|
|
- /*-----------------------*/
|
|
|
|
|
|
|
+ auto devEntity = dynamic_cast<CDevAdptEntityBase*>(GetEntityBase());
|
|
|
|
|
+ devEntity->InitializeVendorLogSwitch();
|
|
|
|
|
+
|
|
|
CSystemStaticInfo sysInfo;
|
|
CSystemStaticInfo sysInfo;
|
|
|
|
|
|
|
|
m_csMachineType = m_csSite = m_terminalNo = "";
|
|
m_csMachineType = m_csSite = m_terminalNo = "";
|
|
@@ -396,8 +387,10 @@ int CPinPadFSM::Initial()
|
|
|
Dbg("is RVC.IL.");
|
|
Dbg("is RVC.IL.");
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
+#ifdef _WIN32
|
|
|
DWORD dwCurrThId = GetCurrentThreadId();
|
|
DWORD dwCurrThId = GetCurrentThreadId();
|
|
|
- Dbg("Initial thread id:%d",dwCurrThId);
|
|
|
|
|
|
|
+ Dbg("Initial thread id:%d", dwCurrThId);
|
|
|
|
|
+#endif //_WIN32
|
|
|
ErrorCodeEnum eErrDev;
|
|
ErrorCodeEnum eErrDev;
|
|
|
|
|
|
|
|
CSmartPointer<IEntityFunction> spEntityFunction = GetEntityBase()->GetFunction();
|
|
CSmartPointer<IEntityFunction> spEntityFunction = GetEntityBase()->GetFunction();
|
|
@@ -410,7 +403,7 @@ int CPinPadFSM::Initial()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- CSimpleStringA dllName,tmpVendor(""), tmpDevSN(""), tmpDLLVersion(""), csDepPath(""), csBackslash("\\");
|
|
|
|
|
|
|
+ CSimpleStringA dllName,tmpVendor(""), tmpDevSN(""), tmpDLLVersion(""), csDepPath(""), csBackslash(SPLIT_SLASH_STR);
|
|
|
GetEntityBase()->GetFunction()->GetSysVar("FWBVendor", tmpVendor);
|
|
GetEntityBase()->GetFunction()->GetSysVar("FWBVendor", tmpVendor);
|
|
|
GetEntityBase()->GetFunction()->GetSysVar("FWBDevSN", tmpDevSN);
|
|
GetEntityBase()->GetFunction()->GetSysVar("FWBDevSN", tmpDevSN);
|
|
|
GetEntityBase()->GetFunction()->GetSysVar("FWBVersion", tmpDLLVersion);
|
|
GetEntityBase()->GetFunction()->GetSysVar("FWBVersion", tmpDLLVersion);
|
|
@@ -451,39 +444,6 @@ int CPinPadFSM::Initial()
|
|
|
spConfig->ReadConfigValue("Device.PinPad", "Keysn", m_keySN);
|
|
spConfig->ReadConfigValue("Device.PinPad", "Keysn", m_keySN);
|
|
|
spConfig->ReadConfigValue("Device.PinPad", "KeysnSM", m_keySNSM);
|
|
spConfig->ReadConfigValue("Device.PinPad", "KeysnSM", m_keySNSM);
|
|
|
Dbg("to load vendor dll.");
|
|
Dbg("to load vendor dll.");
|
|
|
- //ErrorCodeEnum Error;
|
|
|
|
|
- //CSmartPointer<IEntityFunction> spEntityFunction = GetEntityBase()->GetFunction();
|
|
|
|
|
- //CSmartPointer<IConfigInfo> spConfig;
|
|
|
|
|
- //Error = spEntityFunction->OpenConfig(Config_Root, spConfig);
|
|
|
|
|
- //if (Error != Error_Succeed) {
|
|
|
|
|
- // LOG_TRACE("open cfg file failed!");
|
|
|
|
|
- // return Error;
|
|
|
|
|
- //}
|
|
|
|
|
- //CSimpleStringA dllName,devName,devVendor,devVer,devBatch,dllSuffix;
|
|
|
|
|
- //dllName = devName = "PinPad";
|
|
|
|
|
- //dllSuffix = ".dll";
|
|
|
|
|
- //devVendor = devVer = devBatch = "";
|
|
|
|
|
- //spConfig->ReadConfigValue("Device.PinPad","Vendor",devVendor);
|
|
|
|
|
- //spConfig->ReadConfigValue("Device.PinPad","Version",devVer);
|
|
|
|
|
- //spConfig->ReadConfigValue("Device.PinPad","Batch",devBatch);
|
|
|
|
|
-
|
|
|
|
|
- //Dbg("[%s],[%s],[%s]",(LPCSTR)devVendor,(LPCSTR)devVer,(LPCSTR)devBatch);
|
|
|
|
|
- //CSimpleStringA csDepPath,csBackslash("\\");
|
|
|
|
|
- //ErrorCodeEnum eErrDep = GetEntityBase()->GetFunction()->GetPath("Dep", csDepPath);
|
|
|
|
|
- //if (eErrDep != Error_Succeed)
|
|
|
|
|
- //{
|
|
|
|
|
- // Dbg("GetBasePath failed (%d).",eErrDep);
|
|
|
|
|
- // return Error_Param;
|
|
|
|
|
- //}
|
|
|
|
|
- //dllName = csDepPath + csBackslash + dllName;
|
|
|
|
|
- //if (!isnostr(devVendor.GetData()))
|
|
|
|
|
- // dllName = dllName + "." + devVendor;
|
|
|
|
|
- //if (!isnostr(devVer.GetData()))
|
|
|
|
|
- // dllName = dllName + "." + devVer;
|
|
|
|
|
- //if (!isnostr(devBatch.GetData()))
|
|
|
|
|
- // dllName = dllName + "." + devBatch;
|
|
|
|
|
- //dllName += dllSuffix;
|
|
|
|
|
- //Dbg("dllName:[%s]",dllName);
|
|
|
|
|
m_hVerdorDll = LoadLibraryA(dllName);
|
|
m_hVerdorDll = LoadLibraryA(dllName);
|
|
|
if (m_hVerdorDll == NULL)
|
|
if (m_hVerdorDll == NULL)
|
|
|
{
|
|
{
|