HGScannerLib关闭扫描增加异步接口

This commit is contained in:
luoliangyi 2022-11-22 08:55:12 +08:00
parent 12ad060082
commit a56a53bb29
5 changed files with 32 additions and 1 deletions

View File

@ -23,4 +23,5 @@ HGLib_DeviceIsPaperOn
HGLib_DeviceRestart
HGLib_DeviceShutDown
HGLib_StartDeviceScan
HGLib_StopDeviceScan
HGLib_StopDeviceScan
HGLib_StopDeviceScanAsyn

View File

@ -1027,6 +1027,21 @@ HGBool HGLibDeviceImpl::StopScan()
return ret;
}
HGBool HGLibDeviceImpl::StopScanAsyn()
{
HGBool ret = HGFALSE;
HGBase_EnterLock(m_lock);
if (m_scanning)
{
sane_cancel(m_devHandle);
ret = HGTRUE;
}
HGBase_LeaveLock(m_lock);
return ret;
}
const char* HGLibDeviceImpl::GetGroupName(HGUInt group)
{
if (group > HGLIB_GROUP_NAME_PAPERFEEDING)

View File

@ -37,6 +37,7 @@ public:
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);
HGBool StopScan();
HGBool StopScanAsyn();
private:
static const char* GetGroupName(HGUInt group);

View File

@ -263,3 +263,14 @@ HGBool HGAPI HGLib_StopDeviceScan(HGLibDevice device)
HGLibDeviceImpl* deviceImpl = (HGLibDeviceImpl*)device;
return deviceImpl->StopScan();
}
HGBool HGAPI HGLib_StopDeviceScanAsyn(HGLibDevice device)
{
if (NULL == device)
{
return HGFALSE;
}
HGLibDeviceImpl* deviceImpl = (HGLibDeviceImpl*)device;
return deviceImpl->StopScanAsyn();
}

View File

@ -507,4 +507,7 @@ HGEXPORT HGBool HGAPI HGLib_StartDeviceScan(HGLibDevice device, HGLibDeviceScanE
/* ֹͣɨÃè */
HGEXPORT HGBool HGAPI HGLib_StopDeviceScan(HGLibDevice device);
/* ֹͣɨÃè-Òì²½ */
HGEXPORT HGBool HGAPI HGLib_StopDeviceScanAsyn(HGLibDevice device);
#endif /* __HGSCANNERLIB_H__ */