|
|
@@ -19,13 +19,6 @@ int negative_level_count = 0;
|
|
|
|
|
|
using namespace SP::Module::Comm;
|
|
|
|
|
|
-bool DetectBit(ULONG data, int pos)
|
|
|
-{
|
|
|
- ULONG tmp = 0;
|
|
|
- SETBIT(tmp, pos);
|
|
|
- return data & tmp;
|
|
|
-}
|
|
|
-
|
|
|
static const char* GetDriverPortString(int pin)
|
|
|
{
|
|
|
switch (pin) {
|
|
|
@@ -86,10 +79,8 @@ static const char* GetLightSeqString(int seq)
|
|
|
LIGHT_STRING_CONVERT(UNKNOWN_DEVICE)
|
|
|
LIGHT_STRING_CONVERT(CARDREADER)
|
|
|
LIGHT_STRING_CONVERT(CARDREADER_RED)
|
|
|
- LIGHT_STRING_CONVERT(PRINTER)
|
|
|
LIGHT_STRING_CONVERT(IDCERTIFICATE)
|
|
|
LIGHT_STRING_CONVERT(PINPAD)
|
|
|
- LIGHT_STRING_CONVERT(PINPADLIGHT)
|
|
|
LIGHT_STRING_CONVERT(SHAKEDETECT)
|
|
|
LIGHT_STRING_CONVERT(SWITCHINDUCTOR)
|
|
|
LIGHT_STRING_CONVERT(PHONEPICKUP)
|
|
|
@@ -98,11 +89,8 @@ static const char* GetLightSeqString(int seq)
|
|
|
LIGHT_STRING_CONVERT(HEADLIGHT)
|
|
|
LIGHT_STRING_CONVERT(HEADLIGHT_RED)
|
|
|
LIGHT_STRING_CONVERT(CONTACTLESSCARD)
|
|
|
- LIGHT_STRING_CONVERT(USBCONTROL)
|
|
|
- LIGHT_STRING_CONVERT(USBLIGHT)
|
|
|
LIGHT_STRING_CONVERT(HEADLIGHT_ASSIST)
|
|
|
LIGHT_STRING_CONVERT(HSPSCANNER)
|
|
|
- LIGHT_STRING_CONVERT(PRINTER_SEAL)
|
|
|
LIGHT_STRING_CONVERT(FINGERPRINT)
|
|
|
default:
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Unkonwn LightSeq: %d", seq);
|
|
|
@@ -115,28 +103,19 @@ static const char* GetLightSeqString(int seq)
|
|
|
|
|
|
void CGpioServiceSession::Handle_Set(SpOnewayCallContext<GpioService_Set_Info>::Pointer ctx)
|
|
|
{
|
|
|
- DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
- GpioService_Set_Info req = ctx->Info;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("devseq=%d", req.devseq);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("mode=%d", req.mode);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("close=%d", req.close);
|
|
|
- m_pEntity->Set(req);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void CGpioServiceSession::Handle_GetStatus(SpReqAnsContext<GpioService_GetStatus_Req, GpioService_GetStatus_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
- m_pEntity->GetStatus(ctx->Req.devseq, ctx);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(__FUNCTION__);
|
|
|
+ ctx->Answer(Error_NotSupport);
|
|
|
}
|
|
|
|
|
|
void CGpioServiceSession::Handle_QueryCurrSet(SpReqAnsContext<GpioService_QueryCurrSet_Req, GpioService_QueryCurrSet_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
- DevOutputInfo output;
|
|
|
- output = m_pEntity->GetCurrDevStatus();
|
|
|
- ctx->Ans.dir = output.dir;
|
|
|
- ctx->Ans.output = m_pEntity->GetOutputStatus(0);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(__FUNCTION__);
|
|
|
+ ctx->Answer(Error_NotSupport);
|
|
|
}
|
|
|
|
|
|
bool isnostr(const char* str)
|
|
|
@@ -288,6 +267,20 @@ void CGpioEntity::ToLogWarnInfoAboutTerm(const AdapterInfo& m_adapterInfo)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+bool CGpioEntity::DetectBit(ULONG data, int pos)
|
|
|
+{
|
|
|
+ if (!m_bFuncVer2) {
|
|
|
+ ULONG tmp = 0;
|
|
|
+ SETBIT(tmp, pos);
|
|
|
+ return data & tmp;
|
|
|
+ } else {
|
|
|
+ if (m_hDevHelper != nullptr) {
|
|
|
+ DWORD dwReq = (GPIO_DEV_SN_SENSOR_SHAKE << pos);
|
|
|
+ return (data & dwReq);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
ErrorCodeEnum CGpioEntity::Initial()
|
|
|
{
|
|
|
ErrorCodeEnum err;
|
|
|
@@ -378,12 +371,17 @@ ErrorCodeEnum CGpioEntity::Initial()
|
|
|
err = m_hDevHelper->GetDevCategory(m_devCatInfo);
|
|
|
if (err == Error_Succeed) {
|
|
|
m_adapterInfo.FulfillCategoryInfo(m_devCatInfo);
|
|
|
- ToLogWarnInfoAboutTerm(m_adapterInfo);
|
|
|
+ CSimpleStringA strType(m_devCatInfo.szType);
|
|
|
+ if (strType.IndexOf("FUNCVER=2.0") != -1) {
|
|
|
+ m_bFuncVer2 = TRUE;
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Detect new interface version: %s", strType.GetData());
|
|
|
+ }
|
|
|
+ ToLogWarnInfoAboutTerm(m_adapterInfo);
|
|
|
} else {
|
|
|
DevErrorInfo devErrInfo;
|
|
|
ZeroMemory(&devErrInfo, sizeof(devErrInfo));
|
|
|
m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
- errMsg = CSimpleStringA::Format("GetDevCategory failed:%d(s)", err, devErrInfo.szErrMsg);
|
|
|
+ errMsg = CSimpleStringA::Format("GetDevCategory failed:%s(s)", SpStrError(err), devErrInfo.szErrMsg);
|
|
|
LogWarn(Severity_Middle, Error_Unexpect, GPIO_UserErrorCode_GetDevCategory_Failed, errMsg.GetData());
|
|
|
}
|
|
|
initTries = 0;
|
|
|
@@ -405,16 +403,18 @@ ErrorCodeEnum CGpioEntity::Initial()
|
|
|
err = Error_DevConnFailed;
|
|
|
}
|
|
|
|
|
|
- err = m_hDevHelper->WritePort(0, 0x00);
|
|
|
- if (err != Error_Succeed)
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("write ports(0) returned: %s)", SpStrError(err));
|
|
|
- err = m_hDevHelper->WritePort(1, 0x00);
|
|
|
- if (err != Error_Succeed)
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("write ports(1) returned: %s)", SpStrError(err));
|
|
|
- if (m_bNewVersion) {
|
|
|
- err = m_hDevHelper->WritePort(3, 0x00);
|
|
|
- if (err != Error_Succeed)
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("write ports(3) returned: %s)", SpStrError(err));
|
|
|
+ if (!m_bFuncVer2) {
|
|
|
+ err = m_hDevHelper->WritePort(0, 0x00);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("write ports(0) returned: %s)", SpStrError(err));
|
|
|
+ err = m_hDevHelper->WritePort(1, 0x00);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("write ports(1) returned: %s)", SpStrError(err));
|
|
|
+ if (m_bNewVersion) {
|
|
|
+ err = m_hDevHelper->WritePort(3, 0x00);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("write ports(3) returned: %s)", SpStrError(err));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ err = m_hDevHelper->SetStatus(GPIO_DEV_SN_LIGHT_SENSOR_ALL, GPIO_DEV_LIGHT_MODE_RESET);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("write resetone returned: %s)", SpStrError(err));
|
|
|
}
|
|
|
|
|
|
//oilyang@20170214
|
|
|
@@ -432,10 +432,12 @@ ErrorCodeEnum CGpioEntity::Initial()
|
|
|
m_moveHoldTimes = MAX_MOVE_HOLD_TIMES;//oiltmp about 5000*300ms = 25 minutes
|
|
|
}
|
|
|
m_moveDisappearTimes = m_moveHoldTimes;
|
|
|
+
|
|
|
m_eMachineType = SP::Module::Comm::GetTerminalMachineInfo(this).type;
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("machine type: %s", SP::Module::Comm::Type2Str(m_eMachineType));
|
|
|
return err;
|
|
|
}
|
|
|
+
|
|
|
void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
|
|
|
const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
|
|
|
const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo)
|
|
|
@@ -469,7 +471,7 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, con
|
|
|
case LOG_EVT_HEADLIGHT_GREEN_ON:
|
|
|
m_bHeadLightFlag = true;
|
|
|
Req.devseq = HEADLIGHT;
|
|
|
- Req.mode = 1;
|
|
|
+ Req.mode = 0;
|
|
|
LOG_TRACE("machine light on");
|
|
|
break;
|
|
|
case LOG_EVT_HEADLIGHT_RED_ON:
|
|
|
@@ -480,14 +482,6 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, con
|
|
|
Req.devseq = CONTACTLESSCARD;
|
|
|
Req.mode = 1;
|
|
|
break;
|
|
|
- case LOG_EVT_USB_CONTROL_ON:
|
|
|
- Req.devseq = USBCONTROL;
|
|
|
- Req.mode = 1;
|
|
|
- break;
|
|
|
- case LOG_EVT_USB_LIGHT_ON:
|
|
|
- Req.devseq = USBLIGHT;
|
|
|
- Req.mode = 1;
|
|
|
- break;
|
|
|
case LOG_EVT_IEBROWSER_LIGHT_ASSISTANT_ON:
|
|
|
Req.devseq = HEADLIGHT_ASSIST;
|
|
|
Req.mode = 1;
|
|
|
@@ -536,16 +530,6 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, con
|
|
|
Req.mode = 1;
|
|
|
Req.close = 1;
|
|
|
break;
|
|
|
- case LOG_EVT_USB_CONTROL_OFF:
|
|
|
- Req.devseq = USBCONTROL;
|
|
|
- Req.mode = 1;
|
|
|
- Req.close = 1;
|
|
|
- break;
|
|
|
- case LOG_EVT_USB_LIGHT_OFF:
|
|
|
- Req.devseq = USBLIGHT;
|
|
|
- Req.mode = 1;
|
|
|
- Req.close = 1;
|
|
|
- break;
|
|
|
case LOG_EVT_IEBROWSER_LIGHT_ASSISTANT_OFF:
|
|
|
Req.devseq = HEADLIGHT_ASSIST;
|
|
|
Req.mode = 1;
|
|
|
@@ -566,17 +550,8 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, con
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("unkown event: 0x%X", dwUserCode);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- if (m_eMachineType != RVC_Stand1SPlus
|
|
|
- || (dwUserCode == LOG_EVT_HEADLIGHT_GREEN_ON || dwUserCode == LOG_EVT_HEADLIGHT_RED_ON || dwUserCode == LOG_EVT_IEBROWSER_LIGHT_ASSISTANT_ON
|
|
|
- || dwUserCode == LOG_EVT_HEADLIGHT_GREEN_OFF || dwUserCode == LOG_EVT_HEADLIGHT_RED_OFF || dwUserCode == LOG_EVT_IEBROWSER_LIGHT_ASSISTANT_OFF)) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("devseq[%d],mode[%d]close[%d]", Req.devseq, Req.mode, Req.close);
|
|
|
- Set(Req);
|
|
|
-
|
|
|
- } else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Stand1S: devseq[%d],mode[%d]close[%d] is not supported!", Req.devseq, Req.mode, Req.close);
|
|
|
- }
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("devseq[%d],mode[%d]close[%d]", Req.devseq, Req.mode, Req.close);
|
|
|
+ m_bFuncVer2 ? SetEx(Req) : Set(Req);
|
|
|
}
|
|
|
|
|
|
void CGpioEntity::WritePin(DWORD dwPinSeq, bool bHighLevel)
|
|
|
@@ -623,6 +598,87 @@ void CGpioEntity::WritePin(DWORD dwPinSeq, bool bHighLevel)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void CGpioEntity::SetEx(GpioService_Set_Info req)
|
|
|
+{
|
|
|
+ int devicePort;
|
|
|
+ LOG_TRACE("SetEx request %s arrived!", GetLightSeqString(req.devseq));
|
|
|
+ switch (req.devseq) {
|
|
|
+ case CARDREADER:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_CARDISSUER;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case CARDREADER_RED:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_CARDISSUER_MAINTAIN;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case IDCERTIFICATE:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_IDCERTIFICATE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case FINGERPRINT:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_FINGERPRINT;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case PINPAD:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_PINPAD;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case HEADLIGHT:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_FACE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case HEADLIGHT_RED:
|
|
|
+ {
|
|
|
+ devicePort = 6/*GPIO_DEV_SN_LIGHT_MACHINE_FAULT*/;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case CONTACTLESSCARD:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_CONTACTLESSCARD;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case HEADLIGHT_ASSIST:
|
|
|
+ {
|
|
|
+ devicePort = GPIO_DEV_SN_LIGHT_FACE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("unsupport device seq: %d", req.devseq);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_hDevHelper != nullptr) {
|
|
|
+ DWORD dwReq = devicePort;
|
|
|
+ DWORD dwMode = 0;
|
|
|
+ if (!req.close) {
|
|
|
+ dwMode |= GPIO_DEV_LIGHT_MODE_COLOR_NORMAL;
|
|
|
+ if (!!req.mode) {
|
|
|
+ dwMode |= GPIO_DEV_LIGHT_MODE_LIGHT_FLICKER;
|
|
|
+ } else {
|
|
|
+ dwMode |= GPIO_DEV_LIGHT_MODE_LIGHT_SUSTAIN;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to set SetStatus...%d, 0x%X", dwReq, dwMode);
|
|
|
+ const ErrorCodeEnum ec = m_hDevHelper->SetStatus(dwReq, dwMode);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SetStatus returned %s", SpStrError(ec));
|
|
|
+ if (ec != Error_Succeed) {
|
|
|
+ DevErrorInfo devErrInfo;
|
|
|
+ ZeroMemory(&devErrInfo, sizeof(devErrInfo));
|
|
|
+ m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("SetStatus failed:%s(%s)", SpStrError(ec), devErrInfo.szErrMsg);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("dev helper object is invalid pointer!");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
{
|
|
|
CSimpleStringA activeModeSecName = "";
|
|
|
@@ -681,18 +737,6 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
devicePort = 8;
|
|
|
break;
|
|
|
}
|
|
|
- case USBCONTROL:
|
|
|
- {
|
|
|
- activeModeSecName = "LightNormal";
|
|
|
- devicePort = 1;
|
|
|
- break;
|
|
|
- }
|
|
|
- case USBLIGHT:
|
|
|
- {
|
|
|
- activeModeSecName = "CardReaderNormal";
|
|
|
- devicePort = 7;
|
|
|
- break;
|
|
|
- }
|
|
|
case HEADLIGHT_ASSIST:
|
|
|
{
|
|
|
activeModeSecName = "AssistNormal";
|
|
|
@@ -711,39 +755,34 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (m_eMachineType != RVC_Stand1SPlus
|
|
|
- || (deviceSeq == HEADLIGHT || deviceSeq == HEADLIGHT_RED || deviceSeq == HEADLIGHT_ASSIST)) {
|
|
|
-
|
|
|
- OutDrivingInfo odi;
|
|
|
- GetOutDrivingModInfo(activeModeSecName, odi);
|
|
|
- SetOutDriving(req, odi, 0, devicePort);
|
|
|
-
|
|
|
- } else {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stand1SPlus: %d,%d(%s) is not supported!", deviceSeq, devicePort, activeModeSecName);
|
|
|
- }
|
|
|
+ OutDrivingInfo odi;
|
|
|
+ GetOutDrivingModInfo(activeModeSecName, odi);
|
|
|
+ SetOutDriving(req, odi, 0, devicePort);
|
|
|
}
|
|
|
|
|
|
+//仅仅获取挂机的状态,但远远没有这么简单,这点只调用了一次,开了一个监听线程,用于监听震动、开关门等事件
|
|
|
void CGpioEntity::GetStatus(int deviceSeq, SpReqAnsContext<GpioService_GetStatus_Req, GpioService_GetStatus_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- /** 注意设备序号是实体内定义的逻辑,不是设备端口号*/
|
|
|
+ /** 注意设备序号是实体内定义的逻辑,不是设备端口号,用作于计时器的ID去了*/
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("GetStatus with devseq %d", deviceSeq);
|
|
|
- CSimpleStringA initDriver = "";
|
|
|
- int devicePort;
|
|
|
- /** 获取指定的模式,以便后续获取输入模式和持续触发模式,见 GetReceivingModInfo*/
|
|
|
- initDriver = "PhoneNormal";
|
|
|
- /** 获取硬件规格里对应的序号,其实是固定死的*/
|
|
|
- devicePort = 18;
|
|
|
- ReceivingInfo ri;
|
|
|
- GetReceivingModInfo(initDriver, ri);
|
|
|
- ri.Port = devicePort;
|
|
|
- GetReceiving(deviceSeq, ri, PICKUPSENSOR, ctx);
|
|
|
+ if (deviceSeq == PHONEPICKUP) {
|
|
|
+ CSimpleStringA initDriver = "";
|
|
|
+ int devicePort;
|
|
|
+ /** 获取指定的模式,以便后续获取输入模式和持续触发模式,见 GetReceivingModInfo*/
|
|
|
+ initDriver = "PhoneNormal";
|
|
|
+ /** 获取硬件规格里对应的序号,其实是固定死的*/
|
|
|
+ devicePort = 18;
|
|
|
+ ReceivingInfo ri;
|
|
|
+ GetReceivingModInfo(initDriver, ri);
|
|
|
+ ri.Port = devicePort;
|
|
|
+ GetReceiving(deviceSeq, ri, PICKUPSENSOR);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void CGpioEntity::OnOutputPositiveLevelTimerout(void* pData)
|
|
|
{
|
|
|
SetContextInfo* pSCI = (SetContextInfo*)pData;
|
|
|
GetFunction()->KillTimer(pSCI->timerID);
|
|
|
- ULONG devEnableStatus = GetDevEnableStatus();
|
|
|
DevOutputInfo doi = GetCurrDevStatus();
|
|
|
WritePin(pSCI->pinSeq, true);
|
|
|
delete pSCI;
|
|
|
@@ -754,21 +793,17 @@ void CGpioEntity::OnPositiveFlickerSetTimerout(void* pData)
|
|
|
SetContextInfo* pSCI = (SetContextInfo*)pData;
|
|
|
GetFunction()->KillTimer(pSCI->timerID);
|
|
|
|
|
|
- ULONG devEnableStatus = GetDevEnableStatus();
|
|
|
DevOutputInfo doi = GetCurrDevStatus();
|
|
|
WritePin(pSCI->pinSeq, false);
|
|
|
pSCI->timerID = pSCI->timerID;
|
|
|
|
|
|
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;
|
|
|
GetFunction()->KillTimer(pSCI->timerID);
|
|
|
- ULONG devEnableStatus = GetDevEnableStatus();
|
|
|
DevOutputInfo doi = GetCurrDevStatus();
|
|
|
|
|
|
WritePin(pSCI->pinSeq, true);
|
|
|
@@ -776,16 +811,16 @@ void CGpioEntity::OnPositiveFlickerResetTimerout(void* pData)
|
|
|
GetFunction()->SetTimer(pSCI->timerID, pListener, pSCI->setTime);
|
|
|
}
|
|
|
|
|
|
+//老接口,用于控制灯
|
|
|
bool CGpioEntity::SetOutDriving(GpioService_Set_Info req, OutDrivingInfo od, ULONG iIndex, ULONG pinSeq)
|
|
|
{
|
|
|
- ULONG devEnableStatus = GetDevEnableStatus();
|
|
|
DevOutputInfo doi = GetCurrDevStatus();
|
|
|
if (req.close == 1) {
|
|
|
GetFunction()->KillTimer(req.devseq);
|
|
|
//oilyang add 20161222
|
|
|
//如果关闭照明灯,以感知为准
|
|
|
if (pinSeq == m_headlightDevPort)
|
|
|
- WritePin(pinSeq, m_bHeadLightFlag);
|
|
|
+ WritePin(pinSeq, m_bHeadLightFlag); //这个值有待商榷
|
|
|
else {
|
|
|
if (pinSeq == PIN_HSPSCANNER_PREVIEW_LIGHT) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("off hspsanner.");
|
|
|
@@ -793,7 +828,6 @@ bool CGpioEntity::SetOutDriving(GpioService_Set_Info req, OutDrivingInfo od, ULO
|
|
|
}
|
|
|
WritePin(pinSeq, false);
|
|
|
}
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -879,42 +913,12 @@ bool CGpioEntity::SetOutDriving(GpioService_Set_Info req, OutDrivingInfo od, ULO
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
-void CGpioEntity::OnPositivePulseUpTimerout(void* pData)
|
|
|
-{
|
|
|
- GetContextInfo* pGCI = (GetContextInfo*)pData;
|
|
|
-
|
|
|
- BYTE btInput = 0;
|
|
|
- ErrorCodeEnum err;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("port[%d]", INPUT_PORT_2);
|
|
|
- err = m_hDevHelper->ReadPort(INPUT_PORT_2, btInput);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("read[%d]", btInput);
|
|
|
- //判断输入
|
|
|
- if (DetectBit(btInput, pGCI->index)) {
|
|
|
- if (pGCI->CttPhone == 0)//oiltest 20130709
|
|
|
- {
|
|
|
- ////触发
|
|
|
- pGCI->ctx->Ans.status = 1;
|
|
|
- pGCI->ctx->Answer(Error_Succeed);
|
|
|
- } else {
|
|
|
- pGCI->CttPhone--;//oiltest 20130709
|
|
|
- GetFunction()->ResetTimer(pGCI->timerID, 1000);
|
|
|
- }
|
|
|
- } else {
|
|
|
- pGCI->CttPhone = pGCI->InitCTT;//oiltest 20130709
|
|
|
- GetFunction()->ResetTimer(pGCI->timerID, 1);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void CGpioEntity::OnNegativePulseUpTimerout(void* pData)
|
|
|
-{
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
+/** 太复杂了,先掺在一起再改动吧 [Gifur@2023921]*/
|
|
|
void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
{
|
|
|
GetContextInfo* pGci = (GetContextInfo*)pData;
|
|
|
|
|
|
- const int count = pGci->InitCTT;
|
|
|
const int initCtt = pGci->InitCTT;
|
|
|
const int pos = pGci->Port;
|
|
|
|
|
|
@@ -924,12 +928,22 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
bool bShakeOne, bMoveOne, bSwitchOne, bPhoneOne, bCardOne;
|
|
|
bShakeOne = bMoveOne = bSwitchOne = bPhoneOne = bCardOne = false;
|
|
|
|
|
|
- const ErrorCodeEnum err = m_hDevHelper->ReadPort(INPUT_PORT_2, btInput);
|
|
|
+ ErrorCodeEnum err(Error_Succeed);
|
|
|
+ if (!m_bFuncVer2) {
|
|
|
+ err = m_hDevHelper->ReadPort(INPUT_PORT_2, btInput);
|
|
|
+ } else {
|
|
|
+ DWORD dwReq(GPIO_DEV_SN_LIGHT_SENSOR_ALL);
|
|
|
+ DWORD dwMode = 0;
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to DetectStatus 0x%X...", dwReq);
|
|
|
+ err = m_hDevHelper->DetectStatus(dwReq, dwMode);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DetectStatus return %s, 0x%X", SpStrError(err), dwMode);
|
|
|
+ btInput = dwMode;
|
|
|
+ }
|
|
|
if (err != Error_Succeed) {
|
|
|
DevErrorInfo devErrInfo;
|
|
|
ZeroMemory(&devErrInfo, sizeof(DevErrorInfo));
|
|
|
ErrorCodeEnum erroCode = m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ReadPort failed: %s, ErrMsg[%s]", SpStrError(err), (LPCTSTR)devErrInfo.szErrMsg);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s failed: %s, ErrMsg[%s]", m_bFuncVer2 ? "DetectStatus": "ReadPort", SpStrError(err), (LPCTSTR)devErrInfo.szErrMsg);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -940,7 +954,9 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
|
|
|
do {
|
|
|
|
|
|
+ /** 待商榷,这里永远不可能为1 [Gifur@2023921]*/
|
|
|
if (initCtt == 1) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
|
|
|
if (DetectBit(btInput, VIBRATIONSENSOR)) {
|
|
|
if (!m_bVibrationFlag && IfHaveMoveDetect()) {
|
|
|
LogEvent(Severity_Middle, LOG_EVT_VIBRATIONSENSOR, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(17), __LINE__));
|
|
|
@@ -976,6 +992,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
do {
|
|
|
|
|
|
if (initCtt == 1) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
|
|
|
if (DetectBit(btInput, OPENSENSOR)) {
|
|
|
if (!m_bOpenFlag) {
|
|
|
if (IfHaveMoveDetect())
|
|
|
@@ -1016,7 +1033,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
do {
|
|
|
|
|
|
if (initCtt == 1) {
|
|
|
-
|
|
|
+ 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;
|
|
|
@@ -1086,6 +1103,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
|
|
|
do {
|
|
|
if (initCtt == 1) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
|
|
|
if (DetectBit(btInput, MOVESENSOR)) {
|
|
|
if (IfHaveMoveDetect())
|
|
|
LogEvent(Severity_Middle, LOG_EVT_MOVESENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(20), __LINE__));
|
|
|
@@ -1138,6 +1156,7 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
do {
|
|
|
|
|
|
if (initCtt == 1) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("test initCtt == 1");
|
|
|
if (DetectBit(btInput, CARDGATESENSOR)) {
|
|
|
if (!m_bCardGateFlag) {
|
|
|
if (IfHaveMoveDetect())
|
|
|
@@ -1238,8 +1257,6 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
|
|
|
if (pGci->CttMove > 1 && !bMoveOne) {
|
|
|
do {
|
|
|
- //DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("before ccMove: %d, ccInit: %d, moveRound: %d, %d, disppear: %d, holder: %d",
|
|
|
- // pGci->CttMove, pGci->InitCTT, m_bMoveRound, DetectBit(btInput, MOVESENSOR), m_moveDisappearTimes, m_moveHoldTimes);
|
|
|
|
|
|
if (m_bMoveRound) {
|
|
|
if (DetectBit(btInput, MOVESENSOR))
|
|
|
@@ -1256,15 +1273,10 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
pGci->CttMove = pGci->InitCTT;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("after ccMove: %d, ccInit: %d, moveRound: %d, %d, disppear: %d, holder: %d",
|
|
|
- // pGci->CttMove, pGci->InitCTT, m_bMoveRound, DetectBit(btInput, MOVESENSOR), m_moveDisappearTimes, m_moveHoldTimes);
|
|
|
|
|
|
} while (0);
|
|
|
- } else {
|
|
|
- //DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("===== ccMove: %d, moveOne: %d, moveRound: %d, %d, disppear: %d, holder: %d",
|
|
|
- // pGci->CttMove, bMoveOne, m_bMoveRound, DetectBit(btInput, MOVESENSOR), m_moveDisappearTimes, m_moveHoldTimes);
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
if (pGci->CttCard > 1 && !bCardOne) {
|
|
|
do {
|
|
|
@@ -1289,41 +1301,15 @@ void CGpioEntity::OnPositiveLevelTimerOut(void* pData)
|
|
|
GetFunction()->ResetTimer(pGci->timerID, 100);
|
|
|
}
|
|
|
|
|
|
-void CGpioEntity::OnNegativeLevelTimerOut(void* pData)
|
|
|
-{
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-bool CGpioEntity::GetReceiving(int deviceSeq, ReceivingInfo ri, ULONG iIndex,
|
|
|
- SpReqAnsContext<GpioService_GetStatus_Req, GpioService_GetStatus_Ans>::Pointer ctx)
|
|
|
+bool CGpioEntity::GetReceiving(int deviceSeq, ReceivingInfo ri, ULONG iIndex)
|
|
|
{
|
|
|
-
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("inputmode[%d],port[%d],ctt[%d]", ri.InputMode, ri.Port, ri.ContinuousTriggerTime);
|
|
|
switch (ri.InputMode)
|
|
|
{
|
|
|
- case IM_POSITIVE_PULSE_UP:
|
|
|
- {
|
|
|
- GetContextInfo* pGci = new GetContextInfo();
|
|
|
- pGci->timerID = ctx->Req.devseq;
|
|
|
- pGci->ctx = ctx;
|
|
|
- pGci->index = iIndex;
|
|
|
- pGci->Port = ri.Port;
|
|
|
- pGci->CttCard = ri.ContinuousTriggerTime;
|
|
|
- pGci->CttMove = ri.ContinuousTriggerTime;
|
|
|
- pGci->CttPhone = ri.ContinuousTriggerTime;
|
|
|
- pGci->CttShake = ri.ContinuousTriggerTime;
|
|
|
- pGci->CttSwitch = ri.ContinuousTriggerTime;
|
|
|
- pGci->InitCTT = ri.ContinuousTriggerTime;
|
|
|
- ITimerListener* pListener = new TimerOutHelper<CGpioEntity>(this, &CGpioEntity::OnPositivePulseUpTimerout, pGci);
|
|
|
- GetFunction()->SetTimer(pGci->timerID, pListener, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
case IM_POSITIVE_LEVEL:
|
|
|
- {
|
|
|
+ { /** 目前只是使用了这一个 [Gifur@2023921]*/
|
|
|
GetContextInfo* pGci = new GetContextInfo();
|
|
|
pGci->timerID = deviceSeq;
|
|
|
- pGci->ctx = ctx;
|
|
|
pGci->index = iIndex;
|
|
|
pGci->Port = ri.Port;
|
|
|
pGci->CttCard = ri.ContinuousTriggerTime;
|
|
|
@@ -1336,69 +1322,66 @@ bool CGpioEntity::GetReceiving(int deviceSeq, ReceivingInfo ri, ULONG iIndex,
|
|
|
GetFunction()->SetTimer(pGci->timerID, pListener, 100);
|
|
|
break;
|
|
|
}
|
|
|
- case IM_NEGATIVE_LEVEL:
|
|
|
- {
|
|
|
- GetContextInfo* pGci = new GetContextInfo();
|
|
|
- pGci->timerID = deviceSeq;
|
|
|
- pGci->ctx = ctx;
|
|
|
- pGci->index = iIndex;
|
|
|
- pGci->Port = ri.Port;
|
|
|
- pGci->InitCTT = ri.ContinuousTriggerTime;
|
|
|
- ITimerListener* pListener = new TimerOutHelper<CGpioEntity>(this, &CGpioEntity::OnNegativeLevelTimerOut, pGci);
|
|
|
- GetFunction()->SetTimer(pGci->timerID, pListener, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
default:
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("not support: %d", ri.InputMode);
|
|
|
break;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+/** 旧接口,从配置中获取闪烁的属性 [Gifur@2023921]*/
|
|
|
void CGpioEntity::GetOutDrivingModInfo(CSimpleStringA modName, OutDrivingInfo& odi)
|
|
|
{
|
|
|
if (modName.Compare("IDCertificateNormal") == 0) {
|
|
|
- odi.OutputMode = 2;
|
|
|
- odi.StopMode = 2;
|
|
|
+ odi.OutputMode = OM_POSITIVE_FLICKER;
|
|
|
+ odi.StopMode = SM_CYCLE;
|
|
|
odi.SetTime = 150;
|
|
|
odi.ResetTime = 150;
|
|
|
odi.TimeOut = 5000;
|
|
|
+
|
|
|
} else if (modName.Compare("FingerPrintNormal") == 0) {
|
|
|
- odi.OutputMode = 2;
|
|
|
- odi.StopMode = 2;
|
|
|
+ odi.OutputMode = OM_POSITIVE_FLICKER;
|
|
|
+ odi.StopMode = SM_CYCLE;
|
|
|
odi.SetTime = 150;
|
|
|
odi.ResetTime = 150;
|
|
|
odi.TimeOut = 5000;
|
|
|
+
|
|
|
} else if (modName.Compare("CardReaderNormal") == 0) {
|
|
|
- odi.OutputMode = 2;
|
|
|
- odi.StopMode = 2;
|
|
|
+ odi.OutputMode = OM_POSITIVE_FLICKER;
|
|
|
+ odi.StopMode = SM_CYCLE;
|
|
|
odi.SetTime = 200;
|
|
|
odi.ResetTime = 200;
|
|
|
odi.TimeOut = 5000;
|
|
|
+
|
|
|
} else if (modName.Compare("AssistNormal") == 0) {
|
|
|
- odi.OutputMode = 2;
|
|
|
- odi.StopMode = 2;
|
|
|
+ odi.OutputMode = OM_POSITIVE_FLICKER;
|
|
|
+ odi.StopMode = SM_CYCLE;
|
|
|
odi.SetTime = 1000;
|
|
|
odi.ResetTime = 500;
|
|
|
odi.TimeOut = 5000;
|
|
|
+
|
|
|
} else if (modName.Compare("LightNormal") == 0) {
|
|
|
- odi.OutputMode = 0;
|
|
|
- odi.StopMode = 0;
|
|
|
+ odi.OutputMode = OM_POSITIVE_LEVEL;
|
|
|
+ odi.StopMode = SM_CALLTRIGGER;
|
|
|
odi.SetTime = 1000;
|
|
|
odi.ResetTime = 1000;
|
|
|
odi.TimeOut = 5000;
|
|
|
+
|
|
|
} else if (modName.Compare("RedLightNormal") == 0) {
|
|
|
- odi.OutputMode = 0;
|
|
|
- odi.StopMode = 0;
|
|
|
+ odi.OutputMode = OM_POSITIVE_LEVEL;
|
|
|
+ odi.StopMode = SM_CALLTRIGGER;
|
|
|
odi.SetTime = 200;
|
|
|
odi.ResetTime = 200;
|
|
|
odi.TimeOut = 3000;
|
|
|
+
|
|
|
} else {
|
|
|
- odi.OutputMode = 0;
|
|
|
- odi.StopMode = 0;
|
|
|
+ odi.OutputMode = OM_POSITIVE_LEVEL;
|
|
|
+ odi.StopMode = SM_CALLTRIGGER;
|
|
|
odi.SetTime = 200;
|
|
|
odi.ResetTime = 200;
|
|
|
odi.TimeOut = 5000;
|
|
|
}
|
|
|
+
|
|
|
LOG_TRACE("outputmode.stopmode:[%d].[%d]", odi.OutputMode, odi.StopMode);
|
|
|
}
|
|
|
|
|
|
@@ -1406,21 +1389,17 @@ void CGpioEntity::GetOutDrivingModInfo(CSimpleStringA modName, OutDrivingInfo& o
|
|
|
void CGpioEntity::GetReceivingModInfo(CSimpleStringA modName, ReceivingInfo& ri)
|
|
|
{
|
|
|
if (modName.Compare("PhoneNormal") == 0) {
|
|
|
- ri.InputMode = 4;
|
|
|
ri.ContinuousTriggerTime = 2;
|
|
|
} else if (modName.Compare("GpioNormal") == 0) {
|
|
|
- ri.InputMode = 4;
|
|
|
ri.ContinuousTriggerTime = 10;
|
|
|
} else if (modName.Compare("CardGateNormal") == 0) {
|
|
|
- ri.InputMode = 4;
|
|
|
ri.ContinuousTriggerTime = 10;
|
|
|
} else if (modName.Compare("ShakeNormal") == 0) {
|
|
|
- ri.InputMode = 4;
|
|
|
ri.ContinuousTriggerTime = 4;
|
|
|
} else {
|
|
|
- ri.InputMode = 4;
|
|
|
ri.ContinuousTriggerTime = 10;
|
|
|
}
|
|
|
+ ri.InputMode = IM_POSITIVE_LEVEL;
|
|
|
}
|
|
|
|
|
|
BYTE CGpioEntity::GetOutputStatus(int sn)
|