hspscanner_impl.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef LIBFRAMEWORK_HSPS_IMPL_H
  2. #define LIBFRAMEWORK_HSPS_IMPL_H
  3. #include "HSPScannerClass.h"
  4. /*
  5. enum HSP_STATE{
  6. HSP_DISCONNECTED = 0,
  7. HSP_CONNECTED,
  8. HSP_INPREVIEW,
  9. HSP_OUTPREVIEW,
  10. HSP_SHOW,
  11. HSP_HIDE
  12. };
  13. */
  14. class HSPSClassImpl : public CHSPSClass
  15. {
  16. public:
  17. HSPSClassImpl();
  18. ~HSPSClassImpl();
  19. //DeviceBaseClass
  20. ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
  21. ErrorCodeEnum Reset();
  22. ErrorCodeEnum DevClose();
  23. ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
  24. virtual ErrorCodeEnum DevOpen();
  25. //
  26. // Set param, more detail please to see ParamType and its according ParamTypeValue.
  27. //
  28. virtual ErrorCodeEnum SetParam(ParamType type, ParamTypeValue value);
  29. //
  30. // Command the device to start to preview or stop previewing.
  31. // -nValue[in] set 1 means StartPreview while 0 means StopPreview.
  32. // If the device' state had been setted before what the nValue commanded, ignore it and
  33. // return Error_Succeed.
  34. // The function returns only the specified behavior is done completely, StartPreview in special.
  35. // 更新20161117: nValue值为 1 时打开预览,确保当前打开预览过程执行结束且窗口处于显示状态才返回Error_Succeed,
  36. // nValue值为 0 时关闭预览并隐藏窗口
  37. //
  38. //
  39. virtual ErrorCodeEnum SetPreview(short nValue);
  40. //
  41. // Scan Image from device and store the image.
  42. // -pszFileName[in] Store the path and name using suffix ".jpg"
  43. // specifies that where the image will be located and what it would be named.
  44. // 拍摄照片,传入的文件名已带绝对路径,无需再进行拼接处理
  45. //
  46. virtual ErrorCodeEnum ScanImage(const char* pszFileName);
  47. //
  48. // Scan Image from device and return the image data in byte format.
  49. // -pBtImg[out] The buffer used to store the scanned image data.
  50. // 存储图片字节流的缓冲区,大小为 nBtLen 字节
  51. // -nBtLen[in,out] Indicate the max byte-type size of pBtImg could be stored
  52. // and Store the real byte-type size of pBtImg had used when returned.
  53. // when detect value of nBtLen is 0 or smaller that necessary size, please
  54. // set nBtlen with real byte-type size and return Error_TooSmallBuffer.
  55. // 如果nBtLen指定的字节数过小,那么对nBtLen赋值实际所需的大小并返回 Error_TooSmallBuffer,此操作仅允许一次
  56. // -pszFileName[in] Store the path and name where the image file should be located
  57. // while "" indicates that the image file shouldn't be stored at locate.
  58. // 文件名长度为零表示不在本地生成图片文件
  59. //
  60. //
  61. virtual ErrorCodeEnum ScanImageEx(BYTE* pBtImg, int& nBtLen, const char* pszFileName = "");
  62. //
  63. // Set position and width of preview dialog with the rate of length to width: 16:9.
  64. // -nX[in] The X coordinate of leftTop point.
  65. // -nY[in] The Y coordinate of leftTop point.
  66. // -nWidth[in] The Width of Preview Dialog .
  67. // 传入预览窗口显示的坐标,左上角的横坐标nX,左上角的纵坐标nY,以及预览窗口的宽,宽与高的比例为 16:9
  68. //
  69. virtual ErrorCodeEnum SetViewPos(int nX, int nY, int nWidth);
  70. //
  71. // Show property dialog of HSPS of LiangTian.
  72. // If there is no property dialog function, ignore it and return Error_NotImpl(更新20161117).
  73. // 更新20161117:用于打开良田高拍仪设备的设置属性页,可能用不到
  74. //
  75. virtual ErrorCodeEnum SetProperty();
  76. //
  77. // Get current status of device.
  78. //
  79. virtual ErrorCodeEnum GetDevStatus(HspsDevStatus& status);
  80. private:
  81. void* m_hSo;
  82. int m_mode;
  83. unsigned char* m_pBuffPic;
  84. HspsDevStatus m_status;
  85. // ParamType m_ptype;
  86. // ParamTypeValue m_ptValue;
  87. bool m_bAutoCorp;
  88. int m_nColorType;
  89. int m_nRotateSize;
  90. int m_nX;
  91. int m_nY;
  92. int m_nWidth;
  93. DevErrorInfo m_DevErrorInfo;
  94. void ZeroDevErrorInfo();
  95. void FormatDevErrorInfo(const char* funcname, int line, int errCode,const char* errStr);
  96. void ResetParm();
  97. void DeleteOldPic(const char* pszFileName);
  98. void CheckSavePic(const char* pszFileName);
  99. };
  100. #endif //LIBFRAMEWORK_HSPS_IMPL_H