国产系统:驱动层指定扫描张数扫描完成后返回无纸,所以app层去掉指定张数判断

This commit is contained in:
yangjiaxuan 2024-02-26 11:23:13 +08:00
parent 8371fae5e1
commit fb959e307e
2 changed files with 1 additions and 48 deletions

View File

@ -1036,17 +1036,6 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
HGUInt doubleImgRet = HGBASE_ERR_OK;
bool clickedReserveImg = false;
int imageCount =0;
int scanCount = -1;
p->GetScanCount(&scanCount);
//获取扫描页面类型,双张或单张
HGChar scanPage[256] = { 0 };
p->GetScanPage(scanPage, 256);
bool isDuplex = true;
if (0 == strcmp(OPTION_VALUE_SMYM_DM, scanPage))
isDuplex = false;
while (!p->m_stopThread)
{
SANE_Parameters params;
@ -1171,7 +1160,6 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
// 普通图片或第二个双张图片
p->m_imageFunc((HGSaneDevice)p, img, HGSANE_IMAGE_TYPE_NORMAL, p->m_imageParam);
doubleImgRet = HGBASE_ERR_OK;
imageCount++;
}
HGBase_DestroyImage(img);
@ -1182,12 +1170,7 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param)
buffer = NULL;
bufferSize = 0;
// 保留双张后继续扫描,重置图像数量,然后重新按照指定张数扫描
if (clickedReserveImg)
imageCount = 0;
if (HGSANE_ERR_IMAGE_DISCARD == doubleImgRet ||
((isDuplex ? imageCount == scanCount * 2 : imageCount == scanCount) && !clickedReserveImg)) //图像数量和扫描张数对应时正常结束扫描,双张保留则继续扫描
if (HGSANE_ERR_IMAGE_DISCARD == doubleImgRet)
{
saneAPI.sane_cancel_api(p->m_devHandle);
if (NULL != p->m_scanNotify)
@ -1439,32 +1422,3 @@ HGResult HGSaneDeviceImpl::GetDoubleImgStatus(HGUInt *status)
return HGBASE_ERR_FAIL;
}
HGResult HGSaneDeviceImpl::GetScanPage(HGChar *scanPage, HGUInt maxLen)
{
if (NULL == scanPage || 0 == maxLen)
{
return HGBASE_ERR_INVALIDARG;
}
SANE_Int dev_options = 0;
SANE_Int method = 0;
m_sourceImpl->m_saneApi.sane_control_option_api(m_devHandle, 0, SANE_ACTION_GET_VALUE, &dev_options, nullptr);
for (int i = 1; i < dev_options; ++i)
{
const SANE_Option_Descriptor* opt = m_sourceImpl->m_saneApi.sane_get_option_descriptor_api(m_devHandle, i);
if (strcmp(opt->name, SANE_STD_OPT_NAME_PAGE) == 0)
{
char *value = (char*)malloc(opt->size * 2 + 4);
SANE_Status ret = m_sourceImpl->m_saneApi.sane_control_option_api(m_devHandle, i, SANE_ACTION_GET_VALUE, value, &method);
if (ret == SANE_STATUS_GOOD)
{
strcpy(scanPage, value);
free(value);
return HGBASE_ERR_OK;
}
}
}
return HGBASE_ERR_FAIL;
}

View File

@ -105,7 +105,6 @@ private:
HGResult SetScanMode(const HGChar *scanMode);
HGResult SetScanCount(HGInt scanCount);
HGResult GetDoubleImgStatus(HGUInt *status);
HGResult GetScanPage(HGChar *scanPage, HGUInt maxLen);
private:
HGSaneSourceImpl* m_sourceImpl;