mod_HSPScanner.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // mod_HSPScanner.cpp : 定义 DLL 应用程序的导出函数。
  2. //
  3. #include "stdafx.h"
  4. #include "mod_HSPScanner.h"
  5. #include "fileutil.h"
  6. void CHSPScannerServerSession::Handle_StartPreview(SpReqAnsContext<HSPScannerService_StartPreview_Req,
  7. HSPScannerService_StartPreview_Ans>::Pointer ctx)
  8. {
  9. DbgToBeidou(ctx->link, __FUNCTION__)();
  10. m_pEntity->Preview(ctx);
  11. }
  12. void CHSPScannerServerSession::Handle_CancelPreview(SpReqAnsContext<HSPScannerService_CancelPreview_Req,
  13. HSPScannerService_CancelPreview_Ans>::Pointer ctx)
  14. {
  15. DbgToBeidou(ctx->link, __FUNCTION__)();
  16. m_pEntity->CancelPreview(ctx);
  17. }
  18. void CHSPScannerServerSession::Handle_ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
  19. HSPScannerService_ScanImage_Ans>::Pointer ctx)
  20. {
  21. DbgToBeidou(ctx->link, __FUNCTION__)();
  22. m_pEntity->ScanImage(ctx);
  23. }
  24. void CHSPScannerServerSession::Handle_ScanImageEx(SpReqAnsContext<HSPScannerService_ScanImageEx_Req,
  25. HSPScannerService_ScanImageEx_Ans>::Pointer ctx)
  26. {
  27. DbgToBeidou(ctx->link, __FUNCTION__)();
  28. m_pEntity->ScanImageEx(ctx);
  29. }
  30. void CHSPScannerServerSession::Handle_SetProperty(SpReqAnsContext<HSPScannerService_SetProperty_Req,
  31. HSPScannerService_SetProperty_Ans>::Pointer ctx)
  32. {
  33. DbgToBeidou(ctx->link, __FUNCTION__)();
  34. m_pEntity->SetProperty(ctx);
  35. }
  36. void CHSPScannerServerSession::Handle_SetWinPos(SpReqAnsContext<HSPScannerService_SetWinPos_Req,
  37. HSPScannerService_SetWinPos_Ans>::Pointer ctx)
  38. {
  39. DbgToBeidou(ctx->link, __FUNCTION__)();
  40. m_pEntity->SetWinPos(ctx);
  41. }
  42. void CHSPScannerServerSession::Handle_ShowProperty(SpReqAnsContext<HSPScannerService_ShowProperty_Req, HSPScannerService_ShowProperty_Ans>::Pointer ctx)
  43. {
  44. DbgToBeidou(ctx->link, __FUNCTION__)();
  45. m_pEntity->ShowProperty(ctx);
  46. }
  47. void CHSPScannerServerSession::Handle_GetDevStatus(SpReqAnsContext<HSPScannerService_GetDevStatus_Req,
  48. HSPScannerService_GetDevStatus_Ans>::Pointer ctx)
  49. {
  50. DbgToBeidou(ctx->link, __FUNCTION__)();
  51. m_pEntity->GetDevStatus(ctx);
  52. }
  53. void CHSPScannerServerSession::Handle_GetDevInfo(SpReqAnsContext<HSPScannerService_GetDevInfo_Req,
  54. HSPScannerService_GetDevInfo_Ans>::Pointer ctx)
  55. {
  56. DbgToBeidou(ctx->link, __FUNCTION__)();
  57. m_pEntity->GetDevInfo(ctx);
  58. }
  59. void CHSPScannerServerSession::Handle_Exit(SpOnewayCallContext<HSPScannerService_Exit_Info>::Pointer ctx)
  60. {
  61. DbgToBeidou(ctx->link, __FUNCTION__)();
  62. m_pEntity->Exit(ctx);
  63. }
  64. #if defined(_MSC_VER)
  65. ErrorCodeEnum CHSPScannerEntity::CustomVendorLibInfo()
  66. {
  67. if (vendorLibInfo.strVendor.Compare("keba", true) == 0
  68. && ((vendorLibInfo.strVersion == "7" && vendorLibInfo.strBatch == "1")
  69. || (vendorLibInfo.strVersion == "1" && vendorLibInfo.strBatch == "1"))) {
  70. CSimpleStringA strExistDriver(true);
  71. BOOL isNewOne(FALSE);
  72. if (ExistsFileA("C:\\Program Files (x86)\\eloamDll_2.4\\bin\\eloamDll.dll")) {
  73. strExistDriver = "C:\\Program Files (x86)\\eloamDll_2.4\\bin\\eloamDll.dll";
  74. isNewOne = TRUE;
  75. } else if (ExistsFileA("C:\\Program Files\\eloamDll_2.4\\bin\\eloamDll.dll")) {
  76. strExistDriver = "C:\\Program Files\\eloamDll_2.4\\bin\\eloamDll.dll";
  77. isNewOne = TRUE;
  78. } else if (ExistsFileA("C:\\Program Files (x86)\\eloamDll_2.3\\bin\\eloamDll.dll")) {
  79. strExistDriver = "C:\\Program Files (x86)\\eloamDll_2.3\\bin\\eloamDll.dll";
  80. } else if (ExistsFileA("C:\\Program Files\\eloamDll_2.3\\bin\\eloamDll.dll")) {
  81. strExistDriver = "C:\\Program Files\\eloamDll_2.3\\bin\\eloamDll.dll";
  82. }
  83. if (!strExistDriver.IsNullOrEmpty()) {
  84. CSmartPointer<IConfigInfo> spConfig;
  85. GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
  86. CSimpleStringA strDepDirPath(true);
  87. GetFunction()->GetPath("Dep", strDepDirPath);
  88. strDepDirPath += "\\";
  89. strDepDirPath += "HSPScanner.keba.7.2.dll";
  90. if (ExistsFileA(strDepDirPath)) {
  91. int value(0);
  92. spConfig->ReadConfigValueInt(GetEntityName(), "KebaAdapterSwitch", value);
  93. if (value == 0) {
  94. LogWarn(Severity_Low, Error_Debug, LOG_WARN_HSPS_VENDORDLL_KEBA_MATCHED, strExistDriver);
  95. } else {
  96. LogWarn(Severity_Low, Error_Debug, LOG_WARN_HSPS_VENDORDLL_CHANGE, strDepDirPath);
  97. vendorLibInfo.strVersion = "7";
  98. vendorLibInfo.strBatch = "2";
  99. }
  100. }
  101. }
  102. }
  103. return Error_Succeed;
  104. }
  105. #endif //_MSC_VER
  106. SP_BEGIN_ENTITY_MAP()
  107. SP_ENTITY(CHSPScannerEntity)
  108. SP_END_ENTITY_MAP()