DeviceWrapper.cs
Go to the documentation of this file.
1 
11 using System;
12 using System.Text;
13 using System.IO;
14 using System.Runtime.InteropServices;
15 
20 {
32 }
33 
38 {
45 }
46 
51 {
52  LIBWFX_EXC_OTHER = 0,
55 };
56 
61 {
65 }
66 
70 [StructLayout(LayoutKind.Sequential)]
72 {
73  public const String LIBWFX_DLLNAME = @"LibWebFXScan.dll";
74 
83  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
84  public delegate void LIBWFXEVENTCB(ENUM_LIBWFX_EVENT_CODE enEventCode, int nParam, IntPtr pUserDef);
85 
97  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
98  public delegate void LIBWFXCB(ENUM_LIBWFX_NOTIFY_CODE enNotifyCode, IntPtr pUserDef, IntPtr pParam1, IntPtr pParam2);
99 
109  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_Init", CallingConvention = CallingConvention.StdCall)]
110  public static extern ENUM_LIBWFX_ERRCODE LibWFX_Init();
111 
121  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_DeInit", CallingConvention = CallingConvention.StdCall)]
122  public static extern ENUM_LIBWFX_ERRCODE LibWFX_DeInit();
123 
134  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_GetDeviesList", CallingConvention = CallingConvention.StdCall)]
135  public static extern ENUM_LIBWFX_ERRCODE LibWFX_GetDeviesList(out IntPtr szDevicesListOut);
136 
147  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_GetFileList", CallingConvention = CallingConvention.StdCall)]
148  public static extern ENUM_LIBWFX_ERRCODE LibWFX_GetFileList(out IntPtr szFileListOut);
149 
160  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_RemoveFile", CallingConvention = CallingConvention.StdCall)]
161  public static extern ENUM_LIBWFX_ERRCODE LibWFX_RemoveFile(String szFileNameIn);
162 
175  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_SetProperty", CallingConvention = CallingConvention.StdCall)]
176  public static extern ENUM_LIBWFX_ERRCODE LibWFX_SetProperty(String szRequestCmdIn, [MarshalAs(UnmanagedType.FunctionPtr)] LIBWFXEVENTCB pfnLibWFXEVENTCBIn, IntPtr pUserDefIn);
177 
189  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_StartScan", CallingConvention = CallingConvention.StdCall)]
190  public static extern ENUM_LIBWFX_ERRCODE LibWFX_StartScan([MarshalAs(UnmanagedType.FunctionPtr)] LIBWFXCB pfnLibWFXCBIn, IntPtr pUserDefIn);
191 
201  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_Calibrate", CallingConvention = CallingConvention.StdCall)]
202  public static extern ENUM_LIBWFX_ERRCODE LibWFX_Calibrate();
203 
215  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_ECOControl", CallingConvention = CallingConvention.StdCall)]
216  public static extern ENUM_LIBWFX_ERRCODE LibWFX_ECOControl(out uint pulTime, int nSetIn);
217 
227  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_PaperReady", CallingConvention = CallingConvention.StdCall)]
228  public static extern ENUM_LIBWFX_ERRCODE LibWFX_PaperReady();
229 
239  [DllImport(LIBWFX_DLLNAME, EntryPoint = "LibWFX_CloseDevice", CallingConvention = CallingConvention.StdCall)]
240  public static extern ENUM_LIBWFX_ERRCODE LibWFX_CloseDevice();
241 }
242 
static ENUM_LIBWFX_ERRCODE LibWFX_StartScan([MarshalAs(UnmanagedType.FunctionPtr)] LIBWFXCB pfnLibWFXCBIn, IntPtr pUserDefIn)
To start do scan.
ENUM_LIBWFX_EXCEPTION_CODE
If the feedback of exception from LIBWFXCB callback function and ENUM_LIBWFX_NOTIFY_CODE is ENUM_LIBW...
ENUM_LIBWFX_NOTIFY_CODE
The feedback of notify from LIBWFXCB callback function after scanning.
delegate void LIBWFXEVENTCB(ENUM_LIBWFX_EVENT_CODE enEventCode, int nParam, IntPtr pUserDef)
The LIBWFXEVENTCB() type defines a pointer to this callback function. LibWFX_SetProperty() is a place...
static ENUM_LIBWFX_ERRCODE LibWFX_GetDeviesList(out IntPtr szDevicesListOut)
Get devices list.
static ENUM_LIBWFX_ERRCODE LibWFX_Init()
Init the LibWebFXScan SDK .
delegate void LIBWFXCB(ENUM_LIBWFX_NOTIFY_CODE enNotifyCode, IntPtr pUserDef, IntPtr pParam1, IntPtr pParam2)
The LIBWFXCB() type defines a pointer to this callback function. LibWFX_StartScan() is a placeholder ...
static ENUM_LIBWFX_ERRCODE LibWFX_DeInit()
Deinit the LibWebFXScan SDK .
static ENUM_LIBWFX_ERRCODE LibWFX_CloseDevice()
To close device currently.
ENUM_LIBWFX_EVENT_CODE
The feedback of event from LIBWFXEVENTCB callback function.
static ENUM_LIBWFX_ERRCODE LibWFX_PaperReady()
To check whether the device feed the paper.
const String LIBWFX_DLLNAME
static ENUM_LIBWFX_ERRCODE LibWFX_Calibrate()
To do calibrate.
static ENUM_LIBWFX_ERRCODE LibWFX_RemoveFile(String szFileNameIn)
Remove the specified file by filename, e.g. "IMG_1.jpg", "*"(delete all file)
static ENUM_LIBWFX_ERRCODE LibWFX_GetFileList(out IntPtr szFileListOut)
Get the imagefile list, but no including tif and pdf.
ENUM_LIBWFX_ERRCODE
The error code of LibWebFXScan.
The DeviceWrapper class is a C# wrapper layer of LibWebFXScan.
static ENUM_LIBWFX_ERRCODE LibWFX_ECOControl(out uint pulTime, int nSetIn)
To set or get ECO time.
static ENUM_LIBWFX_ERRCODE LibWFX_SetProperty(String szRequestCmdIn, [MarshalAs(UnmanagedType.FunctionPtr)] LIBWFXEVENTCB pfnLibWFXEVENTCBIn, IntPtr pUserDefIn)
Set the property of SDK, LibWebFXScan must do LIBWFX_SETPROPERTY before LIBWFX_STARTSCAN.