python demo增加HGLib_GetDeviceParamGroupList接口

This commit is contained in:
luoliangyi 2022-09-20 13:49:45 +08:00
parent 9e6008b6eb
commit 9b2b45be84
4 changed files with 80 additions and 2 deletions

View File

@ -1367,7 +1367,7 @@ HGResult HGVersionMgrImpl::BlackListCheck(const HGChar* devSN, HGBool* inList)
std::stringstream out;
char url[256];
sprintf(url, "http://cd.holdtecs.net:50080/api/ver?sn=%s", devSN);
sprintf(url, "http://cd.holdtecs.net:50080/check?sn=%s", devSN);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_easy_setopt(curl, CURLOPT_URL, url);

View File

@ -80,7 +80,8 @@ const char* OPTION_NAME[] = {
OPTION_TITLE_WXRRD,
OPTION_TITLE_ZDCZQD,
OPTION_TITLE_CZYZ,
OPTION_TITLE_DZSM
OPTION_TITLE_DZSM,
OPTION_TITLE_HBTXFSSC
};
const char* OPTION_ENUMVALUE[] = {

View File

@ -32,6 +32,7 @@ HG_DECLARE_HANDLE(HGLibDevice);
#define HGLIB_GROUP_NAME_PAPERFEEDING 4L
/* 配置名 */
#define HGLIB_OPTION_NAME_UNKNOWN 0L
// "多流输出"
#define HGLIB_OPTION_NAME_DLSC 1L
// "多流输出类型"
@ -166,6 +167,8 @@ HG_DECLARE_HANDLE(HGLibDevice);
#define HGLIB_OPTION_NAME_CZYZ 66L
// 待纸扫描
#define HGLIB_OPTION_NAME_DZSM 67L
// 黑白图像反色输出正常颜色为0 - 黑色1 - 白色)
#define HGLIB_OPTION_NAME_HBTXFSSC 68L
/* 配置枚举值 */
// "无"

View File

@ -13,6 +13,51 @@ class HGLibSaveImageParam(Structure):
("tiffJpegQuality", c_uint),
("ocr", c_int)]
class HGLibDeviceIntValueList(Structure):
_fields_ = [ ("value", POINTER(c_int)),
("count", c_uint)]
class HGLibDeviceEnumValueList(Structure):
_fields_ = [ ("value", POINTER(c_uint)),
("count", c_uint)]
class HGLibDeviceDoubleValueList(Structure):
_fields_ = [ ("value", POINTER(c_double)),
("count", c_uint)]
class HGLibDeviceIntValueRange(Structure):
_fields_ = [ ("minValue", c_int),
("maxValue", c_int)]
class HGLibDeviceDoubleValueRange(Structure):
_fields_ = [ ("minValue", c_double),
("maxValue", c_double)]
class HGLibDeviceParamType(Union):
_fields_ = [ ("intValue", c_int),
("enumValue", c_uint),
("doubleValue", c_double),
("boolValue", c_int)]
class HGLibDeviceParamRangeType(Union):
_fields_ = [ ("intValueList", HGLibDeviceIntValueList),
("enumValueList", HGLibDeviceEnumValueList),
("doubleValueList", HGLibDeviceDoubleValueList),
("intValueRange", HGLibDeviceIntValueRange),
("doubleValueRange", HGLibDeviceDoubleValueRange)]
class HGLibDeviceParam(Structure):
_fields_ = [ ("option", c_uint),
("type", c_uint),
("typeValue", HGLibDeviceParamType),
("rangeType", c_uint),
("rangeTypeValue", HGLibDeviceParamRangeType)]
class HGLibDeviceParamGroup(Structure):
_fields_ = [ ("group", c_uint),
("param", POINTER(HGLibDeviceParam)),
("paramCount", c_uint)]
print(os.path.abspath('.'))
#加载动态库 所有依赖库必须在同一运行目录下边
@ -72,6 +117,35 @@ HGLib_OpenDevice.argtypes = [ctypes.c_char_p]
HGLib_OpenDevice.restype = ctypes.c_void_p
Device = HGLib_OpenDevice(DeviceNameList[0])
#获取设备所有参数
HGLib_GetDeviceParamGroupList = Objdll.HGLib_GetDeviceParamGroupList
HGLib_GetDeviceParamGroupList.argtypes = [ctypes.c_void_p, POINTER(c_uint)]
HGLib_GetDeviceParamGroupList.restype = POINTER(HGLibDeviceParamGroup)
DevParamCount = ctypes.c_uint()
DevParamGroup = HGLib_GetDeviceParamGroupList(Device, pointer(DevParamCount))
GroupList = ['None', 'BaseSetting', 'Brightness', 'ImageProc', 'PaperFeeding']
ValueTypeList = ['None', 'Int', 'Enum', 'Double', 'Bool']
ValueRangeTypeList = ['None', 'IntList', 'EnumList', 'DoubleList', 'IntRange', 'DoubleRange']
i = 0
while i < int(DevParamCount.value):
print("group" + str(i) + ":" + GroupList[DevParamGroup[i].group])
print(" paramCount:" + str(DevParamGroup[i].paramCount))
j = 0
while (j < int(DevParamGroup[i].paramCount)):
print(" paramOption:" + str(DevParamGroup[i].param[j].option))
print(" paramValueType:" + ValueTypeList[DevParamGroup[i].param[j].type])
print(" paramValueRangeType:" + ValueRangeTypeList[DevParamGroup[i].param[j].rangeType])
j += 1
i += 1
#销毁
HGLib_ReleaseDeviceParamGroupList = Objdll.HGLib_ReleaseDeviceParamGroupList
HGLib_ReleaseDeviceParamGroupList.argtypes = [POINTER(HGLibDeviceParamGroup), c_uint]
HGLib_ReleaseDeviceParamGroupList.restype = ctypes.c_int
Ret = HGLib_ReleaseDeviceParamGroupList(DevParamGroup, DevParamCount)
#设置扫描参数
HGLib_SetDeviceParam = Objdll.HGLib_SetDeviceParam
HGLib_SetDeviceParam.argtypes = [ctypes.c_void_p, ctypes.c_uint, ctypes.c_void_p]