微调待纸扫描
This commit is contained in:
parent
2a0fe7e7ac
commit
c4e6bd280e
|
@ -1528,8 +1528,8 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(io_lock_);
|
std::lock_guard<std::mutex> lock(io_lock_);
|
||||||
|
|
||||||
|
io_->set_timeout(2000);
|
||||||
ret = io_->read_interrupt(buf, &size);
|
ret = io_->read_interrupt(buf, &size);
|
||||||
io_->set_timeout(1000);
|
|
||||||
}
|
}
|
||||||
if (ret == SCANNER_ERR_TIMEOUT)
|
if (ret == SCANNER_ERR_TIMEOUT)
|
||||||
{
|
{
|
||||||
|
@ -1640,7 +1640,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
||||||
if (img_conf_.resolution_dst > 200 && is_quality_ == IMG_QUALITY)
|
if (img_conf_.resolution_dst > 200 && is_quality_ == IMG_QUALITY)
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||||
else
|
else
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||||
|
|
||||||
while (get_image_count() > 0)
|
while (get_image_count() > 0)
|
||||||
{
|
{
|
||||||
|
@ -1665,7 +1665,16 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
||||||
status_ = SCANNER_ERR_OK;
|
status_ = SCANNER_ERR_OK;
|
||||||
|
|
||||||
int s = get_status();
|
int s = get_status();
|
||||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status after received 'STOPSCAN': 0x%x\n", s);
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status after received ‘STOPSCAN': 0x%x\n", s);
|
||||||
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "user_cancel_: %d is_auto_paper_scan:%d \n", user_cancel_, is_auto_paper_scan);
|
||||||
|
if (user_cancel_)
|
||||||
|
{
|
||||||
|
status_ = ret = SCANNER_ERR_USER_CANCELED;
|
||||||
|
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_));
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\347\224\250\346\210\267\345\217\226\346\266\210\346\211\253\346\217\217 '%s'\n", hg_scanner_err_name(status_));
|
||||||
|
auoto_paper_indx = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (count || (s & 3) == 0)
|
if (count || (s & 3) == 0)
|
||||||
{
|
{
|
||||||
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "Really stopped ^_^\n");
|
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "Really stopped ^_^\n");
|
||||||
|
@ -1673,27 +1682,9 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
||||||
//string str = "当前批次扫描完成(第"+to_string(++auoto_paper_indx)+"批)";
|
//string str = "当前批次扫描完成(第"+to_string(++auoto_paper_indx)+"批)";
|
||||||
string str = "\345\275\223\345\211\215\346\211\271\346\254\241\346\211\253\346\217\217\345\256\214\346\210\220(\347\254\254"+to_string(++auoto_paper_indx)+"\346\211\271)";
|
string str = "\345\275\223\345\211\215\346\211\271\346\254\241\346\211\253\346\217\217\345\256\214\346\210\220(\347\254\254"+to_string(++auoto_paper_indx)+"\346\211\271)";
|
||||||
if (is_auto_paper_scan)
|
if (is_auto_paper_scan)
|
||||||
{
|
|
||||||
notify_ui_working_status(str.c_str(), SANE_EVENT_STATUS, status_);
|
notify_ui_working_status(str.c_str(), SANE_EVENT_STATUS, status_);
|
||||||
if (user_cancel_)
|
|
||||||
{
|
|
||||||
status_ = ret = SCANNER_ERR_USER_CANCELED;
|
|
||||||
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_));
|
|
||||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\345\217\226\346\266\210\346\211\253\346\217\217-\345\276\205\347\272\270\346\211\253\346\217\217 '%s'\n", hg_scanner_err_name(status_));
|
|
||||||
auoto_paper_indx = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (user_cancel_)
|
|
||||||
{
|
|
||||||
status_ = ret = SCANNER_ERR_USER_CANCELED;
|
|
||||||
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_));
|
|
||||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\347\224\250\346\210\267\345\217\226\346\266\210\346\223\215\344\275\234 '%s'\n", hg_scanner_err_name(status_));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info->From == V4L2)
|
else if (info->From == V4L2)
|
||||||
|
@ -1711,6 +1702,14 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
||||||
else
|
else
|
||||||
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "read %d bytes, sizeof(buf) = %d\n", size, sizeof(buf));
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "read %d bytes, sizeof(buf) = %d\n", size, sizeof(buf));
|
||||||
|
|
||||||
|
if (user_cancel_)
|
||||||
|
{
|
||||||
|
status_ = ret = SCANNER_ERR_USER_CANCELED;
|
||||||
|
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_));
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\347\224\250\346\210\267\345\217\226\346\266\210\346\211\253\346\217\217 '%s'\n", hg_scanner_err_name(status_));
|
||||||
|
auoto_paper_indx = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
this_thread::sleep_for(chrono::milliseconds(10));
|
this_thread::sleep_for(chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_name(status_));
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_name(status_));
|
||||||
|
@ -1718,7 +1717,6 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
||||||
|
|
||||||
int hg_scanner_239::start(void)
|
int hg_scanner_239::start(void)
|
||||||
{
|
{
|
||||||
on_is_auto_paper(is_auto_paper_scan);
|
|
||||||
split3399_ = 0;
|
split3399_ = 0;
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
int ret = try_third_app_handle_start(handled),
|
int ret = try_third_app_handle_start(handled),
|
||||||
|
@ -1740,7 +1738,7 @@ int hg_scanner_239::start(void)
|
||||||
{
|
{
|
||||||
status_ = SCANNER_ERR_DEVICE_SLEEPING;
|
status_ = SCANNER_ERR_DEVICE_SLEEPING;
|
||||||
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_);
|
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_);
|
||||||
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
|
||||||
val = notify_sleep();
|
val = notify_sleep();
|
||||||
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NOTIFY_SLEEP, SANE_EVENT_ERROR, status_);
|
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NOTIFY_SLEEP, SANE_EVENT_ERROR, status_);
|
||||||
return status_;
|
return status_;
|
||||||
|
@ -1766,13 +1764,21 @@ int hg_scanner_239::start(void)
|
||||||
|
|
||||||
return status_;
|
return status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_ui_working_status(STATU_DESC_REWRITE_CONFIGURATION);
|
notify_ui_working_status(STATU_DESC_REWRITE_CONFIGURATION);
|
||||||
//if(rewrite_conf_)
|
//if(rewrite_conf_)
|
||||||
{
|
{
|
||||||
//协议设置方式一定要注意 1:协议结构体做好,start一起发送 2:每次设置一次发送一次 注意事项:除色时颜色切换维彩色使用的是临时变量,下发一次被释放,如果start再次发就会导致协议层被覆盖
|
//协议设置方式一定要注意 1:协议结构体做好,start一起发送 2:每次设置一次发送一次 注意事项:除色时颜色切换维彩色使用的是临时变量,下发一次被释放,如果start再次发就会导致协议层被覆盖
|
||||||
//ret = writedown_device_configuration();
|
//ret = writedown_device_configuration();
|
||||||
}
|
}
|
||||||
|
on_is_auto_paper(is_auto_paper_scan); //硬件参数必须写在扫描参数前面
|
||||||
|
ret = get_scanner_paperon();
|
||||||
|
if (ret == SCANNER_ERR_DEVICE_NO_PAPER)
|
||||||
|
{
|
||||||
|
status_ = ret;
|
||||||
|
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if(ret == SCANNER_ERR_OK)
|
if(ret == SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
|
@ -1794,15 +1800,6 @@ int hg_scanner_239::start(void)
|
||||||
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status01 is(%s), the result will be unpredictable.\n", hg_scanner_err_name(ret));
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status01 is(%s), the result will be unpredictable.\n", hg_scanner_err_name(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = get_scanner_paperon();
|
|
||||||
if (ret == SCANNER_ERR_DEVICE_NO_PAPER)
|
|
||||||
{
|
|
||||||
status_ = ret;
|
|
||||||
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
|
|
||||||
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = write_command(SC_START);
|
ret = write_command(SC_START);
|
||||||
|
|
||||||
io_->set_timeout(1000);
|
io_->set_timeout(1000);
|
||||||
|
@ -1824,12 +1821,13 @@ int hg_scanner_239::start(void)
|
||||||
}
|
}
|
||||||
int hg_scanner_239::stop(void)
|
int hg_scanner_239::stop(void)
|
||||||
{
|
{
|
||||||
|
io_->set_timeout(2000);
|
||||||
|
|
||||||
int ret = SCANNER_ERR_OK;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
user_cancel_ = true;
|
user_cancel_ = true;
|
||||||
|
|
||||||
ret = write_command(SC_STOP);
|
ret = write_command(SC_STOP);
|
||||||
io_->set_timeout(500);
|
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "STOP SCAN-_- !!!: %s\n", hg_scanner_err_name(ret));
|
||||||
return status_;
|
return status_;
|
||||||
}
|
}
|
||||||
int hg_scanner_239::reset(void)
|
int hg_scanner_239::reset(void)
|
||||||
|
|
Loading…
Reference in New Issue