2023-06-01 06:57:39 +00:00
|
|
|
|
#ifndef __DEVICE_USER_H__
|
2023-05-04 06:55:26 +00:00
|
|
|
|
#define __DEVICE_USER_H__
|
|
|
|
|
|
|
|
|
|
#include "base/HGDef.h"
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
|
2023-05-16 10:31:32 +00:00
|
|
|
|
#if defined (HG_CMP_MSC)
|
2023-05-04 06:55:26 +00:00
|
|
|
|
#include "twain_user/HGTwain.h"
|
|
|
|
|
|
|
|
|
|
class DeviceUserMgr : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2023-08-15 07:28:23 +00:00
|
|
|
|
DeviceUserMgr(const QString &password, QWidget *wnd);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
~DeviceUserMgr();
|
|
|
|
|
|
|
|
|
|
// 弹出设备选择对话框,选择twain源
|
|
|
|
|
class DeviceUser* OpenDeviceUser();
|
2023-05-30 11:11:24 +00:00
|
|
|
|
class DeviceUser* OpenDefaultDeviceUser();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QWidget *m_wnd;
|
|
|
|
|
HGTwainDSM m_twainDSM;
|
2023-05-16 10:31:32 +00:00
|
|
|
|
QString m_password;
|
2023-05-04 06:55:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DeviceUser : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
friend class DeviceUserMgr;
|
2023-08-15 07:28:23 +00:00
|
|
|
|
DeviceUser(QWidget *wnd, HGTwainDS ds, const QString &password);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
public:
|
|
|
|
|
~DeviceUser();
|
|
|
|
|
|
2023-08-15 07:28:23 +00:00
|
|
|
|
HGResult Open();
|
2023-08-15 07:38:21 +00:00
|
|
|
|
HGResult OpenDefault();
|
2023-08-15 07:28:23 +00:00
|
|
|
|
HGResult Close();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
// 获取设备名字
|
|
|
|
|
QString GetName();
|
|
|
|
|
// 弹出配置对话框
|
|
|
|
|
HGResult ShowSettingDlg();
|
|
|
|
|
// 弹出扫描对话框
|
|
|
|
|
HGResult StartScan();
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult StartSingleScan();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
HGResult GetDeviceCustomInfo(HGTwainDeviceCustomInfo *info);
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult Login();
|
|
|
|
|
HGResult Logout();
|
|
|
|
|
HGResult ClearRollerCount();
|
2023-05-17 10:29:08 +00:00
|
|
|
|
QString GetDriverLog();
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult ClearDriverLog();
|
2023-05-17 10:29:08 +00:00
|
|
|
|
QString GetDeviceLog();
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult ClearDeviceLog();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2023-05-20 08:08:55 +00:00
|
|
|
|
static void HGAPI DSEventFunc(HGTwainDS ds, HGUInt event, HGPointer param);
|
2023-10-16 02:38:35 +00:00
|
|
|
|
static HGUInt HGAPI DSImageFunc(HGTwainDS ds, HGImage image, HGUInt type, HGPointer param);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void newImage(void *image);
|
2023-06-01 06:57:39 +00:00
|
|
|
|
void scanFinishEvent();
|
|
|
|
|
void scanWorkingEvent();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QWidget *m_wnd;
|
|
|
|
|
HGTwainDS m_twainDS;
|
2023-05-16 10:31:32 +00:00
|
|
|
|
QString m_password;
|
2023-05-04 06:55:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
#include "sane_user/HGSane.h"
|
|
|
|
|
|
|
|
|
|
class DeviceUserMgr : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2023-08-15 07:28:23 +00:00
|
|
|
|
DeviceUserMgr(const QString &password, QWidget *wnd);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
~DeviceUserMgr();
|
|
|
|
|
|
|
|
|
|
// 弹出设备选择对话框,选择设备
|
|
|
|
|
class DeviceUser* OpenDeviceUser();
|
2023-06-03 09:25:56 +00:00
|
|
|
|
class DeviceUser* OpenDefaultDeviceUser();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QWidget *m_wnd;
|
2023-05-16 10:31:32 +00:00
|
|
|
|
QString m_password;
|
2023-05-04 06:55:26 +00:00
|
|
|
|
HGSaneManager m_saneMgr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DeviceUser : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
friend class DeviceUserMgr;
|
2023-08-15 07:28:23 +00:00
|
|
|
|
DeviceUser(QWidget *wnd, HGSaneSource source, const QString &password);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
public:
|
|
|
|
|
~DeviceUser();
|
|
|
|
|
|
2023-08-15 07:28:23 +00:00
|
|
|
|
HGResult Open();
|
2023-08-15 07:38:21 +00:00
|
|
|
|
HGResult OpenDefault();
|
2023-08-15 07:28:23 +00:00
|
|
|
|
HGResult Close();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
// 获取设备名字
|
|
|
|
|
QString GetName();
|
|
|
|
|
// 弹出配置对话框
|
|
|
|
|
HGResult ShowSettingDlg();
|
|
|
|
|
// 弹出扫描对话框
|
|
|
|
|
HGResult StartScan();
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult StartSingleScan();
|
2023-05-20 10:06:05 +00:00
|
|
|
|
HGResult GetDeviceCustomInfo(HGSaneDeviceCustomInfo *info);
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult Login();
|
|
|
|
|
HGResult Logout();
|
|
|
|
|
HGResult ClearRollerCount();
|
2023-06-13 07:24:58 +00:00
|
|
|
|
int GetDeviceRollerLife();
|
2023-05-20 10:06:05 +00:00
|
|
|
|
QString GetDriverLog();
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult ClearDriverLog();
|
2023-05-20 10:06:05 +00:00
|
|
|
|
QString GetDeviceLog();
|
2023-05-16 10:31:32 +00:00
|
|
|
|
HGResult ClearDeviceLog();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2023-05-23 06:52:45 +00:00
|
|
|
|
static void HGAPI DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param);
|
2023-10-16 02:31:37 +00:00
|
|
|
|
static HGUInt HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGUInt type, HGPointer param);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void newImage(void *image);
|
2023-06-03 09:25:56 +00:00
|
|
|
|
void scanFinishEvent();
|
|
|
|
|
void scanWorkingEvent();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QWidget *m_wnd;
|
|
|
|
|
HGSaneSource m_source;
|
|
|
|
|
HGSaneDevice m_saneDev;
|
2023-05-16 10:31:32 +00:00
|
|
|
|
QString m_password;
|
2023-05-04 06:55:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* __DEVICE_USER_H__ */
|