HSPScannerClass.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /////////////////////////////////////////////////////////////////////////////////
  2. /// Copyright (c) 2016 China Merchants Bank, all rights reserved ///
  3. /// Adapter Interface for HSPS(high speed portable scanner). ///
  4. /// ///
  5. /////////////////////////////////////////////////////////////////////////////////
  6. #ifndef __HSPS_CLASS_H__
  7. #define __HSPS_CLASS_H__
  8. #pragma once
  9. #include "DeviceBaseClass.h"
  10. #define DEFAULT_DIALOG_WIDTH 960
  11. enum ParamType
  12. {
  13. /**Color model.*/
  14. /**设置色彩*/
  15. HSPS_MODEL_COLOR,
  16. /**Video rotate model.*/
  17. /**设置拍摄角度,不带持续旋转的意义*/
  18. HSPS_MODEL_ROTATE,
  19. /**Scan type.*/
  20. /**设置扫描图片尺寸*/
  21. HSPS_MODEL_SCANSIZE,
  22. /**Preview dialog view type.*/
  23. /**设置预览窗口显示与否和显示的位置,预览活动窗口尺寸为16:9,*/
  24. HSPS_MODEL_VIEW
  25. };
  26. enum ParamTypeValue
  27. {
  28. /**Boolean Value*/
  29. HSPS_BOOLVAL_FALSE,
  30. HSPS_BOOLVAL_TRUE,
  31. /**for/set color model.*/
  32. HSPS_COLOR_FULL, // 彩色模式 default mod.
  33. HSPS_COLOR_GREY, // 灰度模式 gray mode.
  34. /**for/set video rotate model.*/
  35. HSPS_ROTATE_NOANGLE, // 物理环境的上方为预览窗口的上方 Positive direction.
  36. HSPS_ROTATE_LEFT, // 物理环境的左侧为预览窗口的上方
  37. HSPS_ROTATE_MIRROR, // 物理环境的下方为预览窗口的上方 Opposite/Nagative direction.
  38. HSPS_ROTATE_RIGHT, // 物理环境的右侧为预览窗口的上方
  39. /**for/set scan size.*/
  40. HSPS_SCAN_FULL, // 全画幅扫描
  41. HSPS_SCAN_A4, // A4尺寸扫描
  42. HSPS_SCAN_IDCARD, // 身份证尺寸扫描
  43. /**for/set dialog view type.*/
  44. //宽的长度在第一次执行SetViewPos前使用 DEFAULT_DIALOG_WIDTH 的值,否则使用上一次执行SetViewPos成功时传送的值
  45. HSPS_VIEW_HIDE, // 隐藏预览窗口
  46. HSPS_VIEW_SHOW, // 显示预览窗口
  47. // 更新20161117:取消 HSPS_MODEL_VIEW 部分参数设置
  48. //HSPS_VIEW_FULL, // 副屏幕进行全屏显示
  49. //HSPS_VIEW_CENTER, // 中间显示
  50. //HSPS_VIEW_LEFTTOP, // 左上角显示
  51. //HSPS_VIEW_RIGHTBOTTOM, // 右下角显示
  52. //HSPS_VIEW_CUSTOM // 恢复上一次调用SetViewPos时显示的位置
  53. };
  54. struct HspsDevStatus
  55. {
  56. //Indicate devic is connected or not.
  57. //which 1 means connected and 0 means disconnected, others is undefined.
  58. //高拍仪连接状态:1 表示已连接,0 表示未连接
  59. short isConnected;
  60. //Indicate device is previewing or not.
  61. //which 1 means inPreview and 0 means outPreview, others is undefined.
  62. //窗口预览状态:1 表示处于预览状态,0 表示预览关闭状态
  63. short inPreview;
  64. //Indicate the dlg is showing or not.
  65. //which !0 means show and 0 means hide status.
  66. //窗口显示状态:1 表示窗口处于显示状态,0表示窗口处于隐藏状态
  67. //窗口处于显示状态时,必须能处于预览的状态 --这句无效!!!!
  68. short inShow;
  69. };
  70. class CHSPSClass : public DeviceBaseClass
  71. {
  72. public:
  73. //
  74. // Device initialization.
  75. // Connect to High speed portable scanner.
  76. // 更新20161117:只做设备连接操作,不显示窗口
  77. //
  78. virtual ErrorCodeEnum DevOpen() = 0;
  79. //
  80. // Set param, more detail please to see ParamType and its according ParamTypeValue.
  81. //
  82. virtual ErrorCodeEnum SetParam(ParamType type, ParamTypeValue value) = 0;
  83. //
  84. // Command the device to start to preview or stop previewing.
  85. // -nValue[in] set 1 means StartPreview while 0 means StopPreview.
  86. // If the device' state had been setted before what the nValue commanded, ignore it and
  87. // return Error_Succeed.
  88. // The function returns only the specified behavior is done completely, StartPreview in special.
  89. // 更新20161117: nValue值为 1 时打开预览,确保当前打开预览过程执行结束且窗口处于显示状态才返回Error_Succeed,
  90. // nValue值为 0 时关闭预览并隐藏窗口
  91. //
  92. //
  93. virtual ErrorCodeEnum SetPreview(short nValue) = 0;
  94. //
  95. // Scan Image from device and store the image.
  96. // -pszFileName[in] Store the path and name using suffix ".jpg"
  97. // specifies that where the image will be located and what it would be named.
  98. // 拍摄照片,传入的文件名已带绝对路径,无需再进行拼接处理
  99. //
  100. virtual ErrorCodeEnum ScanImage(const char* pszFileName) = 0;
  101. //
  102. // Scan Image from device and return the image data in byte format.
  103. // -pBtImg[out] The buffer used to store the scanned image data.
  104. // 存储图片字节流的缓冲区,大小为 nBtLen 字节
  105. // -nBtLen[in,out] Indicate the max byte-type size of pBtImg could be stored
  106. // and Store the real byte-type size of pBtImg had used when returned.
  107. // when detect value of nBtLen is 0 or smaller that necessary size, please
  108. // set nBtlen with real byte-type size and return Error_TooSmallBuffer.
  109. // 如果nBtLen指定的字节数过小,那么对nBtLen赋值实际所需的大小并返回 Error_TooSmallBuffer,此操作仅允许一次
  110. // -pszFileName[in] Store the path and name where the image file should be located
  111. // while "" indicates that the image file shouldn't be stored at locate.
  112. // 文件名长度为零表示不在本地生成图片文件
  113. //
  114. //
  115. virtual ErrorCodeEnum ScanImageEx(BYTE* pBtImg, int& nBtLen, const char* pszFileName = "") = 0;
  116. //
  117. // Set position and width of preview dialog with the rate of length to width: 16:9.
  118. // -nX[in] The X coordinate of leftTop point.
  119. // -nY[in] The Y coordinate of leftTop point.
  120. // -nWidth[in] The Width of Preview Dialog .
  121. // 传入预览窗口显示的坐标,左上角的横坐标nX,左上角的纵坐标nY,以及预览窗口的宽,宽与高的比例为 16:9
  122. //
  123. virtual ErrorCodeEnum SetViewPos(int nX, int nY, int nWidth) = 0;
  124. //
  125. // Show property dialog of HSPS of LiangTian.
  126. // If there is no property dialog function, ignore it and return Error_NotImpl(更新20161117).
  127. // 更新20161117:用于打开良田高拍仪设备的设置属性页,可能用不到
  128. //
  129. virtual ErrorCodeEnum SetProperty() = 0;
  130. //
  131. // Get current status of device.
  132. //
  133. virtual ErrorCodeEnum GetDevStatus(HspsDevStatus& status) = 0;
  134. };
  135. #endif //__HSPS_CLASS_H__