#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(const 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, const QString &password); public: ~DeviceUser(); HGResult Open(); HGResult OpenDefault(); HGResult Close(); // 获取设备名字 QString GetName(); HGResult Clear(); // 弹出配置对话框 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 HGUInt HGAPI DSImageFunc(HGTwainDS ds, HGImage image, HGUInt type, HGPointer param); signals: void newImage(void *image); void scanFinishEvent(); void scanWorkingEvent(); void clearRes(); private: QWidget *m_wnd; HGTwainDS m_twainDS; QString m_password; }; #else #include "sane_user/HGSane.h" class DeviceUserMgr : public QObject { Q_OBJECT public: DeviceUserMgr(const 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, const QString &password); public: ~DeviceUser(); HGResult Open(); HGResult OpenDefault(); HGResult Close(); // 获取设备名字 QString GetName(); HGResult Clear(); // 弹出配置对话框 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 HGUInt HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGUInt type, HGPointer param); signals: void newImage(void *image); void abnormalImage(void *image, HGUInt *result); void scanFinishEvent(); void scanWorkingEvent(); void clearRes(); private: QWidget *m_wnd; HGSaneSource m_source; HGSaneDevice m_saneDev; QString m_password; }; #endif #endif /* __DEVICE_USER_H__ */