#ifndef __DEVICE_USER_H__ #define __DEVICE_USER_H__ #include "base/HGDef.h" #include #if defined (HG_CMP_MSC) #include "twain_user/HGTwain.h" class DeviceUserMgr : public QObject { Q_OBJECT public: DeviceUserMgr(QString password, QWidget *wnd); ~DeviceUserMgr(); // 弹出设备选择对话框,选择twain源 class DeviceUser* OpenDeviceUser(); class DeviceUser* OpenDefaultDeviceUser(); private: QWidget *m_wnd; HGTwainDSM m_twainDSM; QString m_password; }; class DeviceUser : public QObject { Q_OBJECT friend class DeviceUserMgr; DeviceUser(QWidget *wnd, HGTwainDS ds, QString password); public: ~DeviceUser(); // 获取设备名字 QString GetName(); // 弹出配置对话框 HGResult ShowSettingDlg(); // 弹出扫描对话框 HGResult StartScan(); HGResult StartSingleScan(); HGResult GetDeviceCustomInfo(HGTwainDeviceCustomInfo *info); HGResult Login(); HGResult Logout(); HGResult ClearRollerCount(); QString GetDriverLog(); HGResult ClearDriverLog(); QString GetDeviceLog(); HGResult ClearDeviceLog(); private: static void HGAPI DSEventFunc(HGTwainDS ds, HGUInt event, HGPointer param); static void HGAPI DSImageFunc(HGTwainDS ds, HGImage image, HGPointer param); signals: void newImage(void *image); void scanFinishEvent(); void scanWorkingEvent(); private: QWidget *m_wnd; HGTwainDS m_twainDS; QString m_password; }; #else #include "sane_user/HGSane.h" class DeviceUserMgr : public QObject { Q_OBJECT public: DeviceUserMgr(QString password, QWidget *wnd); ~DeviceUserMgr(); // 弹出设备选择对话框,选择设备 class DeviceUser* OpenDeviceUser(); class DeviceUser* OpenDefaultDeviceUser(); private: QWidget *m_wnd; QString m_password; HGSaneManager m_saneMgr; }; class DeviceUser : public QObject { Q_OBJECT friend class DeviceUserMgr; DeviceUser(QWidget *wnd, HGSaneSource source, HGSaneDevice dev, QString password); public: ~DeviceUser(); // 获取设备名字 QString GetName(); // 弹出配置对话框 HGResult ShowSettingDlg(); // 弹出扫描对话框 HGResult StartScan(); HGResult StartSingleScan(); HGResult GetDeviceCustomInfo(HGSaneDeviceCustomInfo *info); HGResult Login(); HGResult Logout(); HGResult ClearRollerCount(); int GetDeviceRollerLife(); QString GetDriverLog(); HGResult ClearDriverLog(); QString GetDeviceLog(); HGResult ClearDeviceLog(); private: static void HGAPI DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param); static void HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param); signals: void newImage(void *image); void scanFinishEvent(); void scanWorkingEvent(); private: QWidget *m_wnd; HGSaneSource m_source; HGSaneDevice m_saneDev; QString m_password; }; #endif #endif /* __DEVICE_USER_H__ */