123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- /////////////////////////////////////////////////////////////////////////////////
- /// Copyright (c) 2016 China Merchants Bank, all rights reserved ///
- /// Adapter Interface for HSPS(high speed portable scanner). ///
- /// ///
- /////////////////////////////////////////////////////////////////////////////////
- #ifndef __HSPS_CLASS_H__
- #define __HSPS_CLASS_H__
- #pragma once
- #include "DeviceBaseClass.h"
- #define DEFAULT_DIALOG_WIDTH 960
- enum ParamType
- {
- /**Color model.*/
- /**设置色彩*/
- HSPS_MODEL_COLOR,
- /**Video rotate model.*/
- /**设置拍摄角度,不带持续旋转的意义*/
- HSPS_MODEL_ROTATE,
- /**Scan type.*/
- /**设置扫描图片尺寸*/
- HSPS_MODEL_SCANSIZE,
- /**Preview dialog view type.*/
- /**设置预览窗口显示与否和显示的位置,预览活动窗口尺寸为16:9,*/
- HSPS_MODEL_VIEW
- };
- enum ParamTypeValue
- {
- /**Boolean Value*/
- HSPS_BOOLVAL_FALSE,
- HSPS_BOOLVAL_TRUE,
- /**for/set color model.*/
- HSPS_COLOR_FULL, // 彩色模式 default mod.
- HSPS_COLOR_GREY, // 灰度模式 gray mode.
- /**for/set video rotate model.*/
- HSPS_ROTATE_NOANGLE, // 物理环境的上方为预览窗口的上方 Positive direction.
- HSPS_ROTATE_LEFT, // 物理环境的左侧为预览窗口的上方
- HSPS_ROTATE_MIRROR, // 物理环境的下方为预览窗口的上方 Opposite/Nagative direction.
- HSPS_ROTATE_RIGHT, // 物理环境的右侧为预览窗口的上方
- /**for/set scan size.*/
- HSPS_SCAN_FULL, // 全画幅扫描
- HSPS_SCAN_A4, // A4尺寸扫描
- HSPS_SCAN_IDCARD, // 身份证尺寸扫描
-
- /**for/set dialog view type.*/
- //宽的长度在第一次执行SetViewPos前使用 DEFAULT_DIALOG_WIDTH 的值,否则使用上一次执行SetViewPos成功时传送的值
- HSPS_VIEW_HIDE, // 隐藏预览窗口
- HSPS_VIEW_SHOW, // 显示预览窗口
- // 更新20161117:取消 HSPS_MODEL_VIEW 部分参数设置
- //HSPS_VIEW_FULL, // 副屏幕进行全屏显示
- //HSPS_VIEW_CENTER, // 中间显示
- //HSPS_VIEW_LEFTTOP, // 左上角显示
- //HSPS_VIEW_RIGHTBOTTOM, // 右下角显示
- //HSPS_VIEW_CUSTOM // 恢复上一次调用SetViewPos时显示的位置
- };
- struct HspsDevStatus
- {
- //Indicate devic is connected or not.
- //which 1 means connected and 0 means disconnected, others is undefined.
- //高拍仪连接状态:1 表示已连接,0 表示未连接
- short isConnected;
- //Indicate device is previewing or not.
- //which 1 means inPreview and 0 means outPreview, others is undefined.
- //窗口预览状态:1 表示处于预览状态,0 表示预览关闭状态
- short inPreview;
- //Indicate the dlg is showing or not.
- //which !0 means show and 0 means hide status.
- //窗口显示状态:1 表示窗口处于显示状态,0表示窗口处于隐藏状态
- //窗口处于显示状态时,必须能处于预览的状态 --这句无效!!!!
- short inShow;
- };
- class CHSPSClass : public DeviceBaseClass
- {
- public:
- //
- // Device initialization.
- // Connect to High speed portable scanner.
- // 更新20161117:只做设备连接操作,不显示窗口
- //
- virtual ErrorCodeEnum DevOpen() = 0;
- //
- // Set param, more detail please to see ParamType and its according ParamTypeValue.
- //
- virtual ErrorCodeEnum SetParam(ParamType type, ParamTypeValue value) = 0;
- //
- // Command the device to start to preview or stop previewing.
- // -nValue[in] set 1 means StartPreview while 0 means StopPreview.
- // If the device' state had been setted before what the nValue commanded, ignore it and
- // return Error_Succeed.
- // The function returns only the specified behavior is done completely, StartPreview in special.
- // 更新20161117: nValue值为 1 时打开预览,确保当前打开预览过程执行结束且窗口处于显示状态才返回Error_Succeed,
- // nValue值为 0 时关闭预览并隐藏窗口
- //
- //
- virtual ErrorCodeEnum SetPreview(short nValue) = 0;
- //
- // Scan Image from device and store the image.
- // -pszFileName[in] Store the path and name using suffix ".jpg"
- // specifies that where the image will be located and what it would be named.
- // 拍摄照片,传入的文件名已带绝对路径,无需再进行拼接处理
- //
- virtual ErrorCodeEnum ScanImage(const char* pszFileName) = 0;
- //
- // Scan Image from device and return the image data in byte format.
- // -pBtImg[out] The buffer used to store the scanned image data.
- // 存储图片字节流的缓冲区,大小为 nBtLen 字节
- // -nBtLen[in,out] Indicate the max byte-type size of pBtImg could be stored
- // and Store the real byte-type size of pBtImg had used when returned.
- // when detect value of nBtLen is 0 or smaller that necessary size, please
- // set nBtlen with real byte-type size and return Error_TooSmallBuffer.
- // 如果nBtLen指定的字节数过小,那么对nBtLen赋值实际所需的大小并返回 Error_TooSmallBuffer,此操作仅允许一次
- // -pszFileName[in] Store the path and name where the image file should be located
- // while "" indicates that the image file shouldn't be stored at locate.
- // 文件名长度为零表示不在本地生成图片文件
- //
- //
- virtual ErrorCodeEnum ScanImageEx(BYTE* pBtImg, int& nBtLen, const char* pszFileName = "") = 0;
- //
- // Set position and width of preview dialog with the rate of length to width: 16:9.
- // -nX[in] The X coordinate of leftTop point.
- // -nY[in] The Y coordinate of leftTop point.
- // -nWidth[in] The Width of Preview Dialog .
- // 传入预览窗口显示的坐标,左上角的横坐标nX,左上角的纵坐标nY,以及预览窗口的宽,宽与高的比例为 16:9
- //
- virtual ErrorCodeEnum SetViewPos(int nX, int nY, int nWidth) = 0;
- //
- // Show property dialog of HSPS of LiangTian.
- // If there is no property dialog function, ignore it and return Error_NotImpl(更新20161117).
- // 更新20161117:用于打开良田高拍仪设备的设置属性页,可能用不到
- //
- virtual ErrorCodeEnum SetProperty() = 0;
- //
- // Get current status of device.
- //
- virtual ErrorCodeEnum GetDevStatus(HspsDevStatus& status) = 0;
- };
- #endif //__HSPS_CLASS_H__
|