#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 #include #include 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(); HGInt GetStatus(); HGBool Restart(); HGBool ShutDown(); HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam, HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam); HGBool StopScan(); HGBool StopScanAsyn(); HGInt GetOperateCode(); 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 m_deviceList; HGLock m_lock; SANE_Handle m_devHandle; std::string m_devName; HGInt m_dpi; HGBool m_scanning; HGEvent m_scanEvent; HGLibDeviceScanEventFunc m_eventFunc; HGPointer m_eventParam; HGLibDeviceScanImageFunc m_imageFunc; HGPointer m_imageParam; HGInt m_statusCode; }; #endif /* __HGLIBDEVICEIMPL_HPP__ */