在启动之前获取文件格式;取消启动失败后的二次启动;开始扫描事件回调中判断界面回调函数;日志增加时间戳
This commit is contained in:
parent
da0da5b401
commit
a513c71ec6
|
@ -1605,22 +1605,22 @@ int scanner::thread_start(void)
|
||||||
scan_over_ = false;
|
scan_over_ = false;
|
||||||
double_handle_ = DOUBLE_FEED_NEED_UI;
|
double_handle_ = DOUBLE_FEED_NEED_UI;
|
||||||
|
|
||||||
|
unsigned int l = sizeof(img_fmt_);
|
||||||
|
SANE_CompressionType cmprsn = img_fmt_.compress.compression;
|
||||||
|
if (hg_sane_middleware::instance()->io_control(handle_, IO_CTRL_CODE_GET_FINAL_IMAGE_FORMAT, &img_fmt_, &l))
|
||||||
|
img_fmt_.img_format = SANE_IMAGE_TYPE_BMP;
|
||||||
|
img_fmt_.compress.compression = cmprsn;
|
||||||
|
|
||||||
int ret = hg_sane_middleware::instance()->start(handle_, NULL);
|
int ret = hg_sane_middleware::instance()->start(handle_, NULL);
|
||||||
|
|
||||||
// the third-APPs in linux will call 'stop' after every start, but it not happens in windows-apps, so we handle this as following ...
|
// the third-APPs in linux will call 'stop' after every start, but it not happens in windows-apps, so we handle this as following ...
|
||||||
if (ret == SANE_STATUS_NO_DOCS && prev_start_result_ == SANE_STATUS_GOOD)
|
//if (ret == SANE_STATUS_NO_DOCS && prev_start_result_ == SANE_STATUS_GOOD)
|
||||||
ret = hg_sane_middleware::instance()->start(handle_, NULL);
|
// ret = hg_sane_middleware::instance()->start(handle_, NULL);
|
||||||
|
|
||||||
if (ret == SANE_STATUS_GOOD)
|
if (ret == SANE_STATUS_GOOD || ret == SCANNER_ERR_DEVICE_DOUBLE_FEEDING)
|
||||||
{
|
{
|
||||||
/*if (indicator_.get() && !IsWindowVisible(indicator_->hwnd()))
|
/*if (indicator_.get() && !IsWindowVisible(indicator_->hwnd()))
|
||||||
indicator_->show(true);*/
|
indicator_->show(true);*/
|
||||||
|
|
||||||
unsigned int l = sizeof(img_fmt_);
|
|
||||||
SANE_CompressionType cmprsn = img_fmt_.compress.compression;
|
|
||||||
if (hg_sane_middleware::instance()->io_control(handle_, IO_CTRL_CODE_GET_FINAL_IMAGE_FORMAT, &img_fmt_, &l))
|
|
||||||
img_fmt_.img_format = SANE_IMAGE_TYPE_BMP;
|
|
||||||
img_fmt_.compress.compression = cmprsn;
|
|
||||||
}
|
}
|
||||||
//else if (indicator_.get())
|
//else if (indicator_.get())
|
||||||
//{
|
//{
|
||||||
|
@ -3600,7 +3600,7 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
|
||||||
img_ind_ = 0;
|
img_ind_ = 0;
|
||||||
if (prog)
|
if (prog)
|
||||||
prog->notify_working();
|
prog->notify_working();
|
||||||
else if (callback::show_progress_ui && is_bIndicator)
|
else if (callback::show_progress_ui && is_bIndicator && ui_notify)
|
||||||
ui_notify(ev_code, data, *len);
|
ui_notify(ev_code, data, *len);
|
||||||
on_ui_event(ev_code, (void*)ev_code);
|
on_ui_event(ev_code, (void*)ev_code);
|
||||||
log_info(L"Scanning ...\r\n", 1);
|
log_info(L"Scanning ...\r\n", 1);
|
||||||
|
@ -3675,7 +3675,7 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
|
||||||
|
|
||||||
{
|
{
|
||||||
wchar_t msg[128] = { 0 };
|
wchar_t msg[128] = { 0 };
|
||||||
swprintf_s(msg, _countof(msg) - 1, L"New image(%u) received with %u bytes\r\n", img_ind_, simg->bytes);
|
swprintf_s(msg, _countof(msg) - 1, L"New image(%u) received with %u bytes (status: %d)\r\n", img_ind_, simg->bytes, simg->flag.statu);
|
||||||
log_info(msg, 1);
|
log_info(msg, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3839,11 +3839,16 @@ void close_log(void)
|
||||||
}
|
}
|
||||||
void log(const wchar_t* info)
|
void log(const wchar_t* info)
|
||||||
{
|
{
|
||||||
|
wchar_t clock[40] = { 0 };
|
||||||
|
|
||||||
|
hg_get_current_time_w(clock);
|
||||||
if (g_file_)
|
if (g_file_)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(g_lock_);
|
std::lock_guard<std::mutex> lock(g_lock_);
|
||||||
|
std::wstring text(clock);
|
||||||
|
|
||||||
fwrite(info, 2, lstrlenW(info), g_file_);
|
text += info;
|
||||||
|
fwrite(text.c_str(), 2, text.length(), g_file_);
|
||||||
fflush(g_file_);
|
fflush(g_file_);
|
||||||
if (ftell(g_file_) > 10 * 1024 * 1024)
|
if (ftell(g_file_) > 10 * 1024 * 1024)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue