HGScannerLib增加判断是否有纸的接口

This commit is contained in:
luoliangyi 2022-09-23 17:04:29 +08:00
parent 6abb5978ac
commit da05ac2851
6 changed files with 26 additions and 0 deletions

View File

@ -17,5 +17,6 @@ HGLib_GetDeviceParam
HGLib_ReleaseDeviceParamGroupList
HGLib_ReleaseDeviceParam
HGLib_ResetDeviceParam
HGLib_DeviceIsPaperOn
HGLib_StartDeviceScan
HGLib_StopDeviceScan

View File

@ -870,6 +870,16 @@ HGBool HGLibDeviceImpl::ResetParam()
return ret;
}
HGBool HGLibDeviceImpl::IsPaperOn()
{
SANE_Bool isOn = SANE_FALSE;
unsigned int len = sizeof(SANE_Bool);
SANE_Status status = sane_io_control(m_devHandle, IO_CTRL_CODE_GET_PAPER_ON, &isOn, &len);
if (SANE_STATUS_GOOD == status && isOn)
return HGTRUE;
return HGFALSE;
}
HGBool HGLibDeviceImpl::StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam)
{

View File

@ -29,6 +29,7 @@ public:
static HGBool ReleaseParamGroupList(HGLibDeviceParamGroup* paramGroup, HGUInt count);
static HGBool ReleaseParam(HGLibDeviceParam* param);
HGBool ResetParam();
HGBool IsPaperOn();
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);
HGBool StopScan();

View File

@ -183,6 +183,17 @@ HGBool HGAPI HGLib_ResetDeviceParam(HGLibDevice device)
return deviceImpl->ResetParam();
}
HGBool HGAPI HGLib_DeviceIsPaperOn(HGLibDevice device)
{
if (NULL == device)
{
return HGFALSE;
}
HGLibDeviceImpl* deviceImpl = (HGLibDeviceImpl*)device;
return deviceImpl->IsPaperOn();
}
HGBool HGAPI HGLib_StartDeviceScan(HGLibDevice device, HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam)
{

View File

@ -460,6 +460,9 @@ HGEXPORT HGBool HGAPI HGLib_ReleaseDeviceParam(HGLibDeviceParam* param);
/* 重置设备参数 */
HGEXPORT HGBool HGAPI HGLib_ResetDeviceParam(HGLibDevice device);
/* 设备是否有纸 */
HGEXPORT HGBool HGAPI HGLib_DeviceIsPaperOn(HGLibDevice device);
/* 开始扫描 */
HGEXPORT HGBool HGAPI HGLib_StartDeviceScan(HGLibDevice device, HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);