双张提示,只弹第一次

This commit is contained in:
gb 2023-10-17 17:52:13 +08:00
parent 56146725d6
commit 80ffb60c34
2 changed files with 22 additions and 5 deletions

View File

@ -1588,6 +1588,7 @@ int scanner::set_is_multiout(bool enable)
int scanner::thread_start(void) int scanner::thread_start(void)
{ {
scan_over_ = false; scan_over_ = false;
double_handle_ = DOUBLE_FEED_NEED_UI;
int ret = hg_sane_middleware::instance()->start(handle_, NULL); int ret = hg_sane_middleware::instance()->start(handle_, NULL);
@ -3576,15 +3577,23 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
if (simg->flag.statu && callback::abnormal_image) if (simg->flag.statu && callback::abnormal_image)
{ {
if (callback::abnormal_image(simg) == SANE_Abnormal_Image_Discard) if (double_handle_ == DOUBLE_FEED_NEED_UI)
{ {
wchar_t info[128] = { 0 }; if (callback::abnormal_image(simg) == SANE_Abnormal_Image_Discard)
{
wchar_t info[128] = { 0 };
swprintf_s(info, _countof(info) - 1, L"Discard image %d for the status is: %d\r\n", simg->src_id, simg->flag.statu); swprintf_s(info, _countof(info) - 1, L"Discard image %d for the status is: %d\r\n", simg->src_id, simg->flag.statu);
log_info(info, LOG_LEVEL_DEBUG_INFO); log_info(info, LOG_LEVEL_DEBUG_INFO);
return 0; double_handle_ = DOUBLE_FEED_DISCARD;
}
else
double_handle_ = DOUBLE_FEED_KEEP;
} }
if (double_handle_ == DOUBLE_FEED_DISCARD)
return 0;
} }
swprintf_s(name, _countof(name) - 1, L"img_%05u.bmp", ++img_ind_); swprintf_s(name, _countof(name) - 1, L"img_%05u.bmp", ++img_ind_);

View File

@ -40,6 +40,13 @@ class scanner : public ISaneInvoker, virtual public refer
int bytes; int bytes;
}SIMPLEOPT; }SIMPLEOPT;
enum
{
DOUBLE_FEED_NEED_UI = 0, // 需要用户抉择
DOUBLE_FEED_KEEP, // 用户选择保存
DOUBLE_FEED_DISCARD, // 用户选择丢弃
};
SANE_Handle handle_; SANE_Handle handle_;
SCANNERID id_; SCANNERID id_;
int err_; int err_;
@ -47,6 +54,7 @@ class scanner : public ISaneInvoker, virtual public refer
int prev_start_result_; int prev_start_result_;
int dpi_; int dpi_;
int fetch_imgs_ = 0; // count for images has fetched by APP int fetch_imgs_ = 0; // count for images has fetched by APP
int double_handle_ = DOUBLE_FEED_NEED_UI; //
bool is_bIndicator; bool is_bIndicator;
bool is_show_setting_; bool is_show_setting_;
unsigned int img_ind_; unsigned int img_ind_;