修改sane_start调用逻辑

This commit is contained in:
luoliangyi 2023-07-31 15:17:02 +08:00
parent 29b2c74b7d
commit 94ebf55352
1 changed files with 10 additions and 8 deletions

View File

@ -176,19 +176,14 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
if (SANE_STATUS_GOOD == stat2)
{
// m_bufferSize空间不够
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_INVAL)));
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_NO_MEM)));
break;
}
else if (SANE_STATUS_EOF == stat2)
{
if (0 == readSize)
if (SANE_STATUS_GOOD != stat1 || 0 == readSize || readSize != params.bytes_per_line * params.lines)
{
emit p->eventFunc(0, tr("Scan complete"));
break;
}
else if (SANE_STATUS_GOOD != stat1 || readSize != params.bytes_per_line * params.lines)
{
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_INVAL)));
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_IO_ERROR)));
break;
}
}
@ -228,5 +223,12 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
HGBase_DestroyImage(img);
}
}
SANE_Status stat3 = p->m_saneAPI.sane_start_api(p->m_saneDev);
if (SANE_STATUS_GOOD != stat3)
{
emit p->eventFunc(0, tr("Scan complete"));
break;
}
}
}