hspscannerimpl.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #ifndef HSPSCANNERIMPL_H
  2. #define HSPSCANNERIMPL_H
  3. #include "stdafx.h"
  4. #include <QObject>
  5. #include "HSPScannerClass.h"
  6. #include <QThread>
  7. //#include "hspscannerform.h"
  8. //#include "ThreadWorker.h"
  9. #include "CkDBus.h"
  10. typedef struct
  11. {
  12. int iCode;
  13. char sInf[128];
  14. ErrorCodeEnum iRet;
  15. int iInf;
  16. } CmbErrorDef;
  17. class HSPSClassImpl : public CHSPSClass
  18. {
  19. //Q_OBJECT
  20. public:
  21. HSPSClassImpl();
  22. virtual ~HSPSClassImpl();
  23. public:
  24. //
  25. // Device initialization.
  26. // Connect to High speed portable scanner.
  27. // 更新20161117:只做设备连接操作,不显示窗口
  28. //
  29. virtual ErrorCodeEnum DevOpen();
  30. //
  31. // Set param, more detail please to see ParamType and its according ParamTypeValue.
  32. //
  33. virtual ErrorCodeEnum SetParam(ParamType type, ParamTypeValue value);
  34. //
  35. // Command the device to start to preview or stop previewing.
  36. // -nValue[in] set 1 means StartPreview while 0 means StopPreview.
  37. // If the device' state had been setted before what the nValue commanded, ignore it and
  38. // return Error_Succeed.
  39. // The function returns only the specified behavior is done completely, StartPreview in special.
  40. // 更新20161117: nValue值为 1 时打开预览,确保当前打开预览过程执行结束且窗口处于显示状态才返回Error_Succeed,
  41. // nValue值为 0 时关闭预览并隐藏窗口
  42. //
  43. //
  44. virtual ErrorCodeEnum SetPreview(short nValue);
  45. //
  46. // Scan Image from device and store the image.
  47. // -pszFileName[in] Store the path and name using suffix ".jpg"
  48. // specifies that where the image will be located and what it would be named.
  49. // 拍摄照片,传入的文件名已带绝对路径,无需再进行拼接处理
  50. //
  51. virtual ErrorCodeEnum ScanImage(const char* pszFileName);
  52. //
  53. // Scan Image from device and return the image data in byte format.
  54. // -pBtImg[out] The buffer used to store the scanned image data.
  55. // 存储图片字节流的缓冲区,大小为 nBtLen 字节
  56. // -nBtLen[in,out] Indicate the max byte-type size of pBtImg could be stored
  57. // and Store the real byte-type size of pBtImg had used when returned.
  58. // when detect value of nBtLen is 0 or smaller that necessary size, please
  59. // set nBtlen with real byte-type size and return Error_TooSmallBuffer.
  60. // 如果nBtLen指定的字节数过小,那么对nBtLen赋值实际所需的大小并返回 Error_TooSmallBuffer,此操作仅允许一次
  61. // -pszFileName[in] Store the path and name where the image file should be located
  62. // while "" indicates that the image file shouldn't be stored at locate.
  63. // 文件名长度为零表示不在本地生成图片文件
  64. //
  65. //
  66. virtual ErrorCodeEnum ScanImageEx(BYTE* pBtImg, int& nBtLen, const char* pszFileName = "");
  67. //
  68. // Set position and width of preview dialog with the rate of length to width: 16:9.
  69. // -nX[in] The X coordinate of leftTop point.
  70. // -nY[in] The Y coordinate of leftTop point.
  71. // -nWidth[in] The Width of Preview Dialog .
  72. // 传入预览窗口显示的坐标,左上角的横坐标nX,左上角的纵坐标nY,以及预览窗口的宽,宽与高的比例为 16:9
  73. //
  74. virtual ErrorCodeEnum SetViewPos(int nX, int nY, int nWidth);
  75. //
  76. // Show property dialog of HSPS of LiangTian.
  77. // If there is no property dialog function, ignore it and return Error_NotImpl(更新20161117).
  78. // 更新20161117:用于打开良田高拍仪设备的设置属性页,可能用不到
  79. //
  80. virtual ErrorCodeEnum SetProperty();
  81. //
  82. // Get current status of device.
  83. //
  84. virtual ErrorCodeEnum GetDevStatus(HspsDevStatus& status);
  85. virtual ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
  86. //
  87. // Reset device.
  88. // Do the cleaning work and initialize device again in order to return to
  89. // the normal condition.
  90. virtual ErrorCodeEnum Reset();
  91. //
  92. // Close device and do the cleaning work.
  93. // ex. close connection,close port,release memery and so on
  94. virtual ErrorCodeEnum DevClose();
  95. //
  96. // Get last error the device issued.
  97. // Error message must include explanatory memorandum ,the original error
  98. // code and anything in favour of location problem.
  99. virtual ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
  100. //Q_SIGNALS:
  101. // void startThreadWork_signal();
  102. private:
  103. // WorkerClass *m_WorkerObj;
  104. // QThread* m_WorkerThread;
  105. // void startWorkerThread();
  106. //HSPScannerForm m_CamDevice;
  107. //HSPSThread m_HSPSThread;
  108. //QThread* m_pHSPSThread;
  109. DevErrorInfo m_DevErrInfo;
  110. DBusInfo m_DBusInf_C;
  111. DBusInfo m_DBusInf_S;
  112. char m_sLibPath[256];
  113. LPDBusRQInfo m_lpRQInf;
  114. bool m_bOpen;
  115. };
  116. #endif // HSPSCANNERIMPL_H