فهرست منبع

#IQRV #comment [Merge] GPIO同步

gifur 2 سال پیش
والد
کامیت
07731c4977
3فایلهای تغییر یافته به همراه131 افزوده شده و 110 حذف شده
  1. 4 0
      Module/mod_gpio/Gpio_def_g.h
  2. 105 41
      Module/mod_gpio/mod_gpio.cpp
  3. 22 69
      Module/mod_gpio/mod_gpio.h

+ 4 - 0
Module/mod_gpio/Gpio_def_g.h

@@ -20,6 +20,10 @@ namespace Gpio {
 #define GpioService_MethodSignature_GetStatus 1783612278
 #define GpioService_MethodSignature_QueryCurrSet -1281718647
 
+#define GpioService_LogCode_Set "QLR040220900"
+#define GpioService_LogCode_GetStatus "QLR040220901"
+#define GpioService_LogCode_QueryCurrSet "QLR040220902"
+
 struct GpioService_Set_Info
 {
 	int devseq;

+ 105 - 41
Module/mod_gpio/mod_gpio.cpp

@@ -146,16 +146,14 @@ void CGpioEntity::ToLogRootINIInfo()
     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);
     rootInfo["Vendor"] = csVendor;
     rootInfo["Version"] = csVersion;
     rootInfo["Batch"] = csBatch;
     rootInfo["Port"] = csPort;
     rootInfo["Baudrate"] = csBaudrate;
     spConfigRoot->ReadConfigValue(sectionName.GetData(), "PortNum", csPortNum);
-    spConfigRoot->ReadConfigValue(sectionName.GetData(), "InOutDir", csInOutDir);
     rootInfo["PortNum"] = csPortNum;
-    rootInfo["InOutDir"] = csInOutDir;
 
     std::pair<bool, std::string> strResult;
     strResult = generateJsonStr(rootInfo);
@@ -169,6 +167,54 @@ void CGpioEntity::ToLogRootINIInfo()
     return;
 }
 
+
+struct GpioInitTask : public ITaskSp {
+	CGpioEntity* m_entity;
+	CSmartPointer<ITransactionContext> m_pTransactionContext;
+	GpioInitTask(CGpioEntity* entity, CSmartPointer<ITransactionContext> pTransactionContext) :m_entity(entity), m_pTransactionContext(pTransactionContext) {}
+
+	void Process()
+	{
+		m_entity->InitializeVendorLogSwitch();
+		ErrorCodeEnum err = m_entity->Initial();
+		if (err == Error_Succeed)
+		{
+			LOG_TRACE("Gpio open succeeded.");
+
+			//oiltest 20130118 for audiodg handle
+			m_entity->GetStatus(PHONEPICKUP, NULL);
+
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("subscribelog...");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidHealth, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HealthManager");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidIDC, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "IDCertificate");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidFP, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "FingerPrint");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidKB, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "PinPad");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidCR, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuer");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidCA, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CustomerAware");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidCC, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "ContactlessCard");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidDD, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "DeviceControl");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidCS, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardSwiper");
+			m_entity->GetFunction()->SubscribeLog(m_entity->m_uuidHSPscanner, m_entity, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HSPScanner");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sub ok...");
+
+			m_pTransactionContext->SendAnswer(Error_Succeed);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("send Error_Succeed ok...");
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("gpio open failed(%d).", err); 
+			m_pTransactionContext->SendAnswer(Error_Unexpect);
+		}
+	}
+};
+
+void CGpioEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
+{
+	LOG_FUNCTION();
+	GpioInitTask* initTask = new GpioInitTask(this, pTransactionContext);
+	GetFunction()->PostThreadPoolTask(initTask);
+}
+
 void CGpioEntity::ToLogWarnInfoAboutTerm(const AdapterInfo& m_adapterInfo)
 {
 	LOG_FUNCTION();
@@ -185,10 +231,20 @@ void CGpioEntity::ToLogWarnInfoAboutTerm(const AdapterInfo& m_adapterInfo)
     SP::Module::Util::HexBuf2StrBuf(fileHash, &strFileHash, 32);
 
 	//calculate file size
-	struct stat statbuf;
-	ZeroMemory(&statbuf, sizeof(statbuf));
-	stat(m_adapterInfo.adapterFileName.GetData(), &statbuf);
-	int fileSize = statbuf.st_size;
+#if defined(RVC_OS_LINUX)
+    struct stat statbuf;
+    ZeroMemory(&statbuf, sizeof(statbuf));
+    stat(m_adapterInfo.adapterFilePath.GetData(), &statbuf);
+    int fileSize = statbuf.st_size;
+#else
+    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 = GetFileSize(hFile, NULL);
+        CloseHandle(hFile);
+    }
+#endif //RVC_OS_LINUX
 
 	termInfo["VendorDllName"] = m_adapterInfo.adapterFileName;
 	termInfo["VendorDllFileHash"] = strFileHash;
@@ -199,8 +255,6 @@ void CGpioEntity::ToLogWarnInfoAboutTerm(const AdapterInfo& m_adapterInfo)
 	termInfo["Port"] = m_port;
 	termInfo["PortNum"] = m_portNum;
 	termInfo["Baudrate"] = m_Baudrate;
-	termInfo["InOutDir"] = m_InOutDir;
-
 	if (strFileHash != nullptr) {
 		delete[] strFileHash;
 		strFileHash = nullptr;
@@ -274,21 +328,16 @@ ErrorCodeEnum CGpioEntity::Initial()
         DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("load up %s failed: %s", dllName.GetData(), SpStrError(eErrDev));
         return Error_DevLoadFileFailed;
     }
-	m_adapterInfo.adapterFileName = dllName;
+	m_adapterInfo.adapterFilePath = dllName;
     int initTries = 0;
     do {
         DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to open device.");
-        int portNum, inOutDir, port, baudRate;
+        int portNum, port, baudRate;
         err = spConfig->ReadConfigValueInt("Device.Gpio", "PortNum", portNum);
         if (err == Error_Succeed)
             m_dwPortNum = portNum;
         else
             return Error_IO;
-        err = spConfig->ReadConfigValueInt("Device.Gpio", "InOutDir", inOutDir);
-        if (err == Error_Succeed)
-            m_dwInOutDir = inOutDir;
-        else
-            return Error_IO;
         spConfig->ReadConfigValueInt("Device.Gpio", "Port", port);
         spConfig->ReadConfigValueInt("Device.Gpio", "BaudRate", baudRate);
 
@@ -296,7 +345,6 @@ ErrorCodeEnum CGpioEntity::Initial()
 		m_port = CSimpleStringA::Format("%d", port);
 		m_Baudrate = CSimpleStringA::Format("%d", baudRate);
 		m_portNum = CSimpleStringA::Format("%d", portNum);
-		m_InOutDir = CSimpleStringA::Format("%d", inOutDir);
         GpioInitParam initParam;
         if (!m_bNewVersion) {
             initParam.dwPortNum = 3;
@@ -911,7 +959,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
             if (initCtt == 1) {
                 DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
                 if (DetectBit(btInput, VIBRATIONSENSOR)) {
-                    if (!m_bVibrationFlag && (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)) {
+                    if (!m_bVibrationFlag && IfHaveMoveDetect()) {
                         LogEvent(Severity_Middle, LOG_EVT_VIBRATIONSENSOR,  CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(17), __LINE__));
                     }
                     m_bVibrationFlag = true;
@@ -923,7 +971,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
 
             if (m_bVibrationRound) {
                 if (DetectBit(btInput, VIBRATIONSENSOR) && !m_bVibrationFlag) {
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_VIBRATIONSENSOR, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(17), __LINE__));
                     m_bVibrationFlag = true;
                     m_bVibrationRound = false;
@@ -948,12 +996,12 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
                 DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
                 if (DetectBit(btInput, OPENSENSOR)) {
                     if (!m_bOpenFlag) {
-                        if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                        if (IfHaveMoveDetect())
                             LogEvent(Severity_Middle, LOG_EVT_OPENSENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(18), __LINE__));
                         m_bOpenFlag = true;
                     }
                 } else if (m_bOpenFlag) {
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_OPENSENSOR_OFF, CSimpleStringA::Format("%s [InActive] line: %d", GetDriverPortString(18), __LINE__));
                     m_bOpenFlag = false;
                 }
@@ -962,13 +1010,13 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
 
             if (m_bOpenRound) {
                 if (DetectBit(btInput, OPENSENSOR) && !m_bOpenFlag) {
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_OPENSENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(18), __LINE__));
                     m_bOpenFlag = true;
                     m_bOpenRound = false;
                 }
             } else if (!DetectBit(btInput, OPENSENSOR) && m_bOpenFlag) {
-                if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                if (IfHaveMoveDetect())
                     LogEvent(Severity_Middle, LOG_EVT_OPENSENSOR_OFF, CSimpleStringA::Format("%s [InActive] line: %d", GetDriverPortString(18), __LINE__));
                 m_bOpenFlag = false;
                 m_bOpenRound = true;
@@ -986,8 +1034,8 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
         do {
 
             if (initCtt == 1) {
-                DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
-                if (m_ePickUpFlag == Unknown) {
+			    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
+                if (m_ePickUpFlag == UnknownStatus) {
                     if (DetectBit(btInput, PICKUPSENSOR)) m_ePickUpFlag = Actived;
                     else if (!DetectBit(btInput, PICKUPSENSOR)) m_ePickUpFlag = InActive;
                     DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Set initial value: %d", (int)m_ePickUpFlag);
@@ -997,7 +1045,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
                     if (DetectBit(btInput, PICKUPSENSOR)) {
                         if (m_ePickUpFlag == InActive) {
 
-                            if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                            if (IfHaveMoveDetect())
                                 LogEvent(Severity_Middle, LOG_EVT_PICKUP, "话机提起");
 
                             m_ePickUpFlag = Actived;
@@ -1005,7 +1053,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
 
                     } else if (m_ePickUpFlag == Actived) {
 
-                        if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                        if (IfHaveMoveDetect())
                             LogEvent(Severity_Middle, LOG_EVT_ONHOOK, "话机放下");
 
                         m_ePickUpFlag = InActive;
@@ -1020,13 +1068,13 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
 
                     if (m_ePickUpFlag == InActive) {
 
-                        if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                        if (IfHaveMoveDetect())
                             LogEvent(Severity_Middle, LOG_EVT_PICKUP, "话机提起");
 
                         m_ePickUpFlag = Actived;
                         m_bPickUpRound = false;
 
-                    } else if (m_ePickUpFlag == Unknown) {
+                    } else if (m_ePickUpFlag == UnknownStatus) {
                         m_ePickUpFlag = Actived;
                     }
                 }
@@ -1034,13 +1082,13 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
 
                 if (m_ePickUpFlag == Actived) {
 
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_ONHOOK, "话机放下");
 
                     m_ePickUpFlag = InActive;
                     m_bPickUpRound = true;
 
-                } else if (m_ePickUpFlag == Unknown) {
+                } else if (m_ePickUpFlag == UnknownStatus) {
                     m_ePickUpFlag = InActive;
                 }
             }
@@ -1058,7 +1106,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
             if (initCtt == 1) {
                 DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
                 if (DetectBit(btInput, MOVESENSOR)) {
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_MOVESENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(20), __LINE__));
                 }
                 break;
@@ -1069,12 +1117,20 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
                     m_moveDisappearTimes = 0;
                     if (m_moveHoldTimes < MAX_MOVE_HOLD_TIMES) { // 100ms * 5000
                         if ((m_moveHoldTimes % LOG_TIME_VALUE) == 0) {  //100ms * 25 = 2.5s 但因为厂家接口调用,不进来计数,需要800ms+
-                            if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                            if (IfHaveMoveDetect())
                                 LogEvent(Severity_Middle, LOG_EVT_MOVESENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(20), __LINE__));
                         }
                     } else if ((m_moveHoldTimes % MAX_MOVE_HOLD_TIMES) == 0) { //难道8分钟一直有人就异常?还有一个 Round 标识
-                        if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
-                            LogWarn(Severity_Middle, Error_Unexpect, LOG_EVT_MOVEDETECT_ABNORMAL, "移动次数异常");
+                        if (IfHaveMoveDetect()) {
+								SYSTEMTIME localTime;
+								GetLocalTime(&localTime);
+								if (localTime.wHour > 8 && localTime.wHour < 18)
+									LogWarn(Severity_High, Error_Unexpect, LOG_EVT_MOVEDETECT_ABNORMAL_WORKTIME, "Move detect is abnormal(Work time).");
+								else
+									LogWarn(Severity_High, Error_Unexpect, LOG_EVT_MOVEDETECT_ABNORMAL_OFFWORK, "Move detect is abnormal(off work).");
+						
+						}
+
                     }
                     m_moveHoldTimes++;
                     m_bMoveRound = false;
@@ -1082,7 +1138,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
             } else if (!DetectBit(btInput, MOVESENSOR)) {
                 m_moveHoldTimes = 0;
                 if ((m_moveDisappearTimes % LOG_TIME_VALUE) == 0) {
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_MOVESENSOR_OFF, CSimpleStringA::Format("%s [InActive] line: %d", GetDriverPortString(20), __LINE__));
                 }
                 m_moveDisappearTimes++;
@@ -1104,7 +1160,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
                 DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
                 if (DetectBit(btInput, CARDGATESENSOR)) {
                     if (!m_bCardGateFlag) {
-                        if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                        if (IfHaveMoveDetect())
                             LogEvent(Severity_Middle, LOG_EVT_CARDGATESENSOR, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(21), __LINE__));
                         m_bCardGateFlag = true;
                     }
@@ -1115,7 +1171,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
 
             if (m_bCardGateRound) {
                 if (DetectBit(btInput, CARDGATESENSOR) && !m_bCardGateFlag) {
-                    if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus)
+                    if (IfHaveMoveDetect())
                         LogEvent(Severity_Middle, LOG_EVT_CARDGATESENSOR, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(21), __LINE__));
                     m_bCardGateFlag = true;
                     m_bCardGateRound = false;
@@ -1175,7 +1231,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
     if (pGci->CttPhone > 1 && !bPhoneOne) {
         do {
 
-            if (m_ePickUpFlag == Unknown) {
+            if (m_ePickUpFlag == UnknownStatus) {
                 if (DetectBit(btInput, PICKUPSENSOR)) m_ePickUpFlag = Actived;
                 else if (!DetectBit(btInput, PICKUPSENSOR)) m_ePickUpFlag = InActive;
                 DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Set initial value: %d", (int)m_ePickUpFlag);
@@ -1359,6 +1415,14 @@ BYTE CGpioEntity::GetOutputStatus(int sn)
         return 0;
 }
 
+bool CGpioEntity::IfHaveMoveDetect()
+{
+	if (m_eMachineType == RVC_Stand2S || m_eMachineType == RVC_Stand1SPlus ||m_eMachineType == RVC_CardPrinter)
+		return true;
+	else
+		return false;
+}
+
 SP_BEGIN_ENTITY_MAP()
-SP_ENTITY(CGpioEntity)
-SP_END_ENTITY_MAP()
+	SP_ENTITY(CGpioEntity)
+SP_END_ENTITY_MAP() 

+ 22 - 69
Module/mod_gpio/mod_gpio.h

@@ -11,7 +11,9 @@
 #include "DevFSMCommBase.hpp"
 #include "CommEntityUtil.hpp"
 
+using namespace std;
 using namespace Gpio;
+
 const int GPIO_INIT_COUNT = 3;
 typedef ErrorCodeEnum (*lpCreateDevCom)(DeviceBaseClass *&baseObj);
 typedef ErrorCodeEnum (*lpReleaseDevCom)(DeviceBaseClass *&pBaseObj);
@@ -45,7 +47,7 @@ enum PinPort{
 /*用于标识等挂机等状态,布尔型不能满足,需要有一个初始状态*/
 enum PinActiveStatus
 {
-	Unknown,
+	UnknownStatus,
 	InActive,
 	Actived
 };
@@ -142,12 +144,12 @@ class CGpioEntity : public CDevAdptEntityBase, public ILogListener
 public:
 	//0000 0000 0000 0010 0110 1111 1100 0000
 	CGpioEntity():m_bPickUpRound(false),m_bVibrationRound(false)
-		,m_bOpenRound(false),m_bMoveRound(false),m_bCardGateRound(false), m_ePickUpFlag(Unknown)
+		,m_bOpenRound(false),m_bMoveRound(false),m_bCardGateRound(false), m_ePickUpFlag(UnknownStatus)
 		,m_bVibrationFlag(false),m_bOpenFlag(false),m_bMoveFlag(false),m_bCardGateFlag(false)
 		, m_pLogListener(NULL), m_bHeadLightFlag(false), m_headlightDevPort(0), m_moveHoldTimes(0)
 		, m_moveDisappearTimes(0),m_eMachineType(SP::Module::Comm::RVC_UNKNOWN)
 		, m_bNewVersion(FALSE), m_bFuncVer2(FALSE), m_FirstStart(true)
-		, m_csDevNo(""), m_port(""), m_portNum(""), m_Baudrate(""), m_InOutDir("")
+		, m_csDevNo(true), m_port(true), m_portNum(true), m_Baudrate(true)
 	{
 		m_timerID = 1;
 		currDevStatus.dir = 0x3eFC0;
@@ -155,70 +157,20 @@ public:
 		//currDevStatus.dir = 0x7ffb0;
 		memset(m_btOutputStatus,0,MAX_PORT_NUM);
 		currDevStatus.output = 0x0;
+//		currDir = 0x2007ffff;
+		//m_pPIUT = new PositivePulseUpTimer();
+		HARDWARE_ENTITY_RESET_ENTITYID(m_entCode, 0x209);
 	}
-
-#ifdef RVC_OS_LINUX
-	unsigned long GetTickCount()
-	{
-		struct timespec ts;
-		clock_gettime(CLOCK_MONOTONIC, &ts);
-		return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
-	}
-#endif
-
-	virtual ~CGpioEntity()
-	{
-		LOG_FUNCTION();
-	}
-
+	virtual ~CGpioEntity(){}
 	virtual const char* GetEntityName()const {return "Gpio";}
 	const char* GetEntityVersion() const { return MODULE_VERSION_FULL; }
-
-	virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext)
-	{
-		LOG_FUNCTION();
-		InitializeVendorLogSwitch();
-
-		ErrorCodeEnum err = Initial();
-		if (err == Error_Succeed)
-		{
-			LOG_TRACE("Gpio open succeeded.");
-
-			GetStatus(PHONEPICKUP,NULL);
-
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("subscribelog...");
-			GetFunction()->SubscribeLog(m_uuidHealth,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"HealthManager");
-			GetFunction()->SubscribeLog(m_uuidIDC,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"IDCertificate");
-			GetFunction()->SubscribeLog(m_uuidFP, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "FingerPrint");
-			GetFunction()->SubscribeLog(m_uuidKB,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"PinPad");
-			GetFunction()->SubscribeLog(m_uuidCR,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"CardIssuer");
-			GetFunction()->SubscribeLog(m_uuidCA,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"CustomerAware");
-			GetFunction()->SubscribeLog(m_uuidCC,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"ContactlessCard");
-			GetFunction()->SubscribeLog(m_uuidDD,this,Log_Event,Severity_Middle,Error_IgnoreAll,-1,"DeviceControl");
-			GetFunction()->SubscribeLog(m_uuidCS, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardSwiper");
-			GetFunction()->SubscribeLog(m_uuidHSPscanner, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HSPScanner");
-            GetFunction()->SubscribeLog(m_uuidIE, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "IEBrowser");
-
-#if defined(RVC_OS_WIN)
-			GetFunction()->SubscribeLog(m_uuidPtr, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "Printer");
-            GetFunction()->SubscribeLog(m_uuidPrintSeal, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "PrintSeal");
-#endif //RVC_OS_WIN
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("subscribelog ok...");
-
-			pTransactionContext->SendAnswer(Error_Succeed);
-		}
-		else
-		{
-			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("gpio open failed(%s).",SpStrError(err));
-			pTransactionContext->SendAnswer(Error_Unexpect);
-		}
-	}
-
+	
+	virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext);
+	
 	virtual void OnPrePause(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CSimpleStringA initDriver = "";
 		int driverPort;
-		ErrorCodeEnum Error;
         initDriver = "CardReaderNormal";
         driverPort = 0;
 		OutDrivingInfo odi;
@@ -272,12 +224,13 @@ public:
 	void ToLogRootINIInfo();
 	void ToLogWarnInfoAboutTerm(const AdapterInfo& m_adapterInfo);
 	bool DetectBit(ULONG data, int pos);
-private:
 
-	HMODULE m_hVerdorDll;
-	lpCreateDevCom CreateDevComponent;
-	lpReleaseDevCom ReleaseDevComponent;
+public:
+
+    CUUID m_uuidHealth, m_uuidPtr, m_uuidCR, m_uuidIDC, m_uuidFP, m_uuidKB, m_uuidCA, m_uuidCC, m_uuidDD, m_uuidCS, m_uuidIE;
+    CUUID m_uuidHSPscanner;
 
+private:
 	DevAdptLibHelper<GpioClass> m_hDevHelper;
 	SP::Module::Comm::What m_eMachineType;
 
@@ -285,9 +238,7 @@ private:
 	DWORD m_dwPortNum,m_dwInOutDir;
 	BOOL m_bNewVersion;
 	BOOL m_bFuncVer2;
-	CUUID m_uuidHealth,m_uuidPtr,m_uuidCR,m_uuidIDC,m_uuidFP,m_uuidKB,m_uuidCA,m_uuidCC,m_uuidDD,m_uuidCS,m_uuidIE,m_uuidPrinter;
-	CUUID m_uuidHSPscanner;
-	CUUID m_uuidPrintSeal;
+
 	DevOutputInfo currDevStatus;
 	DevCategoryInfo m_devCatInfo;
 	ULONG m_timerID;
@@ -297,13 +248,15 @@ private:
 	bool m_bHeadLightFlag;
 	int m_headlightDevPort, m_moveHoldTimes, m_moveDisappearTimes;
 	ILogListener *m_pLogListener;
-	CSimpleStringA m_csMachineType;
+	CSimpleStringA m_csMachineType, m_csAlarmMsg;
+	DevEntityErrorCode m_entCode;
+	bool IfHaveMoveDetect();
+	ErrorPackage m_errPkg;
 	AdapterInfo m_adapterInfo;
 	CSimpleStringA m_csDevNo;
 	CSimpleStringA m_port;
 	CSimpleStringA m_portNum;
 	CSimpleStringA m_Baudrate;
-	CSimpleStringA m_InOutDir;
 	bool m_FirstStart;
 };