code_app/sdk/scannerlib/HGLibDeviceImpl.hpp

56 lines
1.7 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 SetParam(const HGLibDeviceSetParam* param, HGUInt count);
HGBool SetParamEx(const HGChar* option, const HGVoid* data);
HGLibDeviceGetParamGroup* GetParamGroupList(HGUInt* count);
HGLibDeviceGetParam* GetParam(const HGChar* option);
static HGBool ReleaseParamGroupList(HGLibDeviceGetParamGroup* paramGroup, HGUInt count);
static HGBool ReleaseParam(HGLibDeviceGetParam* param);
HGBool ResetParam();
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);
HGBool StopScan();
private:
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__ */