diff --git a/hgdriver/hgdev/hg_scanner_200.cpp b/hgdriver/hgdev/hg_scanner_200.cpp index 9b5679e..a7f0edc 100644 --- a/hgdriver/hgdev/hg_scanner_200.cpp +++ b/hgdriver/hgdev/hg_scanner_200.cpp @@ -81,6 +81,7 @@ namespace settingsdsp_200 } hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io,pid) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_200(%s) constructing ...\n", hg_log::format_ptr(this).c_str()); //pid_ = pid; initdevice(); @@ -370,12 +371,18 @@ int hg_scanner_200::readusb(USBCB &usb) } int hg_scanner_200::pop_image() { - std::lock_guard lock(io_lock_); int ret = SCANNER_ERR_OK; USBCB usbcb = { setting3288dsp::POP_IMAGE, 0, 0 }; - ret = writeusb(usbcb); + { + std::lock_guard lock(io_lock_); + ret = writeusb(usbcb); + } + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } diff --git a/hgdriver/hgdev/hg_scanner_300.cpp b/hgdriver/hgdev/hg_scanner_300.cpp index 41d660a..a5ebfd3 100644 --- a/hgdriver/hgdev/hg_scanner_300.cpp +++ b/hgdriver/hgdev/hg_scanner_300.cpp @@ -87,8 +87,9 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : ,papersize(pid) ,is_devs_sleep_(false) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_300(%s) constructing ...\n", hg_log::format_ptr(this).c_str()); dsp_config.value = 0; - dsp_config.params_3288.enableLed = 1; //默认值 + dsp_config.params_3288.enableLed = 1; //默认? dsp_config.params_3288.isCorrect = 1; int ret = initdevice(); @@ -117,7 +118,7 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : firmware_sup_log_export_G300_ = year_date.compare("230430") >= 0 ? true : false; #ifndef MAPPING_FUNCTION_IN_BASE - init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化 + init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始? #endif if (init_settings(pid_)) @@ -158,11 +159,11 @@ void hg_scanner_300::thread_handle_usb_read(void) } //printf("usb.u32_Data = %d ret = %d\r\n",usb.u32_Data,ret); - //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止。 所以始终以 "停止" 消息为结束信号 - //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来。 + //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止?所以始终以 "停止" 消息为结束信? + //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来? if (ret == SCANNER_ERR_DEVICE_STOPPED) { - status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为准 + status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为? savestatus_.clear(); if (user_cancel_) { @@ -239,7 +240,7 @@ void hg_scanner_300::thread_handle_usb_read(void) VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s\n", hg_scanner_err_description(status_)); break; } - if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡死 + if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡? { if ((img_conf_.papertype == TwSS::MaxSize || img_conf_.papertype == TwSS::USStatement) && pid_ == 0x0300 && firmware_sup_dpi_600) { @@ -247,30 +248,30 @@ void hg_scanner_300::thread_handle_usb_read(void) } else { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "Get Status TimeOut,get image out 30S\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } } if (sw.elapsed_s() > 130) { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "MaxSize TimeOut,Get Image 130s\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } if (ret == SCANNER_ERR_OK && usb.u32_Count > 0) { - int totalNum = usb.u32_Count & 0x3fffffff; // 2022-08-04: 兼容Android,默认图片大小均在1GB以内 + int totalNum = usb.u32_Count & 0x3fffffff; // 2022-08-04: 兼容Android,默认图片大小均?GB以内 VLOG_MINI_2(LOG_LEVEL_WARNING, "Get Scaner Image Size:%d bytes,Image Num[%d]\n", totalNum,img_num); img_num++; if (totalNum) @@ -381,7 +382,7 @@ int hg_scanner_300::do_start(void) { return ret; } - if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险) + if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险? { is_devs_sleep_ = false; set_kernelsnap_ver(); @@ -476,6 +477,10 @@ int hg_scanner_300::pop_image() std::lock_guard lock(io_lock_); ret = writeusb(usbcb); } + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } @@ -802,7 +807,7 @@ int hg_scanner_300::initdevice() if (status_ != SCANNER_ERR_DEVICE_SLEEPING) { set_kernelsnap_ver(); - is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本号 还没有做判断的 + is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本?还没有做判断? } return status_; } @@ -834,7 +839,7 @@ void hg_scanner_300::writedown_image_configuration(void) // ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper; ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型 - ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用 + ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使? image_configuration(ic); } void hg_scanner_300::printf_devconfig(setting_hardware::HGSCANCONF_3288 *d) @@ -975,7 +980,7 @@ int hg_scanner_300::get_correction_image(int inx , int dpi, int mode) cv::Mat white_mat; cv::Mat black_mat;; - for (size_t i = 0; i < 2; i++) //黑白一起保存下来 + for (size_t i = 0; i < 2; i++) //黑白一起保存下? { vector imagedata; @@ -1017,7 +1022,7 @@ int hg_scanner_300::get_correction_image(int inx , int dpi, int mode) if (mat.empty()) { VLOG_MINI_1(LOG_LEVEL_WARNING, "get_correction_image image is NULL:%d\n", image_info.info.params.status); - return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退了 + return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退? } float f = 0.0; @@ -1050,7 +1055,7 @@ std::string hg_scanner_300::get_firmware_version() { char buf[20] = { 0 }; int ret = SCANNER_ERR_OK, - len = 10; //协议定义长度为10 100 200 =8 + len = 10; //协议定义长度?0 100 200 =8 USBCB cmd = { setting3288dsp::GET_FW_VERSION,len,0,}; { diff --git a/hgdriver/hgdev/hg_scanner_302.cpp b/hgdriver/hgdev/hg_scanner_302.cpp index b426936..efaecb1 100644 --- a/hgdriver/hgdev/hg_scanner_302.cpp +++ b/hgdriver/hgdev/hg_scanner_302.cpp @@ -550,7 +550,10 @@ int hg_scanner_302::pop_first_image(void) std::lock_guard lock(io_lock_); int ret = write_register(setting3399::SR_IM_POP, 1); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner_err_name(ret)); + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_first_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } diff --git a/hgdriver/hgdev/hg_scanner_306.cpp b/hgdriver/hgdev/hg_scanner_306.cpp index 0b00047..1183255 100644 --- a/hgdriver/hgdev/hg_scanner_306.cpp +++ b/hgdriver/hgdev/hg_scanner_306.cpp @@ -82,8 +82,9 @@ hg_scanner_306::hg_scanner_306(const char* dev_name,int pid, usb_io* io) : , frame_width_(0) , frame_hegiht_(0) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_306(%s) constructing ...\n", hg_log::format_ptr(this).c_str()); dsp_config.value = 0; - dsp_config.params_7010.enableLed = 1; //默认值 + dsp_config.params_7010.enableLed = 1; //默认? dsp_config.params_7010.isCorrect = 1; int ret = get_device_type(firmware_sup_device_7010); @@ -100,7 +101,7 @@ hg_scanner_306::hg_scanner_306(const char* dev_name,int pid, usb_io* io) : } #ifndef MAPPING_FUNCTION_IN_BASE - init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化 + init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始? #endif if (init_settings(pid_)) init_settings((jsontext1 + jsontext2 + jsontext3).c_str()); @@ -135,11 +136,11 @@ void hg_scanner_306::thread_handle_usb_read(void) } //printf("usb.u32_Data = %d ret = %d\r\n",usb.u32_Data,ret); - //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止。 所以始终以 "停止" 消息为结束信号 - //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来。 + //如果设备出现卡纸 或者双张等设备信息问题,需要等到设备进行发送stop才能停止?所以始终以 "停止" 消息为结束信? + //如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来? if (ret == SCANNER_ERR_DEVICE_STOPPED) { - status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为准 + status_ = !savestatus_.empty() ? savestatus_[0] : SCANNER_ERR_OK;//以第一个消息为? savestatus_.clear(); if (user_cancel_) { @@ -216,7 +217,7 @@ void hg_scanner_306::thread_handle_usb_read(void) VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s\n", hg_scanner_err_description(status_)); break; } - if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡死 + if (sw.elapsed_ms() > 30000 && img_conf_.resolution_dst != 600)//防止状态信息一直取不上来导致卡? { if ((img_conf_.papertype == TwSS::MaxSize || img_conf_.papertype == TwSS::USStatement) && pid_ == 0x0300 && firmware_sup_dpi_600) { @@ -224,25 +225,25 @@ void hg_scanner_306::thread_handle_usb_read(void) } else { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "Get Status TimeOut,get image out 30S\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } } if (sw.elapsed_s() > 130) { - if (!savestatus_.empty())//以第一个消息为准 + if (!savestatus_.empty())//以第一个消息为? { status_ = savestatus_[0]; } savestatus_.clear(); hg_log::log(LOG_LEVEL_WARNING, "MaxSize TimeOut,Get Image 130s\n"); - notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮椂 + notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 鍙栧浘閫氫俊瓒呮? break; } if (ret == SCANNER_ERR_OK && usb.u32_Count > 0) @@ -337,7 +338,7 @@ int hg_scanner_306::do_start(void) { return ret; } - if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险) + if (is_devs_sleep_)//设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险? { is_devs_sleep_ = false; set_kernelsnap_ver(); @@ -432,6 +433,10 @@ int hg_scanner_306::pop_image() std::lock_guard lock(io_lock_); ret = writeusb(usbcb); } + if (ret != SCANNER_ERR_OK) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "pop_image = %s\n", hg_scanner_err_name(ret)); + } return ret; } @@ -758,7 +763,7 @@ int hg_scanner_306::initdevice() if (status_ != SCANNER_ERR_DEVICE_SLEEPING) { set_kernelsnap_ver(); - is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本号 还没有做判断的 + is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本?还没有做判断? } return SCANNER_ERR_OK; } @@ -790,7 +795,7 @@ void hg_scanner_306::writedown_image_configuration(void) // ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper; ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型 - ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用 + ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使? image_configuration(ic); } void hg_scanner_306::printf_devconfig(setting_hardware::HGSCANCONF_7010 *d) @@ -870,7 +875,7 @@ int hg_scanner_306::get_correction_image(int inx , int dpi, int mode) cv::Mat white_mat; cv::Mat black_mat;; - for (size_t i = 0; i < 2; i++) //黑白一起保存下来 + for (size_t i = 0; i < 2; i++) //黑白一起保存下? { vector imagedata; @@ -908,7 +913,7 @@ int hg_scanner_306::get_correction_image(int inx , int dpi, int mode) if (mat.empty()) { VLOG_MINI_1(LOG_LEVEL_WARNING, "get_correction_image image is NULL:%d\n", image_info.info.params.status); - return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退了 + return SCANNER_ERR_NO_DATA; //只要有一张图没有 直接退? } float f = 0.0; @@ -934,7 +939,7 @@ std::string hg_scanner_306::get_firmware_version() { char buf[20] = { 0 }; int ret = SCANNER_ERR_OK, - len = 10; //协议定义长度为10 100 200 =8 + len = 10; //协议定义长度?0 100 200 =8 USBCB cmd = { setting3288dsp::GET_FW_VERSION,len,0,}; { @@ -1221,13 +1226,13 @@ int hg_scanner_306::set_scan_lock_check_val(string str) } //#enum scanner_err //#{ -//# SCANNER_ERR_OK = 0, //设备正常状态 +//# SCANNER_ERR_OK = 0, //设备正常状? //# SCANNER_ERR_SLEEP, 1 //设备处于休眠当中 -//# SCANNER_ERR_UPDATE_OK, 2 //设备更新:成功 +//# SCANNER_ERR_UPDATE_OK, 2 //设备更新:成? //# SCANNER_ERR_UPDATE_UPDATAING, 3 //设备更新:进行中 -//# SCANNER_ERR_UPDATE_CHECK_VAL_ERROR, 4 //设备更新:校验检测错误 -//# SCANNER_ERR_UPDATE_CHECK_FILE_LOST, 5 //设备更新:文件丢失 -//# SCANNER_ERR_UPDATE_UNZIP_FAIL, 6 //设备更新:解压失败 +//# SCANNER_ERR_UPDATE_CHECK_VAL_ERROR, 4 //设备更新:校验检测错? +//# SCANNER_ERR_UPDATE_CHECK_FILE_LOST, 5 //设备更新:文件丢? +//# SCANNER_ERR_UPDATE_UNZIP_FAIL, 6 //设备更新:解压失? //#}; int hg_scanner_306::set_firmware_upgrade(std::string str) {