|
@@ -6,7 +6,6 @@
|
|
|
const int MAX_GPIO_INIT_TRIES = 3;
|
|
|
const int INPUT_PORT_2 = 2;
|
|
|
const int MAX_MOVE_HOLD_TIMES = 5000;
|
|
|
-const int LOG_TIME_VALUE = 25;
|
|
|
const int ON_EVENT_DETECT_TIMOUE_MILLSECS = 500;
|
|
|
const int REPEAT_FIRE_TIMEOUT_VALUE = 10000; //10s
|
|
|
|
|
@@ -291,7 +290,6 @@ void CGpioEntity::ToLogRootINIInfo()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
struct GpioInitTask : public ITaskSp {
|
|
|
CGpioEntity* m_entity;
|
|
|
CSmartPointer<ITransactionContext> m_pTransactionContext;
|
|
@@ -382,8 +380,15 @@ void CGpioEntity::SetErrorAndLog(ErrorCodeEnum errCode
|
|
|
}
|
|
|
const CSimpleStringA alarmMsg = CSimpleStringA::Format("{\"Function\":\"%s\", \"DevApi\":\"%s\", \"ReturnCode\":\"%s\", \"Msg\":\"%s\", \"Context\":\"%s\"}"
|
|
|
, funPath.GetData(), devApi.GetData(), SpStrError(errCode), devErrInfo.szErrMsg, context.GetData());
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = CSimpleStringA::Format("{\"ReturnCode\":\"%s\", \"ErrMsg\":\"%s\", \"Context\":\"%s\"}", SpStrError(errCode), devErrInfo.szErrMsg, context.GetData());
|
|
|
|
|
|
+ std::map<std::string, std::string> msgInfo;
|
|
|
+ msgInfo["ReturnCode"] = SpStrError(errCode);
|
|
|
+ msgInfo["ErrMsg"] = devErrInfo.szErrMsg;
|
|
|
+ msgInfo["Context"] = context.GetData();
|
|
|
+ std::pair<bool, std::string> strResult;
|
|
|
+ strResult = generateJsonStr(msgInfo);
|
|
|
+ CSimpleStringA csErrMsgWithReturnCode = strResult.second.c_str();
|
|
|
+
|
|
|
CSimpleStringA tmpRTA(true), tmpDesc(true);
|
|
|
if (GetFunction()->GetVTMErrMsg(userCode, tmpDesc, tmpRTA) != Error_Succeed)
|
|
|
tmpRTA = CSimpleStringA::Format("0x%X", userCode);//if map failed, use dwCode instead
|
|
@@ -450,7 +455,8 @@ ErrorCodeEnum CGpioEntity::Initial()
|
|
|
m_adapterInfo.strPortNum = csPortNum; //Just load from Config
|
|
|
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("[%s],[%s],[%s]", m_adapterInfo.strVendor.GetData(), m_adapterInfo.strVersion.GetData(), m_adapterInfo.strBatch.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("[%s],[%s],[%s]", m_adapterInfo.strVendor.GetData()
|
|
|
+ , m_adapterInfo.strVersion.GetData(), m_adapterInfo.strBatch.GetData());
|
|
|
//TODO: 这个看怎么兼容后移除 [Gifur@202494]
|
|
|
//Gpio.keba.1.1 , Gpio.Hyosung.1.1, Gpio.kxd.1.1 均为 老设备,2024-9-11发现现有生产有2249台
|
|
|
if (!_stricmp(m_adapterInfo.strVendor, "Hyosung") || !_stricmp(m_adapterInfo.strVendor, "Keba") || !_stricmp(m_adapterInfo.strVendor, "Kxd")) {
|
|
@@ -489,7 +495,7 @@ ErrorCodeEnum CGpioEntity::Initial()
|
|
|
ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
|
|
|
if (err == Error_Succeed) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::DevOpen").setCostTime(ullEnd - ullStart)("open device succ");
|
|
|
- ToLogRootINIInfo(); //这里是重新读一遍原生的root配置信息
|
|
|
+ ToLogRootINIInfo(); //WARN:这里是重新读一遍原生的root配置信息
|
|
|
DevCategoryInfo devCatInfo;
|
|
|
ZeroMemory(devCatInfo.szModel, sizeof(devCatInfo.szModel));
|
|
|
ZeroMemory(devCatInfo.szType, sizeof(devCatInfo.szType));
|
|
@@ -550,7 +556,7 @@ ErrorCodeEnum CGpioEntity::Initial()
|
|
|
eErrDev = m_hDevHelper->SetStatus(GPIO_DEV_SN_LIGHT_SENSOR_ALL, GPIO_DEV_LIGHT_MODE_RESET);
|
|
|
ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
|
|
|
if (eErrDev != Error_Succeed)
|
|
|
- SetErrorAndLog(eErrDev, GPIO_UserErrorCode_SetStatus_Failed, "DevAdapter::WritePort", __FUNCTION__, false, ullEnd - ullStart, "", CombineJsonContext("SetStatus after DevOpen"));
|
|
|
+ SetErrorAndLog(eErrDev, GPIO_UserErrorCode_SetStatus_Failed, "DevAdapter::SetStatus", __FUNCTION__, false, ullEnd - ullStart, "", CombineJsonContext("SetStatus after DevOpen"));
|
|
|
#endif //RVC_OS_LINUX
|
|
|
}
|
|
|
}
|
|
@@ -568,11 +574,11 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, con
|
|
|
|
|
|
GpioService_Set_Info Req;
|
|
|
if (!m_bOpened) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("usercode [%x], but device is not open", dwUserCode);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("usercode [%x], but device is not open", dwUserCode);
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("usercode [%x]", dwUserCode);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("receive usercode [%x]", dwUserCode);
|
|
|
}
|
|
|
Req.close = 0;
|
|
|
switch (dwUserCode) {
|
|
@@ -678,7 +684,7 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, con
|
|
|
//DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("unkown event: 0x%X", dwUserCode);
|
|
|
return;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("devseq[%d],mode[%d]close[%d]", Req.devseq, Req.mode, Req.close);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("devseq[%d],mode[%d]close[%d]", Req.devseq, Req.mode, Req.close);
|
|
|
m_bFuncVer2 ? SetEx(Req) : Set(Req);
|
|
|
}
|
|
|
|
|
@@ -721,7 +727,7 @@ void CGpioEntity::SetEx(GpioService_Set_Info req)
|
|
|
#if defined(RVC_OS_LINUX)
|
|
|
|
|
|
int devicePort;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SetEx request %s arrived!", GetLightSeqString(req.devseq));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("SetEx request %s arrived!", GetLightSeqString(req.devseq));
|
|
|
switch (req.devseq) {
|
|
|
case CARDREADER:
|
|
|
{
|
|
@@ -770,7 +776,7 @@ void CGpioEntity::SetEx(GpioService_Set_Info req)
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("unsupport device seq: %d", req.devseq);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(__FUNCTION__)("unsupport device seq: %d", req.devseq);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -795,7 +801,7 @@ void CGpioEntity::SetEx(GpioService_Set_Info req)
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::SetStatus").setAPI(__FUNCTION__).setCostTime(iEnd - iBegin)("SetStatus with 0x%X,0x%X", dwReq, dwMode);
|
|
|
}
|
|
|
} else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("dev helper object is invalid pointer!");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("dev helper object is invalid pointer!");
|
|
|
}
|
|
|
#endif //RVC_OS_LINUX
|
|
|
}
|
|
@@ -805,7 +811,7 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
CSimpleStringA activeModeSecName = "";
|
|
|
int devicePort;
|
|
|
OutDrivingInfo odi;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Set request %s arrived!", GetLightSeqString(req.devseq));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Set request %s arrived!", GetLightSeqString(req.devseq));
|
|
|
switch (req.devseq) {
|
|
|
case CARDREADER:
|
|
|
case PINPAD:
|
|
@@ -868,7 +874,7 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
odi.SetTime = 200;
|
|
|
odi.ResetTime = 200;
|
|
|
odi.TimeOut = 5000;
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("unsupport device seq: %d", req.devseq);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("unsupport device seq: %d", req.devseq);
|
|
|
return;
|
|
|
}
|
|
|
SetOutDriving(req, odi, 0, devicePort);
|
|
@@ -877,7 +883,6 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
void CGpioEntity::StartDetectWorkThread()
|
|
|
{
|
|
|
ReceivingInfo ri;
|
|
|
- ri.InputMode = IM_POSITIVE_LEVEL;
|
|
|
ri.ContinuousTriggerTime = 2;
|
|
|
|
|
|
GetContextInfo* pGci = new GetContextInfo();
|
|
@@ -896,6 +901,7 @@ void CGpioEntity::OnPositiveFlickerSetTimerout(void* pData)
|
|
|
ITimerListener* pListener = new TimerOutHelper<CGpioEntity>(this, &CGpioEntity::OnPositiveFlickerResetTimerout, pSCI, true);
|
|
|
GetFunction()->SetTimer(pSCI->timerID, pListener, pSCI->resetTime);
|
|
|
}
|
|
|
+
|
|
|
void CGpioEntity::OnPositiveFlickerResetTimerout(void* pData)
|
|
|
{
|
|
|
SetContextInfo* pSCI = (SetContextInfo*)pData;
|
|
@@ -1081,6 +1087,7 @@ void CGpioEntity::OnEventDetect(void* pData)
|
|
|
if (DetectBit(btInput, OPENSENSOR) && !m_bOpenFlag) {
|
|
|
m_bOpenFlag = true;
|
|
|
LogEvent(Severity_Middle, LOG_EVT_OPENSENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(18), __LINE__));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(GpioService_LogCode_Detect_DoorOpen)("[GPIO] The chassis door is open");
|
|
|
}
|
|
|
else if (!DetectBit(btInput, OPENSENSOR) && m_bOpenFlag) {
|
|
|
m_bOpenFlag = false;
|
|
@@ -1091,10 +1098,11 @@ void CGpioEntity::OnEventDetect(void* pData)
|
|
|
if (DetectBit(btInput, PICKUPSENSOR)) {
|
|
|
if (m_ePickUpFlag == InActive) {
|
|
|
LogEvent(Severity_Middle, LOG_EVT_PICKUP, "Life the Phone up");
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("话机提起");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(GpioService_LogCode_Detect_PhonePickup)("[GPIO] 话机提起");
|
|
|
m_ePickUpFlag = Actived;
|
|
|
}
|
|
|
else if (m_ePickUpFlag == UnknownStatus) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(GpioService_LogCode_Detect_PhonePickup)("[GPIO] 话机提起(启动时)");
|
|
|
m_ePickUpFlag = Actived;
|
|
|
}
|
|
|
} else if (!DetectBit(btInput, PICKUPSENSOR)) {
|
|
@@ -1150,6 +1158,7 @@ void CGpioEntity::OnEventDetect(void* pData)
|
|
|
if (DetectBit(btInput, CARDGATESENSOR) && !m_bCardGateFlag) {
|
|
|
m_bCardGateFlag = true;
|
|
|
LogEvent(Severity_Middle, LOG_EVT_CARDGATESENSOR, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(21), __LINE__));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(GpioService_LogCode_Detect_CardMouseJam)("[GPIO] The card mouse is jam");
|
|
|
}
|
|
|
else if (!DetectBit(btInput, CARDGATESENSOR) && m_bCardGateFlag) {
|
|
|
LogEvent(Severity_Middle, LOG_EVT_CARDGATESENSOR_OFF, CSimpleStringA::Format("%s [InActive] line: %d", GetDriverPortString(21), __LINE__));
|
|
@@ -1159,14 +1168,6 @@ void CGpioEntity::OnEventDetect(void* pData)
|
|
|
GetFunction()->ResetTimer(pGci->timerID, ON_EVENT_DETECT_TIMOUE_MILLSECS);
|
|
|
}
|
|
|
|
|
|
-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()
|