sane双张处理修改流程
This commit is contained in:
parent
dd1cd32e98
commit
4f4c370933
|
@ -997,6 +997,7 @@ void HGSaneDeviceImpl::UIResultCallback(ui_result result)
|
|||
|
||||
void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
(void)thread;
|
||||
HGSaneDeviceImpl *p = (HGSaneDeviceImpl *)param;
|
||||
|
||||
SANEAPI &saneAPI = m_curDevice->m_sourceImpl->m_saneApi;
|
||||
|
@ -1008,7 +1009,7 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
|
|||
p->m_scanNotify((int)SANE_EVENT_WORKING, NULL, 0);
|
||||
|
||||
SANE_Status stat = saneAPI.sane_start_api(p->m_devHandle);
|
||||
if (SANE_STATUS_GOOD != stat)
|
||||
if (SANE_STATUS_GOOD != stat && SCANNER_ERR_DEVICE_DOUBLE_FEEDING != stat)
|
||||
{
|
||||
if (NULL != p->m_scanNotify)
|
||||
p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(stat), (int)stat);
|
||||
|
@ -1022,7 +1023,7 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
|
|||
SANE_Parameters params;
|
||||
memset(¶ms, 0, sizeof(SANE_Parameters));
|
||||
SANE_Status stat1 = saneAPI.sane_get_parameters_api(p->m_devHandle, ¶ms);
|
||||
if (SANE_STATUS_GOOD != stat1 && SCANNER_ERR_DEVICE_DOUBLE_FEEDING != stat1)
|
||||
if (SANE_STATUS_GOOD != stat1)
|
||||
{
|
||||
if (NULL != p->m_scanNotify)
|
||||
p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(stat1), (int)stat1);
|
||||
|
@ -1119,7 +1120,7 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
|
|||
if (NULL != img)
|
||||
{
|
||||
HGBase_SetImageDpi(img, p->m_dpi, p->m_dpi);
|
||||
if (HGBASE_ERR_OK == doubleImgRet && SCANNER_ERR_DEVICE_DOUBLE_FEEDING == stat1)
|
||||
if (HGBASE_ERR_OK == doubleImgRet && SCANNER_ERR_DEVICE_DOUBLE_FEEDING == stat)
|
||||
{
|
||||
// 第一个双张图片
|
||||
doubleImgRet = p->m_imageFunc((HGSaneDevice)p, img, HGSANE_IMAGE_TYPE_DOUBLE, p->m_imageParam);
|
||||
|
@ -1140,6 +1141,7 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
|
|||
|
||||
if (HGSANE_ERR_IMAGE_DISCARD == doubleImgRet)
|
||||
{
|
||||
saneAPI.sane_cancel_api(p->m_devHandle);
|
||||
if (NULL != p->m_scanNotify)
|
||||
p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, NULL, 0);
|
||||
break;
|
||||
|
@ -1147,19 +1149,22 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
|
|||
|
||||
if (!p->m_cancelScan)
|
||||
{
|
||||
SANE_Status stat3 = saneAPI.sane_start_api(p->m_devHandle);
|
||||
if (SANE_STATUS_NO_DOCS == stat3)
|
||||
stat = saneAPI.sane_start_api(p->m_devHandle);
|
||||
if (SANE_STATUS_NO_DOCS == stat)
|
||||
{
|
||||
if (NULL != p->m_scanNotify)
|
||||
p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, NULL, 0);
|
||||
break;
|
||||
}
|
||||
else if (SANE_STATUS_GOOD != stat3)
|
||||
else if (SANE_STATUS_GOOD != stat && SCANNER_ERR_DEVICE_DOUBLE_FEEDING != stat)
|
||||
{
|
||||
if (NULL != p->m_scanNotify)
|
||||
p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(stat3), (int)stat3);
|
||||
p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(stat), (int)stat);
|
||||
break;
|
||||
}
|
||||
|
||||
if (SANE_STATUS_GOOD == stat)
|
||||
doubleImgRet = HGBASE_ERR_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue