code_app/sdk/scannerlib/HGLibDeviceImpl.hpp

66 lines
2.1 KiB
C++

#ifndef __HGLIBDEVICEIMPL_HPP__
#define __HGLIBDEVICEIMPL_HPP__
#include "HGScannerLib.h"
#include "base/HGLock.h"
#include "base/HGEvent.h"
#include "sane/sane_ex.h"
#include "sane/sane_option_definitions.h"
#include <vector>
#include <map>
#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);
static HGLibDeviceImpl* Open(const HGChar* deviceName);
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);
HGBool ResetParam();
HGBool IsPaperOn();
HGBool Restart();
HGBool ShutDown();
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);
HGBool StopScan();
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);
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;
static std::map<SANE_Handle, HGLibDeviceImpl*> m_deviceList;
SANE_Handle m_devHandle;
std::string m_devName;
HGBool m_scanning;
HGEvent m_scanEvent;
HGLibDeviceScanEventFunc m_eventFunc;
HGPointer m_eventParam;
HGLibDeviceScanImageFunc m_imageFunc;
HGPointer m_imageParam;
};
#endif /* __HGLIBDEVICEIMPL_HPP__ */