From 97853a8b88b436b35d5317a56676e7f067cbd3b1 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Fri, 16 Sep 2022 16:56:42 +0800 Subject: [PATCH] =?UTF-8?q?python=20demo=E8=A7=A3=E5=86=B3c=5Fulong?= =?UTF-8?q?=E5=92=8C.h=E6=96=87=E4=BB=B6=E4=B8=8D=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/scannerlib/test.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/scannerlib/test.py b/test/scannerlib/test.py index 67384f1c..912c0512 100644 --- a/test/scannerlib/test.py +++ b/test/scannerlib/test.py @@ -6,10 +6,10 @@ import platform from ctypes import * class HGLibSaveImageParam(Structure): - _fields_ = [ ("size", c_ulong), - ("jpegQuality", c_ulong), - ("tiffCompression", c_ulong), - ("tiffJpegQuality", c_ulong), + _fields_ = [ ("size", c_uint), + ("jpegQuality", c_uint), + ("tiffCompression", c_uint), + ("tiffJpegQuality", c_uint), ("ocr", c_int)] print(os.path.abspath('.')) @@ -45,12 +45,12 @@ HGLib_ReleaseImage.restype = ctypes.c_int Ret = HGLib_ReleaseImage(Image) #设备热拔插回调事件 -def HGLibDeviceHotPlugEventFunc(event: c_ulong, deviceName: c_char_p, param: c_void_p): +def HGLibDeviceHotPlugEventFunc(event: c_uint, deviceName: c_char_p, param: c_void_p): print(deviceName) return #初始化操作 -FuncType = CFUNCTYPE(None, c_ulong, c_char_p, c_void_p) +FuncType = CFUNCTYPE(None, c_uint, c_char_p, c_void_p) cb = FuncType(HGLibDeviceHotPlugEventFunc) HGLib_InitDevice = Objdll.HGLib_InitDevice HGLib_InitDevice.argtypes = [FuncType, c_void_p] @@ -73,14 +73,14 @@ Device = HGLib_OpenDevice(DeviceNameList[0]) #设置扫描参数 HGLib_SetDeviceParam = Objdll.HGLib_SetDeviceParam -HGLib_SetDeviceParam.argtypes = [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p] +HGLib_SetDeviceParam.argtypes = [ctypes.c_void_p, ctypes.c_uint, ctypes.c_void_p] HGLib_SetDeviceParam.restype = ctypes.c_int DevParam = ctypes.c_int(1) #HGLIB_OPTION_ENUMVALUE_DLSCLX_W -> 不进行多流输出类型 Ret = HGLib_SetDeviceParam(Device, 1, byref(DevParam)) #见HGLib_SetDeviceParam 头文件接口说明 1 -> HGLIB_OPTION_NAME_DLSC 多流输出 bStop=False #扫描事件回调 -def HGLibDeviceScanEventFunc(device: c_void_p, event: c_ulong, err: c_int, info: c_char_p, param: c_void_p): +def HGLibDeviceScanEventFunc(device: c_void_p, event: c_uint, err: c_int, info: c_char_p, param: c_void_p): print(info) if event == 2:#HGLIB_DEVSCAN_EVENT_END 扫描停止 bStop=True @@ -100,7 +100,7 @@ def HGLibDeviceScanImageFunc(device: c_void_p, image: c_void_p, param: c_void_p) return #注册扫描相关事件并启动扫描 -FuncType1 = CFUNCTYPE(None, c_void_p, c_ulong, c_int, c_char_p, c_void_p) +FuncType1 = CFUNCTYPE(None, c_void_p, c_uint, c_int, c_char_p, c_void_p) cb1 = FuncType1(HGLibDeviceScanEventFunc) FuncType2 = CFUNCTYPE(None, c_void_p, c_void_p, c_void_p) cb2 = FuncType2(HGLibDeviceScanImageFunc)