|
|
@@ -620,134 +620,119 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
CSimpleStringA activeModeSecName = "";
|
|
|
int devicePort;
|
|
|
BOOL bDone = FALSE;
|
|
|
+ ErrorCodeEnum err(Error_Succeed);
|
|
|
const int deviceSeq = req.devseq;
|
|
|
LOG_TRACE("Set request %s arrived!", GetLightSeqString(deviceSeq));
|
|
|
OutDrivingInfo odi;
|
|
|
- ErrorCodeEnum err;
|
|
|
- CSmartPointer<IEntityFunction> spEntityFunction = GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfig;
|
|
|
- err = spEntityFunction->OpenConfig(Config_Software, spConfig);
|
|
|
- if (err != Error_Succeed) {
|
|
|
- LOG_TRACE("open cfg file failed!");
|
|
|
- return;
|
|
|
- }
|
|
|
switch (deviceSeq) {
|
|
|
case CARDREADER:
|
|
|
{
|
|
|
- err = spConfig->ReadConfigValue("InitDriver", "CardReader", activeModeSecName);
|
|
|
- if (err != Error_Succeed)
|
|
|
- goto Error;
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "CardReader", devicePort);
|
|
|
- if (err != Error_Succeed)
|
|
|
- goto Error;
|
|
|
+ activeModeSecName = "CardReaderNormal";
|
|
|
+ devicePort = 0;
|
|
|
break;
|
|
|
}
|
|
|
case CARDREADER_RED:
|
|
|
{
|
|
|
- err = spConfig->ReadConfigValue("InitDriver", "CardReaderRed", activeModeSecName);
|
|
|
- if (err != Error_Succeed)
|
|
|
- goto Error;
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "CardReaderRed", devicePort);
|
|
|
- if (err != Error_Succeed)
|
|
|
- goto Error;
|
|
|
+ activeModeSecName = "RedLightNormal";
|
|
|
+ devicePort = 6;
|
|
|
break;
|
|
|
}
|
|
|
+ /** TODO 移除 [Gifur@202319]*/
|
|
|
case PRINTER:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "Printer", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "Printer", devicePort);
|
|
|
+ activeModeSecName = "PrinterNormal";
|
|
|
+ devicePort = 11;
|
|
|
break;
|
|
|
}
|
|
|
case IDCERTIFICATE:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "IDCertificate", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "IDCertificate", devicePort);
|
|
|
+ activeModeSecName = "IDCertificateNormal";
|
|
|
+ devicePort = 2;
|
|
|
break;
|
|
|
}
|
|
|
case FINGERPRINT:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "FingerPrint", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "FingerPrint", devicePort);
|
|
|
+ activeModeSecName = "FingerPrintNormal";
|
|
|
+ devicePort = 10;
|
|
|
break;
|
|
|
}
|
|
|
case PINPAD:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "Pinpad", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "Pinpad", devicePort);
|
|
|
+ activeModeSecName = "CardReaderNormal";
|
|
|
+ devicePort = 3;
|
|
|
break;
|
|
|
}
|
|
|
case HEADLIGHT:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "HeadLight", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "HeadLight", devicePort);
|
|
|
+ activeModeSecName = "LightNormal";
|
|
|
+ devicePort = 4;
|
|
|
m_headlightDevPort = devicePort;
|
|
|
break;
|
|
|
}
|
|
|
case HEADLIGHT_RED:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "HeadLightRed", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "HeadLightRed", devicePort);
|
|
|
+ activeModeSecName = "RedLightNormal";
|
|
|
+ devicePort = 5;
|
|
|
break;
|
|
|
}
|
|
|
case CONTACTLESSCARD:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "ContactlessCard", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "ContactlessCard", devicePort);
|
|
|
+ activeModeSecName = "CardReaderNormal";
|
|
|
+ devicePort = 8;
|
|
|
break;
|
|
|
}
|
|
|
case USBCONTROL:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "USBControl", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "USBControl", devicePort);
|
|
|
+ activeModeSecName = "LightNormal";
|
|
|
+ devicePort = 1;
|
|
|
break;
|
|
|
}
|
|
|
case USBLIGHT:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "USBLight", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "USBLight", devicePort);
|
|
|
+ activeModeSecName = "CardReaderNormal";
|
|
|
+ devicePort = 7;
|
|
|
break;
|
|
|
}
|
|
|
case HEADLIGHT_ASSIST:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "HeadLightAssist", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "HeadLightAssist", devicePort);
|
|
|
+ activeModeSecName = "AssistNormal";
|
|
|
+ devicePort = 4;
|
|
|
break;
|
|
|
}
|
|
|
case HSPSCANNER:
|
|
|
{
|
|
|
- spConfig->ReadConfigValue("InitDriver", "HSPScanner", activeModeSecName);
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "HSPScanner", devicePort);
|
|
|
+ activeModeSecName = "LightNormal";
|
|
|
+ devicePort = 12;
|
|
|
break;
|
|
|
}
|
|
|
+ ///**TODO(Gifur@1/9/2023): 移除 */
|
|
|
case PRINTER_SEAL:
|
|
|
{
|
|
|
if (!m_bNewVersion) {
|
|
|
bDone = TRUE;
|
|
|
break;
|
|
|
}
|
|
|
- //static int paperLighted = PRINTERSEAL_UNKNOWN;
|
|
|
- //static int printLighted = PRINTERSEAL_UNKNOWN;
|
|
|
err = Error_Unexpect;
|
|
|
switch (req.mode) {
|
|
|
case PRINTER_LIGHT_GREEN:
|
|
|
LOG_TRACE("printseal green light on");
|
|
|
- err = spConfig->ReadConfigValue("InitDriver", "PrintSeal", activeModeSecName);
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintSeal", devicePort);
|
|
|
+ activeModeSecName = "LightNormal";
|
|
|
+ devicePort = 13;
|
|
|
break;
|
|
|
case PRINTER_LIGHT_RED:
|
|
|
LOG_TRACE("printseal red light on");
|
|
|
- err = spConfig->ReadConfigValue("InitDriver", "PrintSealRed", activeModeSecName);
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintSealRed", devicePort);
|
|
|
+ activeModeSecName = "RedLightNormal";
|
|
|
+ devicePort = 24;
|
|
|
break;
|
|
|
case PAPER_LIGHT_GREEN:
|
|
|
LOG_TRACE("paper slot green light on");
|
|
|
- err = spConfig->ReadConfigValue("InitDriver", "PrintPaper", activeModeSecName);
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintPaper", devicePort);
|
|
|
+ activeModeSecName = "LightNormal";
|
|
|
+ devicePort = 14;
|
|
|
break;
|
|
|
case PAPER_LIGHT_RED:
|
|
|
LOG_TRACE("paper slot red light on");
|
|
|
- err = spConfig->ReadConfigValue("InitDriver", "PrintPaperRed", activeModeSecName);
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintPaperRed", devicePort);
|
|
|
+ activeModeSecName = "RedLightNormal";
|
|
|
+ devicePort = 15;
|
|
|
break;
|
|
|
case PRINTER_LIGHT_OFF:
|
|
|
LOG_TRACE("printerseal light off");
|
|
|
@@ -767,11 +752,11 @@ void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
int devicePort1, devicePort2;
|
|
|
|
|
|
if (req.mode == PRINTER_LIGHT_OFF) {
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintSeal", devicePort1);
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintSealRed", devicePort2);
|
|
|
+ devicePort1 = 13;
|
|
|
+ devicePort2 = 24;
|
|
|
} else {
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintPaper", devicePort1);
|
|
|
- err = spConfig->ReadConfigValueInt("DriverPort", "PrintPaperRed", devicePort2);
|
|
|
+ devicePort1 = 14;
|
|
|
+ devicePort2 = 15;
|
|
|
}
|
|
|
if (err != Error_Succeed) {
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("read cfg failed ~.");
|
|
|
@@ -812,17 +797,10 @@ void CGpioEntity::GetStatus(int deviceSeq, SpReqAnsContext<GpioService_GetStatus
|
|
|
CSimpleStringA initDriver = "";
|
|
|
int devicePort;
|
|
|
ErrorCodeEnum Error;
|
|
|
- CSmartPointer<IEntityFunction> spEntityFunction = GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfig;
|
|
|
- Error = spEntityFunction->OpenConfig(Config_Software, spConfig);
|
|
|
- if (Error != Error_Succeed) {
|
|
|
- LOG_TRACE("open cfg file failed!");
|
|
|
- return;
|
|
|
- }
|
|
|
/** 获取指定的模式,以便后续获取输入模式和持续触发模式,见 GetReceivingModInfo*/
|
|
|
- spConfig->ReadConfigValue("InitDriver", "PhoneLift", initDriver);
|
|
|
+ initDriver = "PhoneNormal";
|
|
|
/** 获取硬件规格里对应的序号,其实是固定死的*/
|
|
|
- spConfig->ReadConfigValueInt("DriverPort", "PhoneLift", devicePort);
|
|
|
+ devicePort = 18;
|
|
|
ReceivingInfo ri;
|
|
|
GetReceivingModInfo(initDriver, ri);
|
|
|
ri.Port = devicePort;
|
|
|
@@ -1472,34 +1450,77 @@ bool CGpioEntity::GetReceiving(int deviceSeq, ReceivingInfo ri, ULONG iIndex,
|
|
|
void CGpioEntity::GetOutDrivingModInfo(CSimpleStringA modName, OutDrivingInfo& odi)
|
|
|
{
|
|
|
ErrorCodeEnum Error;
|
|
|
- CSmartPointer<IEntityFunction> spEntityFunction = GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfig;
|
|
|
- Error = spEntityFunction->OpenConfig(Config_Software, spConfig);
|
|
|
- if (Error != Error_Succeed) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("open cfg file failed!");
|
|
|
- return;
|
|
|
- }
|
|
|
- spConfig->ReadConfigValueInt(modName, "OutputMode", odi.OutputMode);
|
|
|
- spConfig->ReadConfigValueInt(modName, "StopMode", odi.StopMode);
|
|
|
- spConfig->ReadConfigValueInt(modName, "SetTime", odi.SetTime);
|
|
|
- spConfig->ReadConfigValueInt(modName, "ResetTime", odi.ResetTime);
|
|
|
- spConfig->ReadConfigValueInt(modName, "Timeout", odi.TimeOut);
|
|
|
+ if (modName.Compare("IDCertificateNormal") == 0) {
|
|
|
+ odi.OutputMode = 2;
|
|
|
+ odi.StopMode =2 ;
|
|
|
+ odi.SetTime = 150;
|
|
|
+ odi.ResetTime = 150;
|
|
|
+ odi.TimeOut = 5000;
|
|
|
+ } else if (modName.Compare("FingerPrintNormal") == 0) {
|
|
|
+ odi.OutputMode = 2;
|
|
|
+ odi.StopMode = 2;
|
|
|
+ odi.SetTime = 150;
|
|
|
+ odi.ResetTime = 150;
|
|
|
+ odi.TimeOut = 5000;
|
|
|
+ } else if (modName.Compare("CardReaderNormal") == 0) {
|
|
|
+ odi.OutputMode = 2;
|
|
|
+ odi.StopMode = 2;
|
|
|
+ odi.SetTime = 200;
|
|
|
+ odi.ResetTime = 200;
|
|
|
+ odi.TimeOut = 5000;
|
|
|
+ } else if (modName.Compare("AssistNormal") == 0) {
|
|
|
+ odi.OutputMode = 2;
|
|
|
+ odi.StopMode = 2;
|
|
|
+ odi.SetTime = 1000;
|
|
|
+ odi.ResetTime = 500;
|
|
|
+ odi.TimeOut = 5000;
|
|
|
+ } else if (modName.Compare("LightNormal") == 0) {
|
|
|
+ odi.OutputMode = 0;
|
|
|
+ odi.StopMode = 0;
|
|
|
+ odi.SetTime = 1000;
|
|
|
+ odi.ResetTime = 1000;
|
|
|
+ odi.TimeOut = 5000;
|
|
|
+ } else if (modName.Compare("PrinterNormal") == 0) {
|
|
|
+ odi.OutputMode = 0;
|
|
|
+ odi.StopMode = 1;
|
|
|
+ odi.SetTime = 200;
|
|
|
+ odi.ResetTime = 200;
|
|
|
+ odi.TimeOut = 3000;
|
|
|
+ } else if (modName.Compare("RedLightNormal") == 0) {
|
|
|
+ odi.OutputMode = 0;
|
|
|
+ odi.StopMode = 0;
|
|
|
+ odi.SetTime = 200;
|
|
|
+ odi.ResetTime = 200;
|
|
|
+ odi.TimeOut = 3000;
|
|
|
+ } else {
|
|
|
+ odi.OutputMode = 0;
|
|
|
+ odi.StopMode = 0;
|
|
|
+ odi.SetTime =200 ;
|
|
|
+ odi.ResetTime = 200;
|
|
|
+ odi.TimeOut = 5000;
|
|
|
+ }
|
|
|
LOG_TRACE("outputmode.stopmode:[%d].[%d]", odi.OutputMode, odi.StopMode);
|
|
|
}
|
|
|
|
|
|
/*从配置文件中获取配置*/
|
|
|
void CGpioEntity::GetReceivingModInfo(CSimpleStringA modName, ReceivingInfo& ri)
|
|
|
{
|
|
|
- ErrorCodeEnum Error;
|
|
|
- CSmartPointer<IEntityFunction> spEntityFunction = GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfig;
|
|
|
- Error = spEntityFunction->OpenConfig(Config_Software, spConfig);
|
|
|
- if (Error != Error_Succeed) {
|
|
|
- LOG_TRACE("open cfg file failed!");
|
|
|
- return;
|
|
|
+ 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;
|
|
|
}
|
|
|
- spConfig->ReadConfigValueInt(modName, "InputMode", ri.InputMode);
|
|
|
- spConfig->ReadConfigValueInt(modName, "ContinuousTriggerTime", ri.ContinuousTriggerTime);
|
|
|
}
|
|
|
|
|
|
BYTE CGpioEntity::GetOutputStatus(int sn)
|