code_app/sdk/scannerlib/HGLibDeviceImpl.hpp

69 lines
2.1 KiB
C++
Raw Normal View History

2022-07-19 03:51:00 +00:00
#ifndef __HGLIBDEVICEIMPL_HPP__
#define __HGLIBDEVICEIMPL_HPP__
#include "HGScannerLib.h"
#include "base/HGLock.h"
2022-07-19 09:09:52 +00:00
#include "base/HGEvent.h"
2022-07-19 03:51:00 +00:00
#include "sane/sane_ex.h"
#include "sane/sane_option_definitions.h"
#include <vector>
2022-07-19 09:09:52 +00:00
#include <map>
2022-07-19 03:51:00 +00:00
#include <string>
class HGLibDeviceImpl
{
public:
HGLibDeviceImpl();
~HGLibDeviceImpl();
static HGBool Init(HGLibDeviceHotPlugEventFunc func, HGPointer param);
static HGBool Deinit();
static HGChar** GetNameList();
static HGBool ReleaseNameList(HGChar** deviceName);
2022-07-19 09:09:52 +00:00
static HGLibDeviceImpl* Open(const HGChar* deviceName);
2022-07-19 03:51:00 +00:00
HGBool Close();
HGBool GetSN(HGChar* sn, HGUInt maxLen);
HGBool GetFWVersion(HGChar* fwVersion, HGUInt maxLen);
HGBool SetParam(HGUInt option, const HGVoid* data);
HGLibDeviceParamGroup* GetParamGroupList(HGUInt* count);
HGLibDeviceParam* GetParam(HGUInt option);
static HGBool ReleaseParamGroupList(HGLibDeviceParamGroup* paramGroup, HGUInt count);
static HGBool ReleaseParam(HGLibDeviceParam* param);
2022-07-19 03:51:00 +00:00
HGBool ResetParam();
HGBool IsPaperOn();
HGBool Restart();
HGBool ShutDown();
2022-07-19 03:51:00 +00:00
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);
HGBool StopScan();
HGBool StopScanAsyn();
2022-07-19 03:51:00 +00:00
private:
static const char* GetGroupName(HGUInt group);
static HGUInt GetGroupName(const char* group);
static const char* GetOptionName(HGUInt option);
static HGUInt GetOptionName(const char* option);
static const char* GetOptionEnumValue(HGUInt enumValue);
static HGUInt GetOptionEnumValue(const char* enumValue);
2022-07-19 03:51:00 +00:00
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
private:
static HGLibDeviceHotPlugEventFunc m_hotPlugEventFunc;
static HGPointer m_hotPlugEventParam;
static HGBool m_init;
2022-07-19 09:09:52 +00:00
static std::map<SANE_Handle, HGLibDeviceImpl*> m_deviceList;
2022-11-15 10:39:50 +00:00
HGLock m_lock;
2022-07-19 09:09:52 +00:00
SANE_Handle m_devHandle;
std::string m_devName;
HGInt m_dpi;
2022-07-19 09:09:52 +00:00
HGBool m_scanning;
HGEvent m_scanEvent;
HGLibDeviceScanEventFunc m_eventFunc;
HGPointer m_eventParam;
HGLibDeviceScanImageFunc m_imageFunc;
HGPointer m_imageParam;
2022-07-19 03:51:00 +00:00
};
#endif /* __HGLIBDEVICEIMPL_HPP__ */