设备休眠时做操作增加设备休眠提示

This commit is contained in:
yangjiaxuan 2023-11-17 17:06:04 +08:00
parent cb7e9ebd8e
commit 524a9b2af7
6 changed files with 42 additions and 16 deletions

View File

@ -90,6 +90,8 @@ hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_sc
#endif
if (init_settings(0x200))
init_settings((jsontext1 + jsontext2 + jsontext3).c_str());
status_ = SCANNER_ERR_OK;
}
hg_scanner_200::~hg_scanner_200()
{}

View File

@ -186,6 +186,7 @@ hg_scanner_239::hg_scanner_239(const char* dev_name, int pid,usb_io* io) : hg_sc
//wait_read_int.notify();
update_boarddatetime();
status_ = SCANNER_ERR_OK;
}
hg_scanner_239::~hg_scanner_239()
{
@ -1151,11 +1152,12 @@ void hg_scanner_239::thread_correction(void)
if (ret == SCANNER_ERR_TIMEOUT)
{
if (sw.elapsed_s() > 30 || autoFaltFinish)
if (autoFaltFinish || sw.elapsed_s() > 120)
{
is_auto_falt = false;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
//notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_FAIL_OUTTIME), SANE_EVENT_ERROR, ret); // 通信超时
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "校正是否真正结束: %s\n", autoFaltFinish ? "true" : "false");
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "设备校正超时 '%s'\n", hg_scanner_err_name(status_));
break;
}
@ -1179,18 +1181,20 @@ void hg_scanner_239::thread_correction(void)
notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
printf("%s\r\n", sinfo.c_str());
if (NULL != strstr(sinfo.c_str(), "******Correct Done******"))
{
autoFaltFinish = true;
}
if (info->Code == 4)
{
is_auto_falt = false;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "固件层判断校正结束,返回码 Code: %d \n", info->Code);
//notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
break;
}
if (NULL != strstr(sinfo.c_str(), "******Correct Done******"))
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Recived : ******Correct Done****** , return Code: %d \n", info->Code);
autoFaltFinish = true;
}
//break;
}
}

View File

@ -87,12 +87,23 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) :
,papersize(pid)
,is_devs_sleep_(false)
{
if (init_settings(pid_))
{
if (pid_ == 0x300)
init_settings((jsontext1 + jsontext2 + jsontext3).c_str());
else
init_settings((jsontext4 + jsontext5 + jsontext6).c_str());
}
dsp_config.value = 0;
dsp_config.params_3288.enableLed = 1; //默认值
dsp_config.params_3288.isCorrect = 1;
initdevice();
int ret = initdevice();
if (ret != SCANNER_ERR_OK)
{
return;
}
std::string fv(get_firmware_version()),
sn(get_serial_num());
if (fv.empty() || sn.empty())
@ -116,15 +127,10 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) :
#ifndef MAPPING_FUNCTION_IN_BASE
init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化
#endif
if (init_settings(pid_))
{
if (pid_ == 0x300)
init_settings((jsontext1 + jsontext2 + jsontext3).c_str());
else
init_settings((jsontext4 + jsontext5 + jsontext6).c_str());
}
update_boarddatetime();//暂未考虑版本兼容情况
//wait_read_int.notify();
status_ = SCANNER_ERR_OK;
}
hg_scanner_300::~hg_scanner_300()
{}
@ -767,6 +773,7 @@ int hg_scanner_300::initdevice()
int val = 0,
ret = SCANNER_ERR_OK;
status_ = ret;
int cnt = 0;
ret = get_scan_is_sleep(val);
@ -794,7 +801,7 @@ int hg_scanner_300::initdevice()
set_kernelsnap_ver();
is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本号 还没有做判断的
}
return SCANNER_ERR_OK;
return status_;
}
void hg_scanner_300::writedown_image_configuration(void)
{

View File

@ -192,6 +192,7 @@ hg_scanner_302::hg_scanner_302(const char* dev_name, int pid, usb_io* io) : hg_s
}
//writedown_device_configuration(); // initialize the hardware settings
init_version();
status_ = SCANNER_ERR_OK;
}
hg_scanner_302::~hg_scanner_302()
{

View File

@ -105,6 +105,8 @@ hg_scanner_306::hg_scanner_306(const char* dev_name,int pid, usb_io* io) :
if (init_settings(pid_))
init_settings((jsontext1 + jsontext2 + jsontext3).c_str());
status_ = SCANNER_ERR_OK;
//set_firmware_upgrade("C:\\Users\\modehua\\Desktop\\updata.zip");
}

View File

@ -791,6 +791,16 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
if (scanner)
{
int devStatus = scanner->status();
if (SCANNER_ERR_OK != devStatus)
{
io->release();
*h = NULL;
delete scanner;
scanner = nullptr;
return (scanner_err)devStatus;
}
scanner->set_ui_callback(&hg_scanner_mgr::ui_default_callback, hg_scanner_mgr::async_io_enabled_);
scanner->set_dev_family(g_supporting_devices[it->ind].type.c_str());
scanner->set_read_over_with_no_data(hg_scanner_mgr::read_over_with_eof_);