|
@@ -0,0 +1,494 @@
|
|
|
+#pragma once
|
|
|
+#include "SpHelper.h"
|
|
|
+#include "SpFSM.h"
|
|
|
+#include "SimpleString.h"
|
|
|
+#include "Blob.h"
|
|
|
+#include "SpBase.h"
|
|
|
+#include <regex>
|
|
|
+/*------20200221------*/
|
|
|
+//modify by LZM
|
|
|
+ErrorCodeEnum VendorLogControlerEx(CEntityBase *pEntity,CSimpleStringA moduleName)
|
|
|
+{
|
|
|
+#ifdef RVC_WIN_OS
|
|
|
+ //get Device Information.
|
|
|
+ CSystemStaticInfo DevInfo;
|
|
|
+ pEntity->GetFunction()->GetSystemStaticInfo(DevInfo);
|
|
|
+ Dbg("Terminal NUM=%s",DevInfo.strTerminalID);
|
|
|
+ //read root.ini and get vendor,version,batch.
|
|
|
+ CSmartPointer<IConfigInfo> rootConfig;
|
|
|
+ ErrorCodeEnum eErrDev = pEntity->GetFunction()->OpenConfig(Config_Root,rootConfig);
|
|
|
+ if (eErrDev != Error_Succeed) {
|
|
|
+ Dbg("open Config_Root file failed!");
|
|
|
+ return eErrDev;
|
|
|
+ }
|
|
|
+ CSimpleStringA strVendor,strVersion,strBatch;
|
|
|
+ CSimpleStringA strTmp = CSimpleStringA::Format("Device.%s",moduleName.GetData());
|
|
|
+ Dbg("strTmp=%s",strTmp);
|
|
|
+ eErrDev = rootConfig->ReadConfigValue(strTmp,"Vendor",strVendor);
|
|
|
+ if(eErrDev != Error_Succeed || strVendor.IsNullOrEmpty()){
|
|
|
+ Dbg("read vendor failed!");
|
|
|
+ return eErrDev;
|
|
|
+ }
|
|
|
+ eErrDev = rootConfig->ReadConfigValue(strTmp,"Version",strVersion);
|
|
|
+ if(eErrDev != Error_Succeed || strVersion.IsNullOrEmpty()){
|
|
|
+ Dbg("read version failed!");
|
|
|
+ return eErrDev;
|
|
|
+ }
|
|
|
+ eErrDev = rootConfig->ReadConfigValue(strTmp,"Batch",strBatch);
|
|
|
+ if(eErrDev != Error_Succeed || strBatch.IsNullOrEmpty()){
|
|
|
+ Dbg("read batch failed!");
|
|
|
+ return eErrDev;
|
|
|
+ }
|
|
|
+ Dbg("strVendor=%s",strVendor);
|
|
|
+ Dbg("strVersion=%s",strVersion);
|
|
|
+ Dbg("strBatch=%s",strBatch);
|
|
|
+ //read CenterSetting get VendorRecodeLevel,VendorRecodeType,WhiteNameSheet.
|
|
|
+ CSmartPointer<IConfigInfo> centerConfig;
|
|
|
+ eErrDev = pEntity->GetFunction()->OpenConfig(Config_CenterSetting,centerConfig);
|
|
|
+ if (eErrDev != Error_Succeed) {
|
|
|
+ Dbg("open Config_CenterSetting file failed!");
|
|
|
+ return eErrDev;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA strVendorRecodeLevel,strVendorRecodeType,strVendorDllName,strVendorLogPath;
|
|
|
+ eErrDev = centerConfig->ReadConfigValue(moduleName,strVendor.GetData(),strVendorRecodeLevel);
|
|
|
+ if(eErrDev!=Error_Succeed || strVendorRecodeLevel.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ eErrDev = centerConfig->ReadConfigValue(moduleName,"All",strVendorRecodeLevel);
|
|
|
+ if(eErrDev!=Error_Succeed || strVendorRecodeLevel.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ //default level:OFF.
|
|
|
+ strVendorRecodeLevel = "OFF";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //WhiteNameSheet is avaliable.
|
|
|
+ if (strVendorRecodeLevel.Compare("OFF") != 0)
|
|
|
+ {
|
|
|
+ //get WhiteNameSheet
|
|
|
+ CSimpleStringA strWhiteNameSheet;
|
|
|
+ eErrDev = centerConfig->ReadConfigValue(moduleName,"AllowTerminals",strWhiteNameSheet);
|
|
|
+ if (!strWhiteNameSheet.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ bool bWhiteNameSheet = false;
|
|
|
+ CAutoArray<CSimpleStringA> arrayWhiteNameSheet = strWhiteNameSheet.Split(',');
|
|
|
+ for (int i=0;i<arrayWhiteNameSheet.GetCount();i++)
|
|
|
+ {
|
|
|
+ std::regex pattern(arrayWhiteNameSheet[i]);
|
|
|
+ if(std::regex_match(DevInfo.strTerminalID.GetData(),pattern))
|
|
|
+ {
|
|
|
+ bWhiteNameSheet = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //if this terminal is not at WhiteNameSheet,set level with "OFF".
|
|
|
+ if(!bWhiteNameSheet) strVendorRecodeLevel = "OFF";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ eErrDev = centerConfig->ReadConfigValue(moduleName,"Type",strVendorRecodeType);
|
|
|
+ if(eErrDev!=Error_Succeed || strVendorRecodeType.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ //default type:FILE.
|
|
|
+ strVendorRecodeType = "FILE";
|
|
|
+ }
|
|
|
+ strVendorDllName = moduleName + "." + strVendor+"."+strVersion+"."+strBatch+".dll";
|
|
|
+
|
|
|
+
|
|
|
+ TCHAR szPath[MAX_PATH] = {0};
|
|
|
+ GetModuleFileNameA(NULL, szPath, MAX_PATH);
|
|
|
+ CSimpleStringA strDir = szPath;
|
|
|
+ strVendorLogPath = strDir.SubString(0,1);
|
|
|
+ strVendorLogPath += ":/rvc/dbg";
|
|
|
+
|
|
|
+ Dbg("VENDOR_RECODE_LEVEL=%s",strVendorRecodeLevel);
|
|
|
+ Dbg("VENDOR_RECODE_TYPE=%s",strVendorRecodeType);
|
|
|
+ Dbg("VENDOR_DLL_NAME=%s",strVendorDllName);
|
|
|
+ Dbg("VENDOR_LOG_PATH=%s",strVendorLogPath);
|
|
|
+ if(!SetEnvironmentVariableA("VENDOR_RECODE_LEVEL",strVendorRecodeLevel.GetData())){
|
|
|
+ Dbg("Set VENDOR_RECODE_LEVEL Variable Failed.");
|
|
|
+ }
|
|
|
+ if(!SetEnvironmentVariableA("VENDOR_RECODE_TYPE",strVendorRecodeType.GetData())){
|
|
|
+ Dbg("Set VENDOR_RECODE_TYPE Variable Failed.");
|
|
|
+ }
|
|
|
+ if(!SetEnvironmentVariableA("VENDOR_DLL_NAME",strVendorDllName.GetData())){
|
|
|
+ Dbg("Set VENDOR_DLL_NAME Variable Failed.");
|
|
|
+ }
|
|
|
+ if(!SetEnvironmentVariableA("VENDOR_LOG_PATH",strVendorLogPath.GetData())){
|
|
|
+ Dbg("Set VENDOR_LOG_PATH Variable Failed.");
|
|
|
+ }
|
|
|
+#else
|
|
|
+#endif
|
|
|
+ return Error_Succeed;
|
|
|
+}
|
|
|
+ErrorCodeEnum VendorLogControler(FSMBase *pFSM,CSimpleStringA moduleName)
|
|
|
+{
|
|
|
+ return VendorLogControlerEx(pFSM->GetEntityBase(),moduleName);
|
|
|
+}
|
|
|
+/*--------------------*/
|
|
|
+
|
|
|
+//#define DeviceService_Method_GetDevInfo 65535
|
|
|
+//#define DeviceService_MethodSignature_GetDevInfo 296205965
|
|
|
+//
|
|
|
+//struct DeviceService_GetDevInfo_Req
|
|
|
+//{
|
|
|
+// void Serialize(SpBuffer &Buf)
|
|
|
+// {
|
|
|
+// }
|
|
|
+//};
|
|
|
+//
|
|
|
+//struct DeviceService_GetDevInfo_Ans
|
|
|
+//{
|
|
|
+// CSimpleStringA type;
|
|
|
+// CSimpleStringA model;
|
|
|
+// CSimpleStringA vendor;
|
|
|
+// int state;
|
|
|
+// WORD wMajor; //release major version
|
|
|
+// WORD wMinor; //release minor version
|
|
|
+// WORD wRevision; //bug repair version with the major and minor version remains the same
|
|
|
+// WORD wBuild; //compile version
|
|
|
+//
|
|
|
+// void Serialize(SpBuffer &Buf)
|
|
|
+// {
|
|
|
+// Buf & type & model & vendor & state & wMajor & wMinor & wRevision & wBuild;
|
|
|
+// }
|
|
|
+//};
|
|
|
+//
|
|
|
+//class DeviceService_ClientBase : public CClientSessionBase {
|
|
|
+//public:
|
|
|
+// DeviceService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {}
|
|
|
+//
|
|
|
+//protected:
|
|
|
+// virtual ~DeviceService_ClientBase() {}
|
|
|
+//
|
|
|
+//public:
|
|
|
+//
|
|
|
+// ErrorCodeEnum Connect(CSmartPointer<IAsynWaitSp> &spAsyncWait, const CSimpleStringA &strRemoteEntity)
|
|
|
+// {
|
|
|
+// CSmartPointer<IEntityFunction> pFunc = m_pEntityBase->GetFunction();
|
|
|
+//
|
|
|
+// CSimpleStringA strServiceName = strRemoteEntity + "Service";
|
|
|
+// ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, (const char*)strRemoteEntity, (const char*)strServiceName, spAsyncWait);
|
|
|
+// if (Error == Error_Succeed) {
|
|
|
+// m_bSysManaged = true;
|
|
|
+// }
|
|
|
+// return Error;
|
|
|
+// }
|
|
|
+//
|
|
|
+// ErrorCodeEnum Connect(const CSimpleStringA &strRemoteEntity)
|
|
|
+// {
|
|
|
+// CSmartPointer<IAsynWaitSp> spAsyncWait;
|
|
|
+// ErrorCodeEnum Error = Connect(spAsyncWait, strRemoteEntity);
|
|
|
+// if (Error == Error_Succeed) {
|
|
|
+// Error = spAsyncWait->WaitAnswer();
|
|
|
+// }
|
|
|
+// return Error;
|
|
|
+// }
|
|
|
+//
|
|
|
+// ErrorCodeEnum GetDevInfo(DeviceService_GetDevInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
|
|
|
+// {
|
|
|
+// CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
|
|
|
+// CAutoBuffer Buf = SpObject2Buffer(Req);
|
|
|
+// return pFunc->AsyncRequest(DeviceService_Method_GetDevInfo, DeviceService_MethodSignature_GetDevInfo, Buf, spAsyncWait, dwTimeout);
|
|
|
+// }
|
|
|
+//
|
|
|
+// ErrorCodeEnum GetDevInfo(DeviceService_GetDevInfo_Req &Req, DeviceService_GetDevInfo_Ans &Ans, DWORD dwTimeout)
|
|
|
+// {
|
|
|
+// CSmartPointer<IAsynWaitSp> spAsyncWait;
|
|
|
+// ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
|
|
|
+// if (Error == Error_Succeed) {
|
|
|
+// bool bEnd = false;
|
|
|
+// Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd);
|
|
|
+// LOG_ASSERT(Error || bEnd);
|
|
|
+// }
|
|
|
+// return Error;
|
|
|
+// }
|
|
|
+//
|
|
|
+// bool SafeDelete()
|
|
|
+// {
|
|
|
+// if (!m_bSysManaged) {
|
|
|
+// delete this;
|
|
|
+// }
|
|
|
+// return m_bSysManaged;
|
|
|
+// }
|
|
|
+//
|
|
|
+//protected:
|
|
|
+// bool m_bSysManaged;
|
|
|
+// CEntityBase *m_pEntityBase;
|
|
|
+//};
|
|
|
+//
|
|
|
+//ErrorCodeEnum SpGetDeviceInfo(CEntityBase *pEntity, const CSimpleStringA &devDevEntityName,
|
|
|
+// CSimpleStringA &strType, CSimpleStringA &strModel, CSimpleStringA &strVendor, int &nState, CBlob &blobVersion)
|
|
|
+//{
|
|
|
+// DeviceService_ClientBase *pClient = new DeviceService_ClientBase(pEntity);
|
|
|
+// ErrorCodeEnum rc = pClient->Connect(devDevEntityName);
|
|
|
+// if (rc == Error_Succeed)
|
|
|
+// {
|
|
|
+// DeviceService_GetDevInfo_Req req;
|
|
|
+// DeviceService_GetDevInfo_Ans ans;
|
|
|
+// rc = pClient->GetDevInfo(req, ans, 5000);
|
|
|
+// if (rc == Error_Succeed)
|
|
|
+// {
|
|
|
+// strType = ans.type;
|
|
|
+// strModel = ans.model;
|
|
|
+// strVendor = ans.vendor;
|
|
|
+// nState = ans.state;
|
|
|
+// blobVersion.Alloc(8);
|
|
|
+// ((BYTE*)blobVersion.m_pData)[0] = (ans.wMajor >> 8) & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[1] = ans.wMajor & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[2] = (ans.wMinor >> 8) & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[3] = ans.wMinor & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[4] = (ans.wRevision >> 8) & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[5] = ans.wRevision & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[6] = (ans.wBuild >> 8) & 0xFF;
|
|
|
+// ((BYTE*)blobVersion.m_pData)[7] = ans.wBuild & 0xFF;
|
|
|
+// }
|
|
|
+// pClient->GetFunction()->CloseSession();
|
|
|
+// }
|
|
|
+// pClient->SafeDelete();
|
|
|
+// return rc;
|
|
|
+//}
|
|
|
+
|
|
|
+ErrorCodeEnum SpGetAllDevices(CEntityBase *pEntity, CAutoArray<CSimpleStringA> &devs)
|
|
|
+{
|
|
|
+ CSmartPointer<IConfigInfo> pConfig;
|
|
|
+ ErrorCodeEnum rc = pEntity->GetFunction()->OpenConfig(Config_Root, pConfig);
|
|
|
+ if (rc == Error_Succeed)
|
|
|
+ {
|
|
|
+ int nCount(0);
|
|
|
+ rc = pConfig->ReadConfigValueInt("Device", "Number", nCount);
|
|
|
+ if (rc == Error_Succeed && nCount>0)
|
|
|
+ {
|
|
|
+ devs.Init(nCount);
|
|
|
+
|
|
|
+ for(int i=0; i<nCount; i++)
|
|
|
+ {
|
|
|
+ CSimpleStringA str = CSimpleStringA::Format("%d", i+1);
|
|
|
+ rc = pConfig->ReadConfigValue("Device", (const char*)str, devs[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+ErrorCodeEnum SpGetDeviceInfo(CEntityBase *pCallerEntity, const CSimpleStringA &devDeviceName,
|
|
|
+ CSimpleStringA &strModel, CSimpleStringA &strVendor, CSimpleStringA &strVersion)
|
|
|
+{
|
|
|
+ CSmartPointer<IConfigInfo> pConfig;
|
|
|
+ ErrorCodeEnum rc = pCallerEntity->GetFunction()->OpenConfig(Config_Root, pConfig);
|
|
|
+ if (rc == Error_Succeed)
|
|
|
+ {
|
|
|
+ CSimpleStringA strSection = CSimpleStringA("Device.") + devDeviceName;
|
|
|
+
|
|
|
+ pConfig->ReadConfigValue(strSection, "Vendor", strVendor);
|
|
|
+ pConfig->ReadConfigValue(strSection, "Version", strVersion);
|
|
|
+
|
|
|
+ strModel = devDeviceName;
|
|
|
+ if (!strVendor.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strModel += ".";
|
|
|
+ strModel += strVendor;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!strVersion.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strModel += ".";
|
|
|
+ strModel += strVersion;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+ErrorCodeEnum SpGetDevAdaptorPath(CEntityBase *pCallerEntity,
|
|
|
+ const CSimpleStringA &devDeviceName,
|
|
|
+ CSimpleStringA &strDevAdaptorPath)
|
|
|
+{
|
|
|
+ CSmartPointer<IConfigInfo> pConfig;
|
|
|
+ ErrorCodeEnum rc = pCallerEntity->GetFunction()->OpenConfig(Config_Root, pConfig);
|
|
|
+ if (rc == Error_Succeed)
|
|
|
+ {
|
|
|
+ CSimpleStringA strSection = CSimpleStringA("Device.") + devDeviceName;
|
|
|
+
|
|
|
+ strDevAdaptorPath = devDeviceName;
|
|
|
+
|
|
|
+ CSimpleStringA str;
|
|
|
+ pConfig->ReadConfigValue(strSection, "Vendor", str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ str.Clear();
|
|
|
+ pConfig->ReadConfigValue(strSection, "Version", str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ str.Clear();
|
|
|
+ pConfig->ReadConfigValue(strSection, "Batch", str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA strDepPath;
|
|
|
+ pCallerEntity->GetFunction()->GetPath("Dep", strDepPath);
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+ strDevAdaptorPath = CSimpleStringA::Format("%s\\%s.dll",
|
|
|
+ (const char*)strDepPath,
|
|
|
+ (const char*)strDevAdaptorPath);
|
|
|
+#else
|
|
|
+ strDevAdaptorPath = CSimpleStringA::Format("%s/%s.so",
|
|
|
+ (const char*)strDepPath,
|
|
|
+ (const char*)strDevAdaptorPath);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+// add by ly
|
|
|
+ErrorCodeEnum SpGetDevAdaptorPathByIndex(int nIndex,
|
|
|
+ CEntityBase *pCallerEntity,
|
|
|
+ const CSimpleStringA &devDeviceName,
|
|
|
+ CSimpleStringA &strDevAdaptorPath)
|
|
|
+{
|
|
|
+ CSmartPointer<IConfigInfo> pConfig;
|
|
|
+ ErrorCodeEnum rc = pCallerEntity->GetFunction()->OpenConfig(Config_Root, pConfig);
|
|
|
+ if (rc == Error_Succeed)
|
|
|
+ {
|
|
|
+ char tmp[64] = {0};
|
|
|
+ CSimpleStringA strSection = CSimpleStringA("Device.") + devDeviceName;
|
|
|
+
|
|
|
+ strDevAdaptorPath = devDeviceName;
|
|
|
+
|
|
|
+ CSimpleStringA str;
|
|
|
+ sprintf(tmp, "Vendor_%d", nIndex);
|
|
|
+ pConfig->ReadConfigValue(strSection, tmp, str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ str.Clear();
|
|
|
+ sprintf(tmp, "Version_%d", nIndex);
|
|
|
+ pConfig->ReadConfigValue(strSection, tmp, str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ str.Clear();
|
|
|
+ sprintf(tmp, "Batch_%d", nIndex);
|
|
|
+ pConfig->ReadConfigValue(strSection, tmp, str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA strDepPath;
|
|
|
+ pCallerEntity->GetFunction()->GetPath("Dep", strDepPath);
|
|
|
+
|
|
|
+ strDevAdaptorPath = CSimpleStringA::Format("%s\\%s.dll",
|
|
|
+ (const char*)strDepPath,
|
|
|
+ (const char*)strDevAdaptorPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+// BranchDevice [Josephus in 16:32:09 2016/6/22]
|
|
|
+ErrorCodeEnum SpGetBrDevAdaptorPath(CEntityBase *pCallerEntity,
|
|
|
+ const CSimpleStringA &devDeviceName,
|
|
|
+ CSimpleStringA &strDevAdaptorPath)
|
|
|
+{
|
|
|
+ CSmartPointer<IConfigInfo> pConfig;
|
|
|
+ ErrorCodeEnum rc = pCallerEntity->GetFunction()->OpenConfig(Config_Root, pConfig);
|
|
|
+ if (rc == Error_Succeed)
|
|
|
+ {
|
|
|
+ CSimpleStringA strSection = CSimpleStringA("BranchDevice.") + devDeviceName;
|
|
|
+
|
|
|
+ strDevAdaptorPath = devDeviceName;
|
|
|
+
|
|
|
+ CSimpleStringA str;
|
|
|
+ pConfig->ReadConfigValue(strSection, "Branch", str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ str.Clear();
|
|
|
+ pConfig->ReadConfigValue(strSection, "Version", str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ str.Clear();
|
|
|
+ pConfig->ReadConfigValue(strSection, "Batch", str);
|
|
|
+ if (!str.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ strDevAdaptorPath += ".";
|
|
|
+ strDevAdaptorPath += str;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA strDepPath;
|
|
|
+ pCallerEntity->GetFunction()->GetPath("Dep", strDepPath);
|
|
|
+
|
|
|
+ //strDevAdaptorPath = CSimpleStringA::Format("%s\\%s.dll",
|
|
|
+ // (const char*)strDepPath,
|
|
|
+ // (const char*)strDevAdaptorPath);
|
|
|
+ strDevAdaptorPath = CSimpleStringA::Format("%s.dll", (const char*)strDevAdaptorPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+ErrorCodeEnum IsNeedOpenUsb(CEntityBase *pCallerEntity, bool& bNeedOpenUsb)
|
|
|
+{
|
|
|
+ ErrorCodeEnum errCode = Error_Unexpect;
|
|
|
+ CSystemStaticInfo sysDevInfo;
|
|
|
+ errCode = pCallerEntity->GetFunction()->GetSystemStaticInfo(sysDevInfo);
|
|
|
+
|
|
|
+ if(errCode != Error_Succeed){
|
|
|
+ Dbg("get device info failed while judge open usb or not");
|
|
|
+ }else{
|
|
|
+ CSimpleStringA strMachineType;
|
|
|
+ strMachineType = sysDevInfo.strMachineType;
|
|
|
+ WORD majorVersion = sysDevInfo.MachineVersion.GetMajor();
|
|
|
+ WORD minorVersion = sysDevInfo.MachineVersion.GetMinor();
|
|
|
+ CSimpleStringA machineVersion = CSimpleStringA::Format("%d.%d", majorVersion, minorVersion);
|
|
|
+ Dbg("MachineType:%s, machineVersion:%s", strMachineType.GetData(), machineVersion.GetData());
|
|
|
+
|
|
|
+ if(!strMachineType.Compare("RVC.PAD", true)
|
|
|
+ || (!strMachineType.Compare("RVC.Desk2S", true) && !machineVersion.Compare("1.0")))
|
|
|
+ {
|
|
|
+ bNeedOpenUsb = false;
|
|
|
+ }
|
|
|
+ else if(!strMachineType.Compare("RVC.Stand2S", true) || !strMachineType.Compare("RVC.CardStore", true)
|
|
|
+ || (!strMachineType.Compare("RVC.Desk2S", true) && !machineVersion.Compare("2.0"))
|
|
|
+ || (!strMachineType.Compare("RVC.Desk2S", true) && !machineVersion.Compare("2.1"))
|
|
|
+ || (!strMachineType.Compare("RVC.Desk1S", true) && !machineVersion.Compare("1.0")))
|
|
|
+ {
|
|
|
+ bNeedOpenUsb = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //TODO:: if add new machine type
|
|
|
+ bNeedOpenUsb = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return errCode;
|
|
|
+}
|
|
|
+
|