调整日志,统一到设备层记录,并将路径指定为设备层组伯所在目录

This commit is contained in:
gb 2022-05-30 11:04:26 +08:00
parent ae50bc7d72
commit fcf3a6bcff
21 changed files with 1021 additions and 1303 deletions

View File

@ -1,5 +1,5 @@
#include "hg_ipc.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include "huagao/hgscanner_error.h"
#ifdef WIN32
@ -78,7 +78,7 @@ platform_event::platform_event() : waiting_(false), dbg_info_("")
if (err == -1)
{
err = errno;
HG_VLOG_MINI_2(LOG_LEVEL_FATAL, "(%s)sem_init failed: %d\n", hg_log::format_ptr(this).c_str(), err);
VLOG_MINI_2(LOG_LEVEL_FATAL, "(%s)sem_init failed: %d\n", hg_log::format_ptr(this).c_str(), err);
}
}
platform_event::~platform_event()
@ -94,7 +94,7 @@ bool platform_event::wait(unsigned timeout)
{
bool waited = true;
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "platform_event(%s - %s) --> waiting...\n", hg_log::format_ptr(this).c_str(), dbg_info_.c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "platform_event(%s - %s) --> waiting...\n", hg_log::format_ptr(this).c_str(), dbg_info_.c_str());
waiting_ = true;
if (timeout == USB_TIMEOUT_INFINITE)
sem_wait(&sem_);
@ -105,7 +105,7 @@ bool platform_event::wait(unsigned timeout)
to.tv_nsec = (long)((timeout % 1000) * 1000 * 1000);
waited = sem_timedwait(&sem_, &to) == 0;
}
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "platform_event(%s - %s) --> %s.\n", hg_log::format_ptr(this).c_str(), dbg_info_.c_str(), waited ? "waited" : "wait timeout");
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "platform_event(%s - %s) --> %s.\n", hg_log::format_ptr(this).c_str(), dbg_info_.c_str(), waited ? "waited" : "wait timeout");
waiting_ = false;
return waited;
@ -129,7 +129,7 @@ void platform_event::set_debug_info(const char* info)
shared_memory::shared_memory(unsigned long long key, size_t size) : key_(key), obj_((void*)-1), first_(true), bytes_(size), len_(0)
{
unsigned int* ptr = (unsigned int*)&key_;
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "shared memory key = 0x%x%08x\n", ptr[1], ptr[0]);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "shared memory key = 0x%x%08x\n", ptr[1], ptr[0]);
init();
}
@ -163,11 +163,11 @@ void shared_memory::init(void)
obj = shmget(key_, bytes_, 0600);
if(obj == -1)
obj = shmget(key_, bytes_, 0);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "open existing: shmget(0x%x%08x) = %d\n", v[1], v[0], obj);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "open existing: shmget(0x%x%08x) = %d\n", v[1], v[0], obj);
obj_ = (void*)obj;
std::string prev(read()), proc("");
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "shared memory content: %s\n", prev.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "shared memory content: %s\n", prev.c_str());
if(prev.length())
{
proc = prev;
@ -192,17 +192,17 @@ void shared_memory::init(void)
first_ = true;
clear();
obj = shmget(key_, bytes_, IPC_EXCL | IPC_CREAT | 0600);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s is not existing and reopen it\n", prev.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s is not existing and reopen it\n", prev.c_str());
}
}
else
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "shmget(0x%x%08x) = %d\n", v[1], v[0], errno);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "shmget(0x%x%08x) = %d\n", v[1], v[0], errno);
return;
}
}
obj_ = (void*)obj;
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "shared memory id = %d[%s], \n", obj, first_ ? "created" : "opened");
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "shared memory id = %d[%s], \n", obj, first_ ? "created" : "opened");
#endif
if(first_)
@ -248,7 +248,7 @@ char* shared_memory::get_buf(void)
#else
int* h = (int*)&obj_;
char* buf = (char*)shmat(*h, 0, 0);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "shared memory %d buffer = %s, error = %d\n", *h, hg_log::format_ptr(buf).c_str(), errno);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "shared memory %d buffer = %s, error = %d\n", *h, hg_log::format_ptr(buf).c_str(), errno);
#endif
return buf;
@ -287,11 +287,11 @@ std::string shared_memory::get_proc_name_by_pid(pid_t pid)
}
if (sizeof(pid) > 4 && v[1])
{
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "PID(%lld) name is: %s\n", pid, ret.c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "PID(%lld) name is: %s\n", pid, ret.c_str());
}
else
{
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "PID(%u) name is: %s\n", pid, ret.c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "PID(%u) name is: %s\n", pid, ret.c_str());
}
return ret;

View File

@ -1,5 +1,5 @@
#include "hg_scanner.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include "sane/sane_option_definitions.h"
#ifdef WIN32
@ -38,7 +38,7 @@ hg_scanner::hg_scanner(ScannerSerial serial
for (int i = 0; i < ARRAY_SIZE(custom_gamma_val_->table); ++i)
custom_gamma_val_->table[i] = i & 0x0ff;
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s(%s) constructed\n", name_.c_str(), hg_log::format_ptr(this).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s(%s) constructed\n", name_.c_str(), hg_log::format_ptr(this).c_str());
image_prc_param_.value = 0;
if (io_)
@ -67,7 +67,7 @@ hg_scanner::~hg_scanner()
name_.insert(0, "\350\256\276\345\244\207");
name_ += "\345\267\262\347\273\217\345\205\263\351\227\255\343\200\202";
notify_ui_working_status(name_.c_str(), SANE_EVENT_SCANNER_CLOSED);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s(%s) destroyed.\n", name_.c_str(), hg_log::format_ptr(this).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s(%s) destroyed.\n", name_.c_str(), hg_log::format_ptr(this).c_str());
}
std::string hg_scanner::strerr(scanner_err err)
@ -217,19 +217,19 @@ int hg_scanner::save_2_tempory_file(std::shared_ptr<std::vector<char>> data, std
{
if (path_file)
*path_file = file;
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "--->Wrote %u bytes to file '%s'\n", wrote, file.c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "--->Wrote %u bytes to file '%s'\n", wrote, file.c_str());
}
else
{
ret = SCANNER_ERR_WRITE_FILE_FAILED;
HG_VLOG_MINI_3(LOG_LEVEL_FATAL, "Failed in writting file(%u/%u) '%s'\n", wrote, data->size(), file.c_str());
VLOG_MINI_3(LOG_LEVEL_FATAL, "Failed in writting file(%u/%u) '%s'\n", wrote, data->size(), file.c_str());
}
fclose(dst);
}
else
{
ret = SCANNER_ERR_CREATE_FILE_FAILED;
HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "Failed in creating file '%s'\n", file.c_str());
VLOG_MINI_1(LOG_LEVEL_FATAL, "Failed in creating file '%s'\n", file.c_str());
}
return ret;
@ -249,7 +249,7 @@ void hg_scanner::set_setting_map(int sn, const char* title)
empty++;
val.erase(0, empty);
//HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "title: '%s', val: '%s'\n", title, val.c_str());
//VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "title: '%s', val: '%s'\n", title, val.c_str());
if (val == OPTION_TITLE_HFMRSZ)
setting_map_[HG_BASE_SETTING_INDEX_RESTORE_DEFAULT_SETTINGS] = sn;
@ -376,7 +376,7 @@ void hg_scanner::thread_handle_usb(void)
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
if (scan_life_)
{
HG_LOG(LOG_LEVEL_FATAL, "image process is still running!\n");
LOG_INFO(LOG_LEVEL_FATAL, "image process is still running!\n");
continue;
}
}
@ -486,7 +486,7 @@ void hg_scanner::get_range(int setting_no, std::vector<std::string>& range, std:
else if(type == "string")
setting_jsn_.at(sn).at("default").get_to(def_val);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "setting %d has %d range(s) and default value is '%s'\n", setting_no, range.size(), def_val.c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "setting %d has %d range(s) and default value is '%s'\n", setting_no, range.size(), def_val.c_str());
}
bool hg_scanner::check_range(int setting_no, bool& val)
{
@ -723,7 +723,7 @@ void hg_scanner::thread_handle_image_process(void)
}
else
{
HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "FATAL: open tempory image file '%s' failed.\n", file.c_str());
VLOG_MINI_1(LOG_LEVEL_FATAL, "FATAL: open tempory image file '%s' failed.\n", file.c_str());
}
}
else
@ -821,11 +821,11 @@ void hg_scanner::working_done(void*)
if (test_1_paper_)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "scanning mode: finished testing ONE paper, restore to normal scanning.\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: finished testing ONE paper, restore to normal scanning.\n");
}
else
{
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "scanned %d picture(s) and finished with error %s.\n", final_img_index_, hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "scanned %d picture(s) and finished with error %s.\n", final_img_index_, hg_scanner::strerr((scanner_err)status_).c_str());
}
test_1_paper_ = false;
@ -932,14 +932,14 @@ int hg_scanner::setting_help(void* data)
if (access(helpfile.c_str(),F_OK) == -1)
#endif
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"App_Help_pdf path is:%s system is:%d\r\n",helpfile.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"App_Help_pdf path is:%s system is:%d\r\n",helpfile.c_str());
ret = SCANNER_ERR_OPEN_FILE_FAILED;
return ret ;
}
com += helpfile;
system(com.c_str());
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"App_Help_pdf path is:%s system is:%d\r\n",helpfile.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"App_Help_pdf path is:%s system is:%d\r\n",helpfile.c_str());
return ret;
}
int hg_scanner::setting_color_mode(void* data)
@ -975,7 +975,7 @@ int hg_scanner::setting_color_mode(void* data)
is_auto_matic_color = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? true :false; // 等于COLOR_MODE_AUTO_MATCH 的时候颜色模式需要变为2 彩色模式图像参数和硬件参数都如此
HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Change color mode from %s to %s = %s color is =%s\n", color_mode_string(old).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str(),str.c_str());
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Change color mode from %s to %s = %s color is =%s\n", color_mode_string(old).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str(),str.c_str());
if(ret == SCANNER_ERR_NOT_EXACT)
strcpy((char*)data, str.c_str());
@ -999,7 +999,7 @@ int hg_scanner::setting_multi_out_type(void *data)
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_MULTI_OUT], str);
int color;
image_prc_param_.bits.multi_out = match_best_multi_out(str,NULL);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "set multi_out type from %s to %s = %s\n", multi_out_string(image_prc_param_.bits.multi_out).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "set multi_out type from %s to %s = %s\n", multi_out_string(image_prc_param_.bits.multi_out).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW)
color = COLOR_MODE_256_GRAY;
@ -1105,7 +1105,7 @@ int hg_scanner::setting_paper(void* data)
else if (!exact)
ret = SCANNER_ERR_NOT_EXACT;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change paper from %s to %s = %s\n", paper_string(old).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change paper from %s to %s = %s\n", paper_string(old).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
if(ret == SCANNER_ERR_NOT_EXACT)
strcpy((char*)data, paper.c_str());
@ -1119,7 +1119,7 @@ int hg_scanner::setting_paper_check(void* data)
bool use = *((bool*)data);
int ret = on_paper_check_changed(use);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change paper size-checking %s = %s\n", *((bool*)data) ? "enabled" : "disabled", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change paper size-checking %s = %s\n", *((bool*)data) ? "enabled" : "disabled", hg_scanner::strerr((scanner_err)ret).c_str());
*((bool*)data) = use;
return ret;
@ -1130,7 +1130,7 @@ int hg_scanner::setting_page(void* data)
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_PAGE], val);
int ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change page from %s to %s = %s\n", page_string(image_prc_param_.bits.page).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change page from %s to %s = %s\n", page_string(image_prc_param_.bits.page).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
image_prc_param_.bits.page = match_best_page(val, NULL);
if (!exact)
strcpy((char*)data, val.c_str());
@ -1165,7 +1165,7 @@ int hg_scanner::setting_resolution(void* data)
else if (sub)
ret = sub;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change resolution from %d to %d = %s\n", old, *((int*)data), hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change resolution from %d to %d = %s\n", old, *((int*)data), hg_scanner::strerr((scanner_err)ret).c_str());
*((int*)data) = resolution_;
return ret;
@ -1206,7 +1206,7 @@ int hg_scanner::setting_rid_hoe_range(void* data)
*((int*)data) = rid_hole_range_;
}
rid_hole_range_*=100;
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "rid_hole_range_ = %f\r\n", rid_hole_range_);
VLOG_MINI_1(LOG_LEVEL_WARNING, "rid_hole_range_ = %f\r\n", rid_hole_range_);
return ret;
}
@ -1255,7 +1255,7 @@ int hg_scanner::setting_sharpen(void* data)
int ret = SCANNER_ERR_OK;
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_SHARPEN], str);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change sharpen from %s to %s = ", sharpen_string(image_prc_param_.bits.sharpen).c_str(), (char*)data);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change sharpen from %s to %s = ", sharpen_string(image_prc_param_.bits.sharpen).c_str(), (char*)data);
image_prc_param_.bits.sharpen = match_best_sharpen(str, NULL);
if (!exact)
@ -1263,7 +1263,7 @@ int hg_scanner::setting_sharpen(void* data)
strcpy((char*)data, str.c_str());
ret = SCANNER_ERR_NOT_EXACT;
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%d\n", ret);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%d\n", ret);
return ret;
}
@ -1344,7 +1344,7 @@ int hg_scanner::setting_is_permeate_lv(void* data)
std::string str((char*)data);
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_PERMEATE_LV], str);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change is_permeate_lv from %s to %s = ", is_permaeate_string(image_prc_param_.bits.is_permeate_lv_).c_str(), (char*)data);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change is_permeate_lv from %s to %s = ", is_permaeate_string(image_prc_param_.bits.is_permeate_lv_).c_str(), (char*)data);
image_prc_param_.bits.is_permeate_lv_ = match_best_permaeate_lv(str, NULL);
if (!exact)
@ -1352,7 +1352,7 @@ int hg_scanner::setting_is_permeate_lv(void* data)
strcpy((char*)data, str.c_str());
ret = SCANNER_ERR_NOT_EXACT;
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%d\n", ret);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%d\n", ret);
return ret;
@ -1412,7 +1412,7 @@ int hg_scanner::setting_scan_mode(void* data)
setting_jsn_.at(key).at("cur").get_to(scan_count_);
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "set scanning pages to %d\n", scan_count_);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "set scanning pages to %d\n", scan_count_);
return ret;
}
@ -1433,7 +1433,7 @@ int hg_scanner::setting_scan_count(void* data)
scan_count_ = *((int*)data);
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "set scanning pages to %d\n", scan_count_);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "set scanning pages to %d\n", scan_count_);
return ret;
}
@ -1443,7 +1443,7 @@ int hg_scanner::setting_text_direction(void* data)
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_TEXT_DIRECTION], str);
int ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change text direction from '%s' to '%s' = %s\n", text_direction_string(image_prc_param_.bits.text_direction).c_str()
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change text direction from '%s' to '%s' = %s\n", text_direction_string(image_prc_param_.bits.text_direction).c_str()
, (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
image_prc_param_.bits.text_direction = match_best_text_direction(str, NULL);
if (!exact)
@ -1565,7 +1565,7 @@ int hg_scanner::setting_img_quality(void *data)
std::string str((char*)data);
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_IMG_QUALITY], str);
int ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change quality from '%s' to '%s' = %s\n", is_img_quality(is_quality_).c_str()
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change quality from '%s' to '%s' = %s\n", is_img_quality(is_quality_).c_str()
, (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
is_quality_ = match_best_img_quality(str,NULL);
@ -1613,7 +1613,7 @@ void hg_scanner::on_device_reconnected(void)
{
std::lock_guard<std::mutex> lock(io_lock_);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%04x:%04x reconnected.\n", io_->get_vid(), io_->get_pid());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%04x:%04x reconnected.\n", io_->get_vid(), io_->get_pid());
}
int hg_scanner::set_setting_value(int setting_no, void* data, int len)
{
@ -1689,7 +1689,7 @@ int hg_scanner::on_scann_error(int err)
{
status_ = err;
HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "[xxx]Device status: 0x%x\n", err);
VLOG_MINI_1(LOG_LEVEL_FATAL, "[xxx]Device status: 0x%x\n", err);
unsigned int e = err;
@ -1743,7 +1743,7 @@ std::shared_ptr<std::vector<char>> hg_scanner::aquire_memory(int size, bool from
catch (...)
{
mem.reset();
HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "Allocate memory of bytes %u failed!\n", size);
VLOG_MINI_1(LOG_LEVEL_FATAL, "Allocate memory of bytes %u failed!\n", size);
}
if (!mem.get())
@ -1758,12 +1758,12 @@ std::shared_ptr<std::vector<char>> hg_scanner::aquire_memory(int size, bool from
catch (...)
{
mem.reset();
HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "Allocate memory of bytes %u failed secondary after 10 milliseconds!\n", size);
VLOG_MINI_1(LOG_LEVEL_FATAL, "Allocate memory of bytes %u failed secondary after 10 milliseconds!\n", size);
}
}
if (!mem.get())
{
HG_LOG(LOG_LEVEL_FATAL, "Can't aquire enough memory, working must be stopped!\n");
LOG_INFO(LOG_LEVEL_FATAL, "Can't aquire enough memory, working must be stopped!\n");
stop();
}
}
@ -1805,7 +1805,7 @@ bool hg_scanner::waiting_for_memory_enough(unsigned need_bytes)
{
if (first)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Memory is too small for aquiring image(%u bytes), wait for ENOUGH ...\n", need_bytes);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Memory is too small for aquiring image(%u bytes), wait for ENOUGH ...\n", need_bytes);
notify_ui_working_status(STATU_DESC_WAIT_FOR_MEM);
first = false;
}
@ -1816,11 +1816,11 @@ bool hg_scanner::waiting_for_memory_enough(unsigned need_bytes)
{
if (buf)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "waited for memory need(%u)\n", need_bytes);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "waited for memory need(%u)\n", need_bytes);
}
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "canceled by user while waiting for memory need(%u)\n", need_bytes);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "canceled by user while waiting for memory need(%u)\n", need_bytes);
}
}
ret = (!user_cancel_) && (buf != NULL);
@ -1848,7 +1848,7 @@ int hg_scanner::save_usb_data(std::shared_ptr<std::vector<char>> data)
int ret = SCANNER_ERR_OK;
usb_img_index_++;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "USB read one picture with %u bytes\n", data->size());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "USB read one picture with %u bytes\n", data->size());
if (is_to_file())
{
std::string file("");
@ -1972,7 +1972,7 @@ int hg_scanner::close(bool force)
}
else if (io_)
{
HG_LOG(LOG_LEVEL_WARNING, "close scanner: USB thread or Image thread is still running.\n");
LOG_INFO(LOG_LEVEL_WARNING, "close scanner: USB thread or Image thread is still running.\n");
io_->close();
io_->release();
io_ = NULL;
@ -2060,7 +2060,7 @@ int hg_scanner::set_setting(int setting_no, void* data, int len)
}
if (!hit)
{
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "Setting %d is not found in base setting functions.\n", setting_no);
VLOG_MINI_1(LOG_LEVEL_WARNING, "Setting %d is not found in base setting functions.\n", setting_no);
ret = set_setting_value(setting_no, data, len);
}
@ -2140,7 +2140,7 @@ int hg_scanner::get_setting(int setting_no, char* json_txt_buf, int* len)
sprintf(sn, "%d", setting_no);
if (!setting_jsn_.contains(sn))
HG_VLOG_MINI_2(LOG_LEVEL_FATAL, "!!!option(%d - %s) is not found.\n", setting_no, sn);
VLOG_MINI_2(LOG_LEVEL_FATAL, "!!!option(%d - %s) is not found.\n", setting_no, sn);
text = setting_jsn_.at(sn).dump();
setting_jsn_.at(sn).at("name").get_to(name);
if (name == SANE_STD_OPT_NAME_CUSTOM_AREA_LEFT || name == SANE_STD_OPT_NAME_CUSTOM_AREA_RIGHT)
@ -2273,7 +2273,7 @@ int hg_scanner::get_image_info(SANE_Parameters* ii)
ret = SCANNER_ERR_OK;
}
}
HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}

View File

@ -1,5 +1,5 @@
#include "hg_scanner_200.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#ifdef WIN32
#include "scanner_manager.h"
@ -120,7 +120,7 @@ namespace settingsdsp_200
*r = true;
else
*r = false;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
paper = paper_map[ind].paper;
if (type)
*type = paper_map[ind].type;
@ -209,7 +209,7 @@ enum hg_239_setting_item
hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io), pid_(pid)
{
string fw = get_firmware_version();
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_firmware_version is: %s\n",fw.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_firmware_version is: %s\n",fw.c_str());
initdevice();
dsp_config_.value = 0;
@ -250,7 +250,7 @@ void hg_scanner_200::discard_prev(void)
ret = get_scanner_status(usb);
}
if (imgs || packets)
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "discard prev-scanning %d packets and %d images.\n", packets, imgs);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "discard prev-scanning %d packets and %d images.\n", packets, imgs);
}
void hg_scanner_200::init_setting_map(int* setting_map, int count)
@ -397,7 +397,7 @@ void hg_scanner_200::thread_handle_usb_read(void)
else
{
// notify_ui_working_status(hg_scanner::error_description((scanner_err)prev_err).c_str(), SANE_EVENT_ERROR, prev_err);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "-x-x-x-: USB thread error: %s\n", hg_scanner::strerr((scanner_err)prev_err).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "-x-x-x-: USB thread error: %s\n", hg_scanner::strerr((scanner_err)prev_err).c_str());
}
prev_err = ret;
}
@ -433,7 +433,7 @@ int hg_scanner_200::start(void)
// {
// status_ = ret;
// notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_SCAN_FINISHED, status_);
// HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
// VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
// return ret;
// }
ret = get_scanner_paperon();
@ -441,7 +441,7 @@ int hg_scanner_200::start(void)
{
status_ = ret;
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
return ret;
}
@ -450,7 +450,7 @@ int hg_scanner_200::start(void)
ret = writeusb(usb);
io_->set_timeout(500);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
if(ret == SCANNER_ERR_OK)
{
@ -473,7 +473,7 @@ int hg_scanner_200::stop(void)
user_cancel_ = true;
if (ret == SCANNER_ERR_DEVICE_BUSY)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO,"stop status is busy\r\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO,"stop status is busy\r\n");
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
}
else if (ret == SCANNER_ERR_OK)
@ -604,11 +604,11 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
param.double_side = img_conf_.is_duplex;
param.dpi = img_conf_.resolution_dst;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.black_white :%d\r\n",param.black_white);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.channels :%d\r\n",param.channels);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.color_mode :%d\r\n",param.color_mode);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.double_side :%d\r\n",param.double_side);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.dpi :%d\r\n",param.dpi);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.black_white :%d\r\n",param.black_white);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.channels :%d\r\n",param.channels);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.color_mode :%d\r\n",param.color_mode);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.double_side :%d\r\n",param.double_side);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.dpi :%d\r\n",param.dpi);
handle = hg_imgproc::init(&img_conf_,&param,pid_);
@ -759,7 +759,7 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
colormode=img_conf_.pixtype;
err = hg_imgproc::split(handle,img_conf_.multiOutput,img_conf_.splitImage,img_conf_.multi_output_red,colormode,img_conf_.is_duplex);
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
,img_conf_.multiOutput
,img_conf_.splitImage
,img_conf_.multi_output_red
@ -792,7 +792,7 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
while (hg_imgproc::get_final_data(handle, &ih, &buf, index++) == SCANNER_ERR_OK && !user_cancel_)
{
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
std::vector<unsigned char>bmpdata;
@ -808,7 +808,7 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
buf = bmpdata.data();
ih.total_bytes = bmpdata.size();
HG_VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
}
@ -833,7 +833,7 @@ int hg_scanner_200::writedown_device_configuration(bool type,HGSCANCONF_DSP *d)
len = sizeof(USBCB);
ret = io_->write_bulk(&usbcb,&len);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
@ -1067,7 +1067,7 @@ else
if (test_1_paper_)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = 1;
}
else
@ -1142,56 +1142,56 @@ else
img_conf_ = ic;
agreement();
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
}
void hg_scanner_200::printf_devconfig(HGSCANCONF_DSP *d)
@ -1200,18 +1200,18 @@ void hg_scanner_200::printf_devconfig(HGSCANCONF_DSP *d)
if (!d)
d = &dsp_config_;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params.color:%d\r\n",d->params.color);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.double_feed_enbale:%d\r\n",d->params.double_feed_enbale);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.dpi:%d\r\n",d->params.dpi);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.enable_sizecheck:%d\r\n",d->params.enable_sizecheck);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.paper:%d\r\n",d->params.paper);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.pc_correct:%d\r\n",d->params.pc_correct);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.screw_detect_enable:%d\r\n",d->params.screw_detect_enable);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.screw_detect_level:%d\r\n",d->params.screw_detect_level);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.stable_enbale:%d\r\n",d->params.stable_enbale);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.unused_one:%d\r\n",d->params.unused_one);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.unused_two:%d\r\n",d->params.unused_two);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.value:%d\r\n",d->value);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params.color:%d\r\n",d->params.color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.double_feed_enbale:%d\r\n",d->params.double_feed_enbale);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.dpi:%d\r\n",d->params.dpi);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.enable_sizecheck:%d\r\n",d->params.enable_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.paper:%d\r\n",d->params.paper);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.pc_correct:%d\r\n",d->params.pc_correct);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.screw_detect_enable:%d\r\n",d->params.screw_detect_enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.screw_detect_level:%d\r\n",d->params.screw_detect_level);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.stable_enbale:%d\r\n",d->params.stable_enbale);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.unused_one:%d\r\n",d->params.unused_one);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.unused_two:%d\r\n",d->params.unused_two);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params.value:%d\r\n",d->value);
}
std::string hg_scanner_200::get_firmware_version()
{

View File

@ -10,7 +10,7 @@
#include <algorithm>
#include "hg_scanner.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#ifdef OEM_HANWANG
#define hg_scanner_200 hw_scanner_200

View File

@ -1,5 +1,5 @@
#include "hg_scanner_239.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include "filetools.h"
#ifdef WIN32
@ -365,7 +365,7 @@ namespace settings
*r = true;
else
*r = false;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
paper = paper_map[ind].paper;
if (type)
*type = paper_map[ind].type;
@ -379,7 +379,7 @@ namespace settings
hg_scanner_239::hg_scanner_239(const char* dev_name, int pid,usb_io* io) : hg_scanner(G20039Serial, dev_name, io)
, rewrite_conf_(false), reset_(false),pid_(pid)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_239(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_239(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
dev_conf_.value = 0;
#ifndef MAPPING_FUNCTION_IN_BASE
init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));
@ -390,7 +390,7 @@ hg_scanner_239::hg_scanner_239(const char* dev_name, int pid,usb_io* io) : hg_sc
}
hg_scanner_239::~hg_scanner_239()
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_239(%s) destroyed.\n", hg_log::format_ptr(this).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_239(%s) destroyed.\n", hg_log::format_ptr(this).c_str());
}
int hg_scanner_239::read_register(int addr, int* val)
@ -438,12 +438,12 @@ std::string hg_scanner_239::control_fetch(int addr, int val, int size)
ret = io_->read_bulk(&data[0], &l);
if (ret)
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) - read_bulk = %s\n", addr, val, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) - read_bulk = %s\n", addr, val, hg_scanner::strerr((scanner_err)ret).c_str());
data.clear();
}
}
else
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) = %s\n", addr, val, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) = %s\n", addr, val, hg_scanner::strerr((scanner_err)ret).c_str());
return data;
}
@ -473,7 +473,7 @@ int hg_scanner_239::clr_roller_num(void)
return val;
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "clr_roller_num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "clr_roller_num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
}
@ -486,7 +486,7 @@ int hg_scanner_239::get_sleep_time(void)
return val;
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
}
@ -497,7 +497,7 @@ int hg_scanner_239::get_scan_mode(void)
if (ret)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get scan mode error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get scan mode error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
status_ = ret;
return -1;
@ -512,7 +512,7 @@ int hg_scanner_239::get_status(void)
if (ret)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get status error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get status error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
status_ = ret;
return -1;
@ -527,7 +527,7 @@ bool hg_scanner_239::is_dev_tx(void)
if (ret)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_tx() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_tx() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
status_ = ret;
return false;
@ -542,7 +542,7 @@ bool hg_scanner_239::is_dev_image_process_done(void)
if (ret)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_process_done() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_process_done() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
status_ = ret;
return true;
@ -558,7 +558,7 @@ bool hg_scanner_239::is_dev_image_keep_last_paper(void)
if (ret)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_keep_last_paper() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_keep_last_paper() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
status_ = ret;
return true;
@ -575,7 +575,7 @@ int hg_scanner_239::get_scanned_count(void)
return val;
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanned_count = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanned_count = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
}
@ -584,7 +584,7 @@ int hg_scanner_239::get_image_count(void)
int val = 0,
ret = read_register(SR_IM_COUNT, &val);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_image_count() = %d, error: %s\n", val, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_image_count() = %d, error: %s\n", val, hg_scanner::strerr((scanner_err)ret).c_str());
if (ret == SCANNER_ERR_OK)
return val;
@ -600,7 +600,7 @@ int hg_scanner_239::get_front_data_size(void)
return val;
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_front_data_size = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_front_data_size = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
}
@ -609,9 +609,9 @@ void hg_scanner_239::init_version(void)
std::string fv(get_firmware_version()),
sn(get_serial_num());
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " HG3399 firmware version: %s\n", fv.c_str());
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " HG3399 serial number: %s\n", sn.c_str());
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " HG3399 IP: %s\n", get_ip().c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " HG3399 firmware version: %s\n", fv.c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " HG3399 serial number: %s\n", sn.c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " HG3399 IP: %s\n", get_ip().c_str());
if (fv.length() >= 10 && (fv[5] > 'A' || atoi(fv.substr(6, 4).c_str()) >= 1209))
{
@ -622,7 +622,7 @@ void hg_scanner_239::init_version(void)
}
void hg_scanner_239::image_process(std::shared_ptr<std::vector<char>>& buff)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Process image with %u bytes content ...\n", buff->size());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Process image with %u bytes content ...\n", buff->size());
hg_imgproc::IMGPRCPARAM param;
hg_imgproc::HIMGPRC handle = NULL;
@ -666,7 +666,7 @@ void hg_scanner_239::image_process(std::shared_ptr<std::vector<char>>& buff)
colormode=img_conf_.pixtype;
err = hg_imgproc::split(handle,img_conf_.multiOutput,img_conf_.splitImage,img_conf_.multi_output_red,colormode,img_conf_.is_duplex);
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
,img_conf_.multiOutput
,img_conf_.splitImage
,img_conf_.multi_output_red
@ -700,7 +700,7 @@ void hg_scanner_239::image_process(std::shared_ptr<std::vector<char>>& buff)
while (hg_imgproc::get_final_data(handle, &ih, &buf, index++) == SCANNER_ERR_OK && !user_cancel_)
{
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
if(!img_type_.empty())
@ -717,7 +717,7 @@ void hg_scanner_239::image_process(std::shared_ptr<std::vector<char>>& buff)
buf = bmpdata.data();
ih.total_bytes = bmpdata.size();
HG_VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
}
save_final_image(&ih, buf);
@ -743,7 +743,7 @@ int hg_scanner_239::get_device_paperon_stautus(void)
// ret = write_register(SR_CONFIG_SCAN_PARAM, dev_conf_.value);
// HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf_.value, hg_scanner::strerr((scanner_err)ret).c_str());
// VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf_.value, hg_scanner::strerr((scanner_err)ret).c_str());
// return ret;
// }
@ -757,7 +757,7 @@ int hg_scanner_239::writedown_device_configuration(HGSCANCONF *dev_conf)
ret = write_register(SR_CONFIG_SCAN_PARAM, dev_conf->value);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf->value, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf->value, hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
@ -834,7 +834,7 @@ else
ic.AutoCrop_threshold = threshold_;
if (test_1_paper_)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = ic.is_duplex ? 2 : 1;
}
else
@ -903,58 +903,58 @@ else
this_thread::sleep_for(chrono::milliseconds(500));
io_->set_timeout(2000);//必要延时
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write-down 0x%x bytes image process parameters\n", len);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%d\r\n ", ic.fillhole.fillholeratio);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r ", ic.cropRect.enable);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ", ic.cropRect.width);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ", ic.cropRect.height);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%f\r\n ", ic.cropRect.x);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write-down 0x%x bytes image process parameters\n", len);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%d\r\n ", ic.fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r ", ic.cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ", ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ", ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%f\r\n ", ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
img_conf_ = ic;
return ret;
@ -964,7 +964,7 @@ int hg_scanner_239::pop_first_image(void)
{
int ret = write_register(SR_IM_POP, 1);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
@ -1028,7 +1028,7 @@ int hg_scanner_239::read_one_image_from_usb(void)
}
if (ret == SCANNER_ERR_OK)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image from USB = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image from USB = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
ret = save_usb_data(buf);
if (ret == SCANNER_ERR_OK)
{
@ -1041,7 +1041,7 @@ int hg_scanner_239::read_one_image_from_usb(void)
{
char msg[128];
sprintf(msg, "Read image data from USB err: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
HG_LOG(LOG_LEVEL_DEBUG_INFO, msg);
LOG_INFO(LOG_LEVEL_DEBUG_INFO, msg);
notify_ui_working_status(msg);
notify_ui_working_status(STATU_DESC_SCANNER_ERR_TIMEOUT, SANE_EVENT_ERROR);
}
@ -1089,7 +1089,7 @@ void hg_scanner_239::discard_all_images(void)
io_->set_timeout(oto);
}
if (pre_int)
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "prev-connection has left %d interrupt packet(s) && %d image(s).\n", pre_int, pre_img);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "prev-connection has left %d interrupt packet(s) && %d image(s).\n", pre_int, pre_img);
}
void hg_scanner_239::init_setting_map(int* setting_map, int count)
@ -1429,7 +1429,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
if (size == sizeof(buf))
{
status_ = settings::device_status_to_hg_err(info);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status from interrupt point is '%s'\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status from interrupt point is '%s'\n", hg_scanner::strerr((scanner_err)status_).c_str());
if (status_ != SCANNER_ERR_OK && status_ != SCANNER_ERR_TIMEOUT && status_ != SCANNER_ERR_DEVICE_STOPPED)
{
@ -1450,7 +1450,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
}
status_ = st;
}
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "扫描失败, read interrupt返回状态为%s\n", hg_scanner::error_description((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "扫描失败, read interrupt返回状态为%s\n", hg_scanner::error_description((scanner_err)status_).c_str());
//notify_ui_working_status(("扫描失败 " + hg_scanner::error_description((scanner_err)status_)).c_str(), SANE_EVENT_ERROR, status_);
break;
}
@ -1474,16 +1474,16 @@ void hg_scanner_239::thread_handle_usb_read(void)
if (ret == SCANNER_ERR_INSUFFICIENT_MEMORY)
stop();
status_ = ret = SCANNER_ERR_USER_CANCELED;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner::strerr((scanner_err)status_).c_str());
break;
}
}
//else
// HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status(0x%x) is not accept in usb thread\n", status);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status(0x%x) is not accept in usb thread\n", status);
}
else if (info->From == STOPSCAN)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "received 'STOPSCAN' message in usb thread, check remaining image and finish scanning ...\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "received 'STOPSCAN' message in usb thread, check remaining image and finish scanning ...\n");
// fetch all buffered images and exit ...
while(!is_dev_image_process_done())
@ -1502,7 +1502,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
{
std::lock_guard<std::mutex> lock(io_lock_);
HG_LOG(LOG_LEVEL_DEBUG_INFO, "First message received from USB is 'STOPSCAN'\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "First message received from USB is 'STOPSCAN'\n");
// notify_ui_working_status(STATU_DESC_DEVICE_RESET);
// reset_ = true;
// ret = io_->reset();
@ -1512,31 +1512,31 @@ void hg_scanner_239::thread_handle_usb_read(void)
status_ = SCANNER_ERR_OK;
int s = get_status();
HG_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);
if (count || (s & 3) == 0)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "Really stopped ^_^\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "Really stopped ^_^\n");
break;
}
}
else if (info->From == V4L2)
{
HG_VLOG_MINI_2(LOG_LEVEL_WARNING, "V4L2 message received, code = %d, index = %d\n", info->Code, info->Img_Index);
VLOG_MINI_2(LOG_LEVEL_WARNING, "V4L2 message received, code = %d, index = %d\n", info->Code, info->Img_Index);
// stop();
break;
}
else
{
// error handling ...
HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Read HGEIntInfo: From = %d, Code = %d, Img_Index = %d, status = %s\n", info->From, info->Code, info->Img_Index, hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Read HGEIntInfo: From = %d, Code = %d, Img_Index = %d, status = %s\n", info->From, info->Code, info->Img_Index, hg_scanner::strerr((scanner_err)status_).c_str());
}
}
else
HG_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));
this_thread::sleep_for(chrono::milliseconds(10));
}
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner::strerr((scanner_err)ret).c_str(), hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner::strerr((scanner_err)ret).c_str(), hg_scanner::strerr((scanner_err)status_).c_str());
}
int hg_scanner_239::start(void)
@ -1553,7 +1553,7 @@ int hg_scanner_239::start(void)
user_cancel_ = false;
cb_mem_ = true;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "scanner status: 0x%x\n", get_status());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "scanner status: 0x%x\n", get_status());
notify_ui_working_status(STATU_DESC_PREPARE_START);
reset();
@ -1562,7 +1562,7 @@ int hg_scanner_239::start(void)
//if (val != 1)
//{
// status_ = SCANNER_ERR_DEVICE_SLEEPING;
// HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "scanner's status(0x%x) is considerring as sleepping.\n", val);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "scanner's status(0x%x) is considerring as sleepping.\n", val);
// return status_;
//}
@ -1593,7 +1593,7 @@ int hg_scanner_239::start(void)
if (ret)
{
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "Write down image process parameters fail is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "Write down image process parameters fail is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
std::string info(STATU_DESC_REWRITE_CONFIGURATION);
@ -1603,7 +1603,7 @@ int hg_scanner_239::start(void)
if (ret != SCANNER_ERR_OK)
{
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "start status01 is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status01 is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
ret = get_scanner_paperon();
@ -1611,17 +1611,17 @@ int hg_scanner_239::start(void)
{
status_ = ret;
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
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);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "start status02 is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status02 is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
io_->set_timeout(1000);
if (ret == SCANNER_ERR_OK)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write SC_START command success, and now scanner stauts is %x\n", get_status());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Write SC_START command success, and now scanner stauts is %x\n", get_status());
//status_ = SCANNER_ERR_DEVICE_BUSY;
wait_usb_.notify();
@ -1630,7 +1630,7 @@ int hg_scanner_239::start(void)
else
{
status_ = ret;
HG_VLOG_MINI_3(LOG_LEVEL_WARNING, "(%s)[Thread %s]Send start command = %s\n", hg_log::current_time().c_str(), hg_log::format_current_thread_id().c_str(), hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_WARNING, "(%s)[Thread %s]Send start command = %s\n", hg_log::current_time().c_str(), hg_log::format_current_thread_id().c_str(), hg_scanner::strerr((scanner_err)ret).c_str());
}
return ret;
@ -1663,7 +1663,7 @@ int hg_scanner_239::start(void)
// ii->lines = imh.height;
// }
// }
// HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner::strerr((scanner_err)ret).c_str());
// VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner::strerr((scanner_err)ret).c_str());
//
// return ret;
//}
@ -1686,7 +1686,7 @@ int hg_scanner_239::start(void)
// int fetch = *len;
//
// final_imgs_.fetch_front(buf, len);
// HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "[%s]UI fetch image 0x%x/0x%x to buf %s...\n", hg_log::format_current_thread_id().c_str(), *len, fetch
// VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "[%s]UI fetch image 0x%x/0x%x to buf %s...\n", hg_log::format_current_thread_id().c_str(), *len, fetch
// , hg_log::format_ptr(buf).c_str());
//
// return SCANNER_ERR_OK;
@ -1762,7 +1762,7 @@ int hg_scanner_239::get_roller_num(void)
return val;
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_roller_num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_roller_num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
}
@ -1826,7 +1826,7 @@ int hg_scanner_239::get_sleep_time(SANE_Power* getime)
*getime = (SANE_Power)val;
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
}
@ -1835,7 +1835,7 @@ int hg_scanner_239::set_sleep_time(int setsleepime)
{
int ret = write_register(SR_SET_SLEEPTIME, setsleepime);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "set sleep time to %d = %s\n", setsleepime, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "set sleep time to %d = %s\n", setsleepime, hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
@ -1873,7 +1873,7 @@ int hg_scanner_239::get_scanner_paperon(SANE_Bool* paperon)
}
else
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanner_paperon = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanner_paperon = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
return -1;
}
return ret;

View File

@ -1,5 +1,5 @@
#include "hg_scanner_300.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#ifdef WIN32
#include "scanner_manager.h"
@ -105,7 +105,7 @@ namespace settingsdsp_300
*r = true;
else
*r = false;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
paper = paper_map[ind].paper;
if (type)
*type = paper_map[ind].type;
@ -380,7 +380,7 @@ void hg_scanner_300::thread_handle_usb_read(void)
{
status_ = ret;
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
return ret;
}
ret = get_scanner_paperon();
@ -388,14 +388,14 @@ void hg_scanner_300::thread_handle_usb_read(void)
{
status_ = ret;
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
return ret;
}
USBCB usb = {START_COMMAND, img_conf_.scannum, 0};
ret = writeusb(usb);
io_->set_timeout(500);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
if(ret == SCANNER_ERR_OK)
{
@ -417,7 +417,7 @@ int hg_scanner_300::stop(void)
if (status_ == SCANNER_ERR_DEVICE_BUSY)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO,"stop status is busy\r\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO,"stop status is busy\r\n");
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
}
//user_cancel_ = true;
@ -552,10 +552,10 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
param.double_side = img_conf_.is_duplex;
param.dpi = img_conf_.resolution_dst;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.black_white :%d\r\n",param.black_white);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.channels :%d\r\n",param.channels);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.color_mode :%d\r\n",param.color_mode);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.double_side :%d\r\n",param.double_side);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.black_white :%d\r\n",param.black_white);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.channels :%d\r\n",param.channels);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.color_mode :%d\r\n",param.color_mode);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.double_side :%d\r\n",param.double_side);
@ -570,10 +570,10 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
// if (img_conf_.en_sizecheck)
// {
// HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"img_conf_.en_sizecheck :%d\r\n",img_conf_.en_sizecheck);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"img_conf_.en_sizecheck :%d\r\n",img_conf_.en_sizecheck);
// printf("img_conf_.en_sizecheck = %d\r\n",img_conf_.en_sizecheck);
// ret = hg_imgproc::size_detection(handle);
// HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"img_conf_.en_sizecheck ret:%d\r\n",ret);
// VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"img_conf_.en_sizecheck ret:%d\r\n",ret);
// if (ret == SCANNER_ERR_DEVICE_SIZE_CHECK)
// {
@ -726,7 +726,7 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
colormode=img_conf_.pixtype;
err = hg_imgproc::split(handle,img_conf_.multiOutput,img_conf_.splitImage,img_conf_.multi_output_red,colormode,img_conf_.is_duplex);
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
,img_conf_.multiOutput
,img_conf_.splitImage
,img_conf_.multi_output_red
@ -758,7 +758,7 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
hg_imgproc::final(handle);
while (hg_imgproc::get_final_data(handle, &ih, &buf, index++) == SCANNER_ERR_OK && !user_cancel_)
{
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
if(!img_type_.empty())
@ -774,7 +774,7 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
buf = bmpdata.data();
ih.total_bytes = bmpdata.size();
HG_VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
}
save_final_image(&ih, buf);
@ -798,7 +798,7 @@ int hg_scanner_300::writedown_device_configuration(bool type,HGSCANCONF_G400 *d)
len = sizeof(USBCB);
ret = io_->write_bulk(&usbcb,&len);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
@ -998,7 +998,7 @@ else
ic.AutoCrop_threshold = threshold_;
if (test_1_paper_)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = 1;
}
else
@ -1069,56 +1069,56 @@ else
return ;
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.multi_output_red=%d", ic.multi_output_red);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.multi_output_red=%d", ic.multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
}
void hg_scanner_300::printf_devconfig(HGSCANCONF_G400 *d)
@ -1127,18 +1127,18 @@ void hg_scanner_300::printf_devconfig(HGSCANCONF_G400 *d)
if (!d)
d = &dsp_config;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params.doubleFeeded:%d\r\n",d->params.doubleFeeded);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dpi:%d\r\n",d->params.dpi);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dstHeight:%d\r\n",d->params.dstHeight);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableLed:%d\r\n",d->params.enableLed);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableUV:%d\r\n",d->params.enableUV);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isColor:%d\r\n",d->params.isColor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isCorrect:%d\r\n",d->params.isCorrect);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.pageSize:%d\r\n",d->params.pageSize);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed1:%d\r\n",d->params.reversed1);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed2:%d\r\n",d->params.reversed2);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.sizedetece:%d\r\n",d->params.sizedetece);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.value:%d\r\n",d->value);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params.doubleFeeded:%d\r\n",d->params.doubleFeeded);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dpi:%d\r\n",d->params.dpi);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dstHeight:%d\r\n",d->params.dstHeight);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableLed:%d\r\n",d->params.enableLed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableUV:%d\r\n",d->params.enableUV);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isColor:%d\r\n",d->params.isColor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isCorrect:%d\r\n",d->params.isCorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.pageSize:%d\r\n",d->params.pageSize);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed1:%d\r\n",d->params.reversed1);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed2:%d\r\n",d->params.reversed2);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.sizedetece:%d\r\n",d->params.sizedetece);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.value:%d\r\n",d->value);
}
std::string hg_scanner_300::get_firmware_version()

View File

@ -10,7 +10,7 @@
#include <algorithm>
#include "hg_scanner.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include "PaperSize.h"
#ifdef OEM_HANWANG

View File

@ -1,5 +1,5 @@
#include "hg_scanner_400.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#ifdef WIN32
#include "scanner_manager.h"
@ -106,7 +106,7 @@ namespace settingsdsp_400
*r = true;
else
*r = false;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Paper '%s' index = %d, device value = %d\n", paper_string(paper).c_str(), ind, paper_map[ind].dev_value);
paper = paper_map[ind].paper;
if (type)
*type = paper_map[ind].type;
@ -377,7 +377,7 @@ int hg_scanner_400::start(void)
{
status_ = ret;
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
return ret;
}
ret = get_scanner_paperon();
@ -385,14 +385,14 @@ int hg_scanner_400::start(void)
{
status_ = ret;
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
return ret;
}
USBCB usb = {START_COMMAND, img_conf_.scannum, 0};
ret = writeusb(usb);
io_->set_timeout(1000);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
if(ret == SCANNER_ERR_OK)
{
@ -414,14 +414,14 @@ int hg_scanner_400::stop(void)
if (status_ == SCANNER_ERR_DEVICE_BUSY)
{
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "stop !but device is busy ,so sleep 2s(%s)\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "stop !but device is busy ,so sleep 2s(%s)\n", hg_scanner::strerr((scanner_err)status_).c_str());
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
}
user_cancel_ = true;
if (ret == SCANNER_ERR_OK)
{
status_ = SCANNER_ERR_DEVICE_STOPPED;
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "stop device:(%s)\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "stop device:(%s)\n", hg_scanner::strerr((scanner_err)status_).c_str());
}
notify_ui_working_status("取消扫描", SANE_EVENT_STATUS, status_);
final_imgs_.Clear();
@ -550,11 +550,11 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
param.double_side = img_conf_.is_duplex;
param.dpi = img_conf_.resolution_dst;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.black_white :%d\r\n",param.black_white);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.channels :%d\r\n",param.channels);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.color_mode :%d\r\n",param.color_mode);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.double_side :%d\r\n",param.double_side);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.dpi :%d\r\n",param.dpi);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.black_white :%d\r\n",param.black_white);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.channels :%d\r\n",param.channels);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.color_mode :%d\r\n",param.color_mode);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.double_side :%d\r\n",param.double_side);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"param.dpi :%d\r\n",param.dpi);
handle = hg_imgproc::init(&img_conf_,&param,pid_);
@ -565,7 +565,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
ret = hg_imgproc::fillhole(handle);
//printf("填穿孔开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "填穿孔开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "填穿孔开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
/////////////////////////////////////111111111111111111111111111//////////////////////////////////
@ -575,32 +575,32 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
ret = hg_imgproc::discardBlank(handle);
printf("丢弃空白页开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "丢弃空白页开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "丢弃空白页开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if(img_conf_.fadeback)
{
hg_imgproc::fadeback(handle,img_conf_.fadebackrange,param.double_side);
//printf("背景除色开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "背景除色开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "背景除色开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.resolution_dst != img_conf_.resolution_native)
{
hg_imgproc::resolution_change(handle);
//printf("dpi改变开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "dpi改变开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "dpi改变开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.cropRect.enable && !img_conf_.is_autocrop)
{
hg_imgproc::croprect(handle);
//printf("手动裁图开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "手动裁图开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "手动裁图开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.filter != ColorFilter::FILTER_NONE && (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY))
{
printf("除色开启\r\n");
hg_imgproc::channel(handle);
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
/////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]);
@ -644,7 +644,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
hg_imgproc::answerSheetFilterRed(handle);
//printf("答题卡出红开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "答题卡出红开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "答题卡出红开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.refuseInflow)
{
@ -667,7 +667,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
hg_imgproc::colorCorrection(handle);
//printf("颜色校正开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色校正开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色校正开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if ((img_conf_.imageRotateDegree != TEXT_DIRECTION_0 || img_conf_.is_backrotate180) && (!img_conf_.is_autotext))
{
@ -678,25 +678,25 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
hg_imgproc::textureRemove(handle);
//printf("除摩尔纹开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除摩尔纹开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除摩尔纹开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.detachnoise.is_detachnoise)
{
hg_imgproc::nosieDetach(handle);
//printf("噪点优化开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "噪点优化开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "噪点优化开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE)
{
hg_imgproc::errorextention(handle);
//printf("黑白图处理开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "黑白图处理开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "黑白图处理开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.en_fold)
{
hg_imgproc::fold(handle);
//printf("对折开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "对折开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "对折开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
///////////////////////////////////
@ -705,7 +705,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
err = hg_imgproc::multi_out_red(handle);
//printf("多流出红开启\r\n");
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "多流出红开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "多流出红开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (img_conf_.sharpen)
@ -720,7 +720,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
colormode=img_conf_.pixtype;
err = hg_imgproc::split(handle,img_conf_.multiOutput,img_conf_.splitImage,img_conf_.multi_output_red,colormode,img_conf_.is_duplex);
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
,img_conf_.multiOutput
,img_conf_.splitImage
,img_conf_.multi_output_red
@ -728,7 +728,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
,img_conf_.is_duplex);
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "图像拆分开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "图像拆分开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
if (!image_prc_param_.bits.split || !image_prc_param_.bits.rid_red || !image_prc_param_.bits.multi_out)
@ -736,7 +736,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
if(img_conf_.automaticcolor)
{
ret = hg_imgproc::auto_matic_color(handle,img_conf_.automaticcolortype);
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色自动识别模式开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色自动识别模式开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
}
}
if (img_conf_.is_autotext)
@ -754,7 +754,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
hg_imgproc::final(handle);
while (hg_imgproc::get_final_data(handle, &ih, &buf, index++) == SCANNER_ERR_OK)
{
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
if(!img_type_.empty())
@ -771,7 +771,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
buf = bmpdata.data();
ih.total_bytes = bmpdata.size();
HG_VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
}
@ -796,7 +796,7 @@ int hg_scanner_400::writedown_device_configuration(bool type,HGSCANCONF_G400 *d)
len = sizeof(USBCB);
ret = io_->write_bulk(&usbcb,&len);
HG_VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
return ret;
}
@ -1005,7 +1005,7 @@ void hg_scanner_400::writedown_image_configuration(void)
ic.AutoCrop_threshold = threshold_;
if (test_1_paper_)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
ic.scannum = 1;
}
else
@ -1083,59 +1083,59 @@ void hg_scanner_400::writedown_image_configuration(void)
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.isfillcolor=%d", ic.isfillcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.isfillcolor=%d", ic.isfillcolor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r ", ic.cropRect.enable);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ", ic.cropRect.width);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ", ic.cropRect.height);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%f\r\n ", ic.cropRect.x);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r ", ic.cropRect.enable);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ", ic.cropRect.width);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ", ic.cropRect.height);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%f\r\n ", ic.cropRect.x);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
}
@ -1144,18 +1144,18 @@ void hg_scanner_400::printf_devconfig(HGSCANCONF_G400 *d)
if (!d)
d = &dsp_config;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params.doubleFeeded:%d\r\n",d->params.doubleFeeded);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dpi:%d\r\n",d->params.dpi);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dstHeight:%d\r\n",d->params.dstHeight);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableLed:%d\r\n",d->params.enableLed);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableUV:%d\r\n",d->params.enableUV);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isColor:%d\r\n",d->params.isColor);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isCorrect:%d\r\n",d->params.isCorrect);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.pageSize:%d\r\n",d->params.pageSize);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed1:%d\r\n",d->params.reversed1);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed2:%d\r\n",d->params.reversed2);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.sizedetece:%d\r\n",d->params.sizedetece);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.value:%d\r\n",d->value);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params.doubleFeeded:%d\r\n",d->params.doubleFeeded);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dpi:%d\r\n",d->params.dpi);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.dstHeight:%d\r\n",d->params.dstHeight);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableLed:%d\r\n",d->params.enableLed);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.enableUV:%d\r\n",d->params.enableUV);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isColor:%d\r\n",d->params.isColor);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.isCorrect:%d\r\n",d->params.isCorrect);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.pageSize:%d\r\n",d->params.pageSize);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed1:%d\r\n",d->params.reversed1);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.reversed2:%d\r\n",d->params.reversed2);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.sizedetece:%d\r\n",d->params.sizedetece);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config.params.value:%d\r\n",d->value);
}
std::string hg_scanner_400::get_firmware_version()
@ -1185,7 +1185,7 @@ std::string hg_scanner_400::get_firmware_version()
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->read_bulk(buf, &len);
}
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get serial num = %s, serial num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str(), buf);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get serial num = %s, serial num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str(), buf);
return buf;
}

View File

@ -10,7 +10,7 @@
#include <algorithm>
#include "hg_scanner.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include "PaperSize.h"

View File

@ -1,5 +1,5 @@
#include "image_process.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include <vector>
#include <string.h>
@ -164,7 +164,7 @@ namespace hg_imgproc
//("/home/huagao/Desktop/1.jpg",mat);
if (mat.empty())
{
HG_LOG(LOG_LEVEL_FATAL, "decode image data error\n");
LOG_INFO(LOG_LEVEL_FATAL, "decode image data error\n");
continue;
}
if(pid == 0x100 || pid == 0x200 || pid == 0x139 || pid == 0x239)
@ -195,11 +195,11 @@ namespace hg_imgproc
}
catch (const std::exception& e)
{
HG_LOG(LOG_LEVEL_FATAL, e.what());
LOG_INFO(LOG_LEVEL_FATAL, e.what());
}
}
buffs.clear();
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size());
if(mats_.size() == 0)
{
return SCANNER_ERR_NO_DATA;

View File

@ -1,5 +1,5 @@
#include "scanner_manager.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include <iostream>
#include <string.h>
#include "raw_src.h"
@ -98,7 +98,7 @@ hg_scanner_mgr* hg_scanner_mgr::instance(sane_callback cb)
if (cb)
hg_scanner_mgr::async_io_enabled_ = cb(NULL, SANE_EVENT_SUPPORT_ASYNC_IO, NULL, NULL, NULL) == 0;
hg_scanner_mgr::inst_ = new hg_scanner_mgr();
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "async image transferring is %s\n", hg_scanner_mgr::async_io_enabled_ ? "enabled" : "disabled");
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "async image transferring is %s\n", hg_scanner_mgr::async_io_enabled_ ? "enabled" : "disabled");
}
return hg_scanner_mgr::inst_;
@ -156,7 +156,7 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
{
if (g_supporting_devices[i].vid == vid && g_supporting_devices[i].pid == pid)
{
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s connected.\n", g_supporting_devices[i].name.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s connected.\n", g_supporting_devices[i].name.c_str());
index = i;
ev_ui = SANE_EVENT_DEVICE_ARRIVED;
de.name = g_supporting_devices[i].name.c_str();
@ -190,7 +190,7 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
len = usb_manager::instance()->open(device, &io);
if (len == SCANNER_ERR_OK)
{
HG_VLOG_MINI_3(LOG_LEVEL_WARNING, "[%04x:%04x]%s re-connected.\n", pid, vid, online_devices_[i].display_name.c_str());
VLOG_MINI_3(LOG_LEVEL_WARNING, "[%04x:%04x]%s re-connected.\n", pid, vid, online_devices_[i].display_name.c_str());
online_devices_[i].scanner->reset_io(io);
de.openned = SANE_TRUE;
}
@ -231,7 +231,7 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
name = it->display_name;
type = g_supporting_devices[it->ind].type;
h = it->scanner;
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s Dis-connected.\n", name.c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s Dis-connected.\n", name.c_str());
if (it->scanner)
it->scanner->io_disconnected();
else

View File

@ -1,5 +1,5 @@
#include "usb_manager.h"
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include <iostream>
#include "hg_scanner.h" // for hg_scanner::strerr
@ -33,7 +33,7 @@ usb_manager::usb_manager() : run_(true)
int ret = libusb_init(&context_);
// libusb_set_log_cb(context_, &usb_manager::usb_log_callback, LIBUSB_LOG_CB_CONTEXT); // LIBUSB_API_VERSION >= 0x01000107
HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "usb_manager(%s) libusb_init(%s) = %s, context = %s\n", hg_log::format_ptr(this).c_str(), hg_log::format_ptr(&context_).c_str(), libusb_error_name(ret), hg_log::format_ptr(context_).c_str());
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "usb_manager(%s) libusb_init(%s) = %s, context = %s\n", hg_log::format_ptr(this).c_str(), hg_log::format_ptr(&context_).c_str(), libusb_error_name(ret), hg_log::format_ptr(context_).c_str());
if (ret)
status_ = SCANNER_ERR_USB_INIT_FAILED;
@ -66,7 +66,7 @@ usb_manager::~usb_manager()
usb_notify_thread_.reset();
}
libusb_exit(context_);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "usb_manager(%s) destroying and free context(%s)\n", hg_log::format_ptr(this).c_str(), hg_log::format_ptr(context_).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "usb_manager(%s) destroying and free context(%s)\n", hg_log::format_ptr(this).c_str(), hg_log::format_ptr(context_).c_str());
}
int LIBUSB_CALL usb_manager::usb_pnp_callback(libusb_context* ctx, libusb_device* device, libusb_hotplug_event event, void* monitor)
@ -89,11 +89,11 @@ void usb_manager::usb_log_callback(libusb_context* ctx, libusb_log_level level,
// used when LIBUSB_API_VERSION >= 0x01000107
if (level == LIBUSB_LOG_LEVEL_NONE || LIBUSB_LOG_LEVEL_INFO || LIBUSB_LOG_LEVEL_DEBUG)
{
HG_LOG(LOG_LEVEL_DEBUG_INFO, str);
LOG_INFO(LOG_LEVEL_DEBUG_INFO, str);
}
else
{
HG_LOG(LOG_LEVEL_FATAL, str);
LOG_INFO(LOG_LEVEL_FATAL, str);
}
}
@ -114,7 +114,7 @@ int usb_manager::register_usb_pnp(void)
if (ret != LIBUSB_SUCCESS)
{
HG_LOG(LOG_LEVEL_FATAL, (std::string("regist usbhotplug callback error msg: ") + libusb_error_name(ret) + "\n").c_str());
LOG_INFO(LOG_LEVEL_FATAL, (std::string("regist usbhotplug callback error msg: ") + libusb_error_name(ret) + "\n").c_str());
usb_cb_handle_ = NULL;
status_ = SCANNER_ERR_USB_REGISTER_PNP_FAILED;
}
@ -230,7 +230,7 @@ void usb_manager::notify_usb_event(PNPDEV& pd, bool* retry)
sprintf(buf, "0x%x", pd.event);
evstr = buf;
}
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "USB%u.%x of pid:vid(%x:%x) event(%s) received.\n"
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "USB%u.%x of pid:vid(%x:%x) event(%s) received.\n"
, HIBYTE(ud.ver), LOBYTE(ud.ver) / 0x10, ud.pid, ud.vid, evstr.c_str());
if (ev != USB_EVENT_NULL)
{
@ -265,7 +265,7 @@ void usb_manager::thread_trigger_usb_event()
{
// ^_^
devices.clear();
HG_LOG(LOG_LEVEL_DEBUG_INFO, "register_usb_pnp success ^_^\n");
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "register_usb_pnp success ^_^\n");
break;
}
}
@ -277,7 +277,7 @@ void usb_manager::thread_trigger_usb_event()
timeval tm={1,0};
int ret=libusb_handle_events_timeout(context_, &tm);
if(ret < 0)
HG_LOG(LOG_LEVEL_FATAL, (std::string("libusb_handle_events_timeout error ") + libusb_error_name(ret) + "\n").c_str());
LOG_INFO(LOG_LEVEL_FATAL, (std::string("libusb_handle_events_timeout error ") + libusb_error_name(ret) + "\n").c_str());
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
@ -422,7 +422,7 @@ void usb_manager::enum_endpoints(libusb_device* device, USBTRANSENDP* endp)
if (ret != 0)
{
HG_LOG(LOG_LEVEL_WARNING, (std::string("Get device descriptor of device(") + dev + ") failed.\n").c_str());
LOG_INFO(LOG_LEVEL_WARNING, (std::string("Get device descriptor of device(") + dev + ") failed.\n").c_str());
return;
}
@ -436,26 +436,26 @@ void usb_manager::enum_endpoints(libusb_device* device, USBTRANSENDP* endp)
usb_manager::init_endpoint(&endp->isochronous);
}
else
hg_log::vlog(LOG_LEVEL_DEBUG_INFO, " +Device(%s) has %u configurations ...\n", dev.c_str(), desc.bNumConfigurations);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, " +Device(%s) has %u configurations ...\n", dev.c_str(), desc.bNumConfigurations);
for (int i = 0; i < (int)desc.bNumConfigurations; ++i)
{
ret = libusb_get_config_descriptor(device, i, &conf);
if (ret != 0)
{
if (!endp)
hg_log::vlog(LOG_LEVEL_DEBUG_INFO, " Get %d configuration failed.\n", i + 1);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " Get %d configuration failed.\n", i + 1);
continue;
}
if (!endp)
hg_log::vlog(LOG_LEVEL_DEBUG_INFO, " Configuration %d has %d interfaces\n", i + 1, conf->bNumInterfaces);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, " Configuration %d has %d interfaces\n", i + 1, conf->bNumInterfaces);
for (int j = 0; j < conf->bNumInterfaces; ++j)
{
if (!endp)
hg_log::vlog(LOG_LEVEL_DEBUG_INFO, " Interface %d has %d alt-settings\n", j + 1, conf->interface[j].num_altsetting);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, " Interface %d has %d alt-settings\n", j + 1, conf->interface[j].num_altsetting);
for (int k = 0; k < conf->interface[j].num_altsetting; ++k)
{
if (!endp)
hg_log::vlog(LOG_LEVEL_DEBUG_INFO, " Setting %d: %d - %s has %d endpoints\n", k + 1, conf->interface[j].altsetting[k].bInterfaceNumber
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, " Setting %d: %d - %s has %d endpoints\n", k + 1, conf->interface[j].altsetting[k].bInterfaceNumber
, usb_manager::device_class((libusb_class_code)conf->interface[j].altsetting[k].bInterfaceClass).c_str()
, conf->interface[j].altsetting[k].bNumEndpoints);
for (int l = 0; l < conf->interface[j].altsetting[k].bNumEndpoints; ++l)
@ -466,27 +466,27 @@ void usb_manager::enum_endpoints(libusb_device* device, USBTRANSENDP* endp)
if (conf->interface[j].altsetting[k].endpoint[l].bmAttributes == LIBUSB_TRANSFER_TYPE_CONTROL)
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of control\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of control\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
ep = &endp->control;
}
else if (conf->interface[j].altsetting[k].endpoint[l].bmAttributes == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS)
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of isochronous\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of isochronous\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
ep = &endp->isochronous;
}
if (conf->interface[j].altsetting[k].endpoint[l].bmAttributes == LIBUSB_TRANSFER_TYPE_BULK)
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of bulk\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of bulk\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
ep = &endp->bulk;
}
if (conf->interface[j].altsetting[k].endpoint[l].bmAttributes == LIBUSB_TRANSFER_TYPE_INTERRUPT)
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of interrupt\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of interrupt\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
ep = &endp->interrupt;
}
if (conf->interface[j].altsetting[k].endpoint[l].bmAttributes == LIBUSB_TRANSFER_TYPE_BULK_STREAM)
{
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of bulk-stream\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Found endpoint(%x) for device(VID: %x, PID: %x) of bulk-stream\n", conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress, desc.idVendor, desc.idProduct);
ep = &endp->bulk_stream;
}
if (ep)
@ -505,14 +505,14 @@ void usb_manager::enum_endpoints(libusb_device* device, USBTRANSENDP* endp)
s->iface = j;
s->claimed = 0;
s->max_packet = conf->interface[j].altsetting[k].endpoint[l].wMaxPacketSize;
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, " Endpoint address = 0x%02x, origin = 0x%02x, max packet: 0x%x\n", s->port, conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, " Endpoint address = 0x%02x, origin = 0x%02x, max packet: 0x%x\n", s->port, conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress
, s->max_packet);
}
found_ep = true;
}
}
else
HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, " Endpoint %d(%s) address: %x, Max packet: 0x%x bytes\n", l + 1
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, " Endpoint %d(%s) address: %x, Max packet: 0x%x bytes\n", l + 1
, usb_manager::endpoint_type((libusb_transfer_type)conf->interface[j].altsetting[k].endpoint[l].bmAttributes).c_str()
, conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress
, conf->interface[j].altsetting[k].endpoint[l].wMaxPacketSize);
@ -523,7 +523,7 @@ void usb_manager::enum_endpoints(libusb_device* device, USBTRANSENDP* endp)
}
if (endp && !found_ep)
HG_VLOG_MINI_2(LOG_LEVEL_FATAL, "No endpoint has been found on device (VID: %x, PID: %x)\n", desc.idVendor, desc.idProduct);
VLOG_MINI_2(LOG_LEVEL_FATAL, "No endpoint has been found on device (VID: %x, PID: %x)\n", desc.idVendor, desc.idProduct);
}
int usb_manager::register_hotplug(usb_event_handler cb, void* user)
@ -562,7 +562,7 @@ int usb_manager::open(libusb_device* device, usb_io** usbio, std::string* msg)
if (msg)
*msg = usb->init_error_msg();
usb->release();
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Open %04x:%04x failed: %s\n", dev.vid, dev.pid, hg_scanner::strerr((scanner_err)err).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Open %04x:%04x failed: %s\n", dev.vid, dev.pid, hg_scanner::strerr((scanner_err)err).c_str());
return err;
}
@ -654,34 +654,34 @@ bool usb_io::claim_interterface(usb_manager::USBSIMPLEX* spl)
return true;
}
HG_VLOG_MINI_2(LOG_LEVEL_FATAL, " first libusb_claim_interface(%d) = %s\n", spl->iface, libusb_error_name(ret));
VLOG_MINI_2(LOG_LEVEL_FATAL, " first libusb_claim_interface(%d) = %s\n", spl->iface, libusb_error_name(ret));
ret = libusb_kernel_driver_active(handle_, spl->iface);
if (ret == 1)
{
ret = libusb_detach_kernel_driver(handle_, spl->iface);
HG_VLOG_MINI_2(LOG_LEVEL_FATAL, " libusb_detach_kernel_driver(%d) = %s\n", spl->iface, libusb_error_name(ret));
VLOG_MINI_2(LOG_LEVEL_FATAL, " libusb_detach_kernel_driver(%d) = %s\n", spl->iface, libusb_error_name(ret));
}
else if (ret == LIBUSB_ERROR_NO_DEVICE)
{
last_err_ = SCANNER_ERR_DEVICE_NOT_FOUND;
HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "device(%s) maybe left when libusb_kernel_driver_active.\n", hg_log::format_ptr(dev_info_.device).c_str());
VLOG_MINI_1(LOG_LEVEL_FATAL, "device(%s) maybe left when libusb_kernel_driver_active.\n", hg_log::format_ptr(dev_info_.device).c_str());
return false;
}
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_clear_halt(%x) ...\n", spl->port);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_clear_halt(%x) ...\n", spl->port);
libusb_clear_halt(handle_, spl->port);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_release_interface(%u) ...\n", spl->iface);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_release_interface(%u) ...\n", spl->iface);
libusb_release_interface(handle_, spl->iface);
HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_set_configuration(%u) ...\n", spl->iconf);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_set_configuration(%u) ...\n", spl->iconf);
libusb_set_configuration(handle_, spl->iconf);
//ret = libusb_reset_device(handle_);
//HG_VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_reset_device = %s\n", libusb_error_name(ret));
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, " libusb_reset_device = %s\n", libusb_error_name(ret));
//if (ret == LIBUSB_ERROR_NOT_FOUND)
//{
// last_err_ = usb_manager::usb_error_2_hg_err(ret);
// HG_VLOG_MINI_1(LOG_LEVEL_FATAL, "device(%s) maybe left when libusb_reset_device.\n", hg_log::format_ptr(dev_info_.device).c_str());
// VLOG_MINI_1(LOG_LEVEL_FATAL, "device(%s) maybe left when libusb_reset_device.\n", hg_log::format_ptr(dev_info_.device).c_str());
//
// return false;
//}
@ -694,7 +694,7 @@ bool usb_io::claim_interterface(usb_manager::USBSIMPLEX* spl)
return true;
}
HG_VLOG_MINI_2(LOG_LEVEL_FATAL, "second try libusb_claim_interface(%d) = %s\n", spl->iface, libusb_error_name(ret));
VLOG_MINI_2(LOG_LEVEL_FATAL, "second try libusb_claim_interface(%d) = %s\n", spl->iface, libusb_error_name(ret));
last_err_ = SCANNER_ERR_USB_CLAIM_INTERFACE_FAILED;
return false;
@ -715,7 +715,7 @@ int usb_io::claim_interfaces(bool claim)
break;
claimed.push_back(eps[i]->in.iface);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "claimed %s interface %d\n", usb_manager::endpoint_type((libusb_transfer_type)i).c_str(), eps[i]->in.iface);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "claimed %s interface %d\n", usb_manager::endpoint_type((libusb_transfer_type)i).c_str(), eps[i]->in.iface);
}
if (eps[i]->out.port != usb_manager::uninit_uint8 && eps[i]->out.iface != eps[i]->in.iface
&& std::find(claimed.begin(), claimed.end(), eps[i]->out.iface) == claimed.end())
@ -723,7 +723,7 @@ int usb_io::claim_interfaces(bool claim)
if (!claim_interterface(&eps[i]->out))
break;
claimed.push_back(eps[i]->out.iface);
HG_VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "claimed %s interface %d\n", usb_manager::endpoint_type((libusb_transfer_type)i).c_str(), eps[i]->out.iface);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "claimed %s interface %d\n", usb_manager::endpoint_type((libusb_transfer_type)i).c_str(), eps[i]->out.iface);
}
}
}
@ -764,7 +764,7 @@ void usb_io::open(void)
ref_device_ = libusb_ref_device(dev_info_.device);
int ret = libusb_open(dev_info_.device, &handle_);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "call libusb_open(%s, %s) = %s\n", hg_log::format_ptr(dev_info_.device).c_str()
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "call libusb_open(%s, %s) = %s\n", hg_log::format_ptr(dev_info_.device).c_str()
, hg_log::format_ptr(handle_).c_str(), libusb_error_name(ret));
if (ret == LIBUSB_SUCCESS)
{
@ -780,7 +780,7 @@ void usb_io::open(void)
return;
}
last_err_ = usb_manager::usb_error_2_hg_err(ret);
HG_VLOG_MINI_4(LOG_LEVEL_FATAL, "Open USB%u.%u-%s failed: %s\n", HIBYTE(dev_info_.ver), LOBYTE(dev_info_.ver) / 0x10, hg_log::format_ptr(dev_info_.device).c_str(), libusb_error_name(ret));
VLOG_MINI_4(LOG_LEVEL_FATAL, "Open USB%u.%u-%s failed: %s\n", HIBYTE(dev_info_.ver), LOBYTE(dev_info_.ver) / 0x10, hg_log::format_ptr(dev_info_.device).c_str(), libusb_error_name(ret));
init_err_msg_ = hg_scanner::error_description((scanner_err)last_err_);
handle_ = NULL;
}
@ -793,7 +793,7 @@ bool usb_io::on_io_error(scanner_err err, usb_manager::USBSIMPLEX* endp)
if (err == SCANNER_ERR_TIMEOUT)
{
//因为在发送img参数出现timeout暂时禁用
// //HG_LOG(LOG_LEVEL_DEBUG_INFO, "Operation timeout\n");
// //LOG_INFO(LOG_LEVEL_DEBUG_INFO, "Operation timeout\n");
// libusb_clear_halt(handle_, endp->port);
// return libusb_reset_device(handle_) == LIBUSB_SUCCESS;
@ -856,7 +856,7 @@ int usb_io::control_io(uint8_t type, uint8_t req, uint16_t val, uint16_t ind, vo
return last_err_;
}
}
HG_VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "libusb_control_transfer(%x, %x, %d, %d) = %s\n", type, req, val, ind, libusb_error_name(ret));
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "libusb_control_transfer(%x, %x, %d, %d) = %s\n", type, req, val, ind, libusb_error_name(ret));
last_err_ = usb_manager::usb_error_2_hg_err(ret);
}
@ -892,7 +892,7 @@ int usb_io::read_bulk(void* buf, int* len)
if (err)
{
HG_VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "libusb_bulk_transfer(%x, %d/%d) = %s\n", endpoints_.bulk.in.port, *len, total, libusb_error_name(err));
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "libusb_bulk_transfer(%x, %d/%d) = %s\n", endpoints_.bulk.in.port, *len, total, libusb_error_name(err));
}
return last_err_;
@ -918,7 +918,7 @@ int usb_io::write_bulk(void* buf, int* len)
err = usb_manager::usb_error_2_hg_err(libusb_bulk_transfer(handle_, endpoints_.bulk.out.port, data, *len, &t, to_));
//HG_VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner::strerr((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
//VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner::strerr((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
// printf("First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner::strerr((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
if (!on_io_error((scanner_err)err, &endpoints_.bulk.out))
{
@ -937,7 +937,7 @@ int usb_io::write_bulk(void* buf, int* len)
err = usb_manager::usb_error_2_hg_err(libusb_bulk_transfer(handle_, endpoints_.bulk.out.port, data, *len - total, &t, to_));
total += t;
}
//HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Last write bulk %d/%d = %s\n", total, *len, hg_scanner::strerr((scanner_err)err).c_str());
//VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Last write bulk %d/%d = %s\n", total, *len, hg_scanner::strerr((scanner_err)err).c_str());
*len = total;
last_err_ = err;

View File

@ -1,6 +1,7 @@
project(hgdriver)
string(TIMESTAMP CURRENT_YEAR "%Y")
string(TIMESTAMP MONTHDAY "1%m%d1")
add_definitions(-DBACKEND_NAME=hgdriver)
add_definitions(-DVERSION_MAJOR=ver_1)
add_definitions(-DVERSION_MINOR=ver_2)
add_definitions(-DVERSION_YEAR=${CURRENT_YEAR})

View File

@ -6,14 +6,21 @@
#include <stdarg.h>
#ifdef WIN32
#include <Windows.h>
#include <direct.h>
#define MKDIR(a, b) mkdir(a)
#else
#define MKDIR(a, b) mkdir(a, b)
#include <pthread.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#endif
#include <time.h>
#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include <algorithm>
#include "ini_file.h"
#define MAX_LOG_FILE_SIZE 100 * 1024 * 1024
#ifdef _INTSIZEOF
@ -21,6 +28,9 @@
#define _INTSIZEOF(n) ((sizeof(n) + sizeof(long) - 1) & ~(sizeof(long) - 1))
#endif
#ifdef WIN32
extern std::string g_module_path; // Ending with '\\'
#endif
class log_cls
{
@ -161,16 +171,6 @@ extern "C"
return format_ptr((void*)pthread_self());
#endif
}
int init(hg_log_type type, hg_log_level level, char* log_file)
{
if (type == LOG_TYPE_CALLBACK)
lcb_ = (log_callback)log_file;
else
lcb_ = NULL;
log_cls::instance()->set_log_level(level);
return log_cls::instance()->set_log_type(type, log_file);
}
std::string current_time(void)
{
char buf[40];
@ -188,7 +188,7 @@ extern "C"
if (size > 1024 * 1024 * 1024)
{
double d = size;
d /= 1024 * 1024 * 1024;
sprintf(buf, "%.2fGB", d);
}
@ -285,42 +285,202 @@ extern "C"
return si.freeram * si.mem_unit;
#endif
}
static void str_tolower(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), tolower);
}
void log(hg_log_level level, const char* info)
#ifndef WIN32
typedef struct _find_file
{
std::string pattern;
std::string found;
}FINDFILE, * LPFF;
static std::string link_file(const char* lnk)
{
char path[256] = { 0 };
int len = readlink(lnk, path, sizeof(path) - 1);
return path;
}
static int enum_files(const char* dir, bool recursive, bool(*found_file)(const char* path_file, void* param), void* param)
{
int ret = 0;
DIR* pdir = nullptr;
struct dirent* ent = nullptr;
pdir = opendir(dir);
if (!pdir)
return errno;
while ((ent = readdir(pdir)))
{
if (ent->d_type & DT_DIR)
{
if (recursive)
{
if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, ".."))
{
std::string sub(dir);
sub += "/";
sub += ent->d_name;
ret = enum_files(sub.c_str(), recursive, found_file, param);
if (ret == 0x5e17)
break;
}
}
}
else
{
std::string file(dir);
file += "/";
file += ent->d_name;
if (!found_file(link_file(file.c_str()).c_str(), param))
{
ret = 0x5e17;
break;
}
}
}
return ret;
}
static bool on_found(const char* file, void* param)
{
LPFF lpff = (LPFF)param;
const char* name = strrchr(file, '/');
if (name++ == nullptr)
name = file;
std::string lc(name);
str_tolower(lc);
if (lc.find(lpff->pattern) != std::string::npos)
{
lpff->found = file;
return false;
}
return true;
}
#endif
static std::string get_self_path(void)
{
#ifdef WIN32
return g_module_path;
#else
char path[128] = { 0 };
FINDFILE ff;
size_t pos = 0;
ff.pattern = GET_BACKEND_NAME;
ff.pattern += ".so";
str_tolower(ff.pattern);
sprintf(path, "/proc/%u/map_files/", getpid());
enum_files(path, false, on_found, &ff);
pos = ff.found.rfind('/');
if (pos++ == std::string::npos)
ff.found += "/";
else
ff.found.erase(pos);
return ff.found;
#endif
}
static int get_log_config(const std::string& self_path, hg_log_type* type, std::string* path)
{
std::string me(self_path + "/configs/scanner.conf");
simple_ini ini;
int lv = LOG_LEVEL_ALL;
hg_log_type tp = LOG_TYPE_FILE;
if (!type)
type = &tp;
*type = LOG_TYPE_FILE;
if (ini.load(me.c_str()) == 0)
{
std::string val(ini.get("log", "type"));
if (val == "console")
*type = LOG_TYPE_CONSOLE;
else if (val == "none")
*type = LOG_TYPE_NONE;
else
*type = LOG_TYPE_FILE;
if (*type == LOG_TYPE_FILE && path)
{
*path = ini.get("log", "path");
}
val = ini.get("log", "level");
if (val == "debug")
lv = LOG_LEVEL_DEBUG_INFO;
else if (val == "warning")
lv = LOG_LEVEL_WARNING;
else if (val == "fatal")
lv = LOG_LEVEL_FATAL;
}
return lv;
}
int init(void)
{
char* file = nullptr;
std::string me(get_self_path()), path("");
hg_log_type type = LOG_TYPE_FILE;
int level = get_log_config(me, &type, &path);
if (type == LOG_TYPE_FILE)
{
if (path.empty())
path = me;
path += "/log";
if (MKDIR(path.c_str(), S_IREAD | S_IWRITE | S_IEXEC) &&
errno != EEXIST)
{
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Create log-folder '%s' failed(%d), now try temporary directory\n", path.c_str(), errno);
path = simple_ini::temporary_path() + "/log";
if (MKDIR(path.c_str(), S_IREAD | S_IWRITE | S_IEXEC) &&
errno != EEXIST)
{
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "create temporary directory '%s' failed(%d), log to console\n", path.c_str(), errno);
type = LOG_TYPE_CONSOLE;
}
}
if (type == LOG_TYPE_FILE)
{
std::string name("");
pe_path(&name);
if (name.empty())
path += "/scanner.log";
else
path += "/" + name + ".log";
file = &path[0];
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Log to file: '%s'\n", path.c_str());
}
}
log_cls::instance()->set_log_level(level);
return log_cls::instance()->set_log_type(type, file);
}
void log(int level, const char* info)
{
if (lcb_)
lcb_(level, info);
else if (log_cls::instance()->is_log_level_enabled(level))
log_cls::instance()->log(info);
}
void vlog(hg_log_level level, const char* fmt, ...)
bool is_log_level_enabled(int level)
{
if (lcb_)
{
va_list args;
char* buf = (char*)malloc(1024);
va_start(args, fmt);
//_vsnprintf(&buf[0], estimate_bytes, format, args);
sprintf(buf, fmt, args);
va_end(args);
lcb_(level, buf);
free(buf);
}
else if (log_cls::instance()->is_log_level_enabled(level))
{
va_list args;
char* buf = (char*)malloc(1024);
va_start(args, fmt);
//_vsnprintf(&buf[0], estimate_bytes, format, args);
sprintf(buf, fmt, args);
va_end(args);
log_cls::instance()->log(buf);
free(buf);
}
return log_cls::instance()->is_log_level_enabled(level);
}
void log(const char* info)
{
log_cls::instance()->log(info);
}
}
#ifdef EXPORT_AS_C
@ -328,7 +488,7 @@ extern "C"
#endif
#ifdef WIN32
void hg_debug_log(hg_log_level level, const char* info)
void hg_debug_log(int level, const char* info)
{
hg_log::log(level, info);
}

59
hgdriver/wrapper/hg_log.h Normal file
View File

@ -0,0 +1,59 @@
// this file is include huagao logging tools
//
// created: 2022-02-09
//
#pragma once
#include <string>
#include "../../sdk/hginclude/huagaoxxx_warraper_ex.h"
#ifdef WIN32
#define bzero(a, l) memset(a, 0, l)
#endif
#ifdef OEM_HANWANG
#define hg_log hw_log
#define hg_log_type hw_log_type
#elif defined(OEM_LISICHENG)
#define hg_log lsc_log
#define hg_log_type lsc_log_type
#endif
enum hg_log_type
{
LOG_TYPE_NONE = 0, // no logging
LOG_TYPE_CONSOLE, // print to console
LOG_TYPE_FILE, // write log into file
LOG_TYPE_CALLBACK, // invoke callback log_callback
};
typedef void (*log_callback)(int, const char* info);
#ifdef EXPORT_AS_C
extern "C"
{
#endif
namespace hg_log
{
std::string format_ptr(void* ptr);
std::string format_current_thread_id(void);
std::string current_time(void);
std::string format_size(unsigned long size);
std::string u2utf8(const wchar_t* u);
std::string pe_path(std::string* name = nullptr);
unsigned long long available_memory(void);
// Function: initialize the logging type and level
//
// Return: 0 - success, or -1 in LOG_TYPE_FILE and log_file cannot be created
int init(void);
void log(int level, const char* info);
bool is_log_level_enabled(int level);
void log(const char* info);
}
#ifdef EXPORT_AS_C
}
#endif

View File

@ -1,5 +1,5 @@
#include "../../sdk/hginclude/huagaoxxx_warraper_ex.h"
//#include "../../sdk/hginclude/hg_log.h"
#include "../wrapper/hg_log.h"
#include "../hgdev/scanner_manager.h"
#include <iostream>
@ -21,7 +21,7 @@ extern "C"
{
scanner_err hg_scanner_initialize(sane_callback callback, void* reserve)
{
// hg_log::init(LOG_TYPE_CONSOLE);
hg_log::init();
hg_scanner_mgr::set_version(VERSION_MAJOR, VERSION_MINOR, VERSION_YEAR, VERSION_BUILD - 100000);
hg_scanner_mgr::instance(callback);
@ -98,6 +98,140 @@ extern "C"
{
return hg_scanner_mgr::instance()->hg_scanner_control(h, code, data, len);
}
void hg_scanner_set_sane_info(const char* name, const char* ver)
{
}
const char* hg_scanner_err_name(int err)
{
RETURN_IF(err, SANE_STATUS_GOOD);
RETURN_IF(err, SANE_STATUS_UNSUPPORTED);
RETURN_IF(err, SANE_STATUS_CANCELLED);
RETURN_IF(err, SANE_STATUS_DEVICE_BUSY);
RETURN_IF(err, SANE_STATUS_INVAL);
RETURN_IF(err, SANE_STATUS_EOF);
RETURN_IF(err, SANE_STATUS_JAMMED);
RETURN_IF(err, SANE_STATUS_NO_DOCS);
RETURN_IF(err, SANE_STATUS_COVER_OPEN);
RETURN_IF(err, SANE_STATUS_IO_ERROR);
RETURN_IF(err, SANE_STATUS_NO_MEM);
RETURN_IF(err, SANE_STATUS_ACCESS_DENIED);
RETURN_IF(err, SCANNER_ERR_INVALID_PARAMETER);
RETURN_IF(err, SCANNER_ERR_USER_CANCELED);
RETURN_IF(err, SCANNER_ERR_INSUFFICIENT_MEMORY);
RETURN_IF(err, SCANNER_ERR_ACCESS_DENIED);
RETURN_IF(err, SCANNER_ERR_IO_PENDING);
RETURN_IF(err, SCANNER_ERR_NOT_EXACT);
RETURN_IF(err, SCANNER_ERR_CONFIGURATION_CHANGED);
RETURN_IF(err, SCANNER_ERR_NOT_OPEN);
RETURN_IF(err, SCANNER_ERR_NOT_START);
RETURN_IF(err, SCANNER_ERR_NOT_ANY_MORE);
RETURN_IF(err, SCANNER_ERR_NO_DATA);
RETURN_IF(err, SCANNER_ERR_HAS_DATA_YET);
RETURN_IF(err, SCANNER_ERR_OUT_OF_RANGE);
RETURN_IF(err, SCANNER_ERR_IO);
RETURN_IF(err, SCANNER_ERR_TIMEOUT);
RETURN_IF(err, SCANNER_ERR_OPEN_FILE_FAILED);
RETURN_IF(err, SCANNER_ERR_CREATE_FILE_FAILED);
RETURN_IF(err, SCANNER_ERR_WRITE_FILE_FAILED);
RETURN_IF(err, SCANNER_ERR_DATA_DAMAGED);
RETURN_IF(err, SCANNER_ERR_USB_INIT_FAILED);
RETURN_IF(err, SCANNER_ERR_USB_REGISTER_PNP_FAILED);
RETURN_IF(err, SCANNER_ERR_USB_CLAIM_INTERFACE_FAILED);
RETURN_IF(err, SCANNER_ERR_DEVICE_NOT_FOUND);
RETURN_IF(err, SCANNER_ERR_DEVICE_NOT_SUPPORT);
RETURN_IF(err, SCANNER_ERR_DEVICE_BUSY);
RETURN_IF(err, SCANNER_ERR_DEVICE_SLEEPING);
RETURN_IF(err, SCANNER_ERR_DEVICE_COUNT_MODE);
RETURN_IF(err, SCANNER_ERR_DEVICE_STOPPED);
RETURN_IF(err, SCANNER_ERR_DEVICE_COVER_OPENNED);
RETURN_IF(err, SCANNER_ERR_DEVICE_NO_PAPER);
RETURN_IF(err, SCANNER_ERR_DEVICE_FEEDING_PAPER);
RETURN_IF(err, SCANNER_ERR_DEVICE_DOUBLE_FEEDING);
RETURN_IF(err, SCANNER_ERR_DEVICE_PAPER_JAMMED);
RETURN_IF(err, SCANNER_ERR_DEVICE_STAPLE_ON);
RETURN_IF(err, SCANNER_ERR_DEVICE_PAPER_SKEW);
RETURN_IF(err, SCANNER_ERR_DEVICE_SIZE_CHECK);
RETURN_IF(err, SCANNER_ERR_DEVICE_DOGEAR);
RETURN_IF(err, SCANNER_ERR_DEVICE_NO_IMAGE);
RETURN_IF(err, SCANNER_ERR_DEVICE_SCANN_ERROR);
RETURN_IF(err, SCANNER_ERR_DEVICE_PC_BUSY);
// NOTE: multi-thread unsafe here
static char g_unk_err[80] = { 0 };
sprintf(g_unk_err, "\346\234\252\347\237\245\351\224\231\350\257\257\357\274\2320x%X", err);
return g_unk_err;
}
const char* hg_scanner_err_description(int err)
{
RETURN_DESC_IF(err, SCANNER_ERR_OK);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NOT_SUPPORT);
RETURN_DESC_IF(err, SCANNER_ERR_USER_CANCELED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_BUSY);
RETURN_DESC_IF(err, SCANNER_ERR_INVALID_PARAMETER);
RETURN_DESC_IF(err, SCANNER_ERR_NO_DATA);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_PAPER_JAMMED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NO_PAPER);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_COVER_OPENNED);
RETURN_DESC_IF(err, SCANNER_ERR_IO);
RETURN_DESC_IF(err, SCANNER_ERR_INSUFFICIENT_MEMORY);
RETURN_DESC_IF(err, SCANNER_ERR_ACCESS_DENIED);
RETURN_DESC_IF(err, SCANNER_ERR_INSUFFICIENT_MEMORY);
RETURN_DESC_IF(err, SCANNER_ERR_ACCESS_DENIED);
RETURN_DESC_IF(err, SCANNER_ERR_IO_PENDING);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_EXACT);
RETURN_DESC_IF(err, SCANNER_ERR_CONFIGURATION_CHANGED);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_OPEN);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_START);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_ANY_MORE);
RETURN_DESC_IF(err, SCANNER_ERR_NO_DATA);
RETURN_DESC_IF(err, SCANNER_ERR_HAS_DATA_YET);
RETURN_DESC_IF(err, SCANNER_ERR_OUT_OF_RANGE);
RETURN_DESC_IF(err, SCANNER_ERR_IO);
RETURN_DESC_IF(err, SCANNER_ERR_TIMEOUT);
RETURN_DESC_IF(err, SCANNER_ERR_OPEN_FILE_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_CREATE_FILE_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_WRITE_FILE_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_DATA_DAMAGED);
RETURN_DESC_IF(err, SCANNER_ERR_USB_INIT_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_USB_REGISTER_PNP_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_USB_CLAIM_INTERFACE_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NOT_FOUND);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NOT_SUPPORT);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_BUSY);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_SLEEPING);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_COUNT_MODE);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_STOPPED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_COVER_OPENNED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NO_PAPER);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_FEEDING_PAPER);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_DOUBLE_FEEDING);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_PAPER_JAMMED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_STAPLE_ON);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_PAPER_SKEW);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_SIZE_CHECK);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_DOGEAR);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NO_IMAGE);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_SCANN_ERROR);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_PC_BUSY);
// NOTE: multi-thread unsafe here
static char g_unk_err[80] = { 0 };
sprintf(g_unk_err, "\346\234\252\347\237\245\351\224\231\350\257\257\357\274\2320x%X", err);
return g_unk_err;
}
bool hg_scanner_log_is_enable(int level)
{
return hg_log::is_log_level_enabled(level);
}
void hg_scanner_log(const char* info)
{
hg_log::log(info);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
#include "sane_option.h"
#include <sane/sane_option_definitions.h>
#include "../sdk/hginclude/hg_log.h"
#include "../sdk/hginclude/huagaoxxx_warraper_ex.h"
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
@ -48,7 +48,7 @@ static void match_paper(char* buf, int cx, int cy)
else
strcpy(buf, g_paper[index].title);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "match paper(%u * %u) to '%s'\n", cx, cy, (char*)buf);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "match paper(%u * %u) to '%s'\n", cx, cy, (char*)buf);
}
@ -349,7 +349,7 @@ scanner_err sane_std_opts::set_value(scanner_handle h, int opt, void* buf)
long len = 0;
void* data = from_known_opt_value(op, buf, &len);
HG_VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "%d->%d: %s\n", opt, op->user.opt, (char*)data);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "%d->%d: %s\n", opt, op->user.opt, (char*)data);
statu = hg_scanner_set_parameter(h, op->user.opt, data, len);
if (statu == SCANNER_ERR_NOT_EXACT)

View File

@ -99,6 +99,11 @@
#define hg_scanner_get_status hw_scanner_get_status
#define hg_scanner_reset hw_scanner_reset
#define hg_scanner_control hw_scanner_control
#define hg_scanner_set_sane_info hw_scanner_set_sane_info
#define hg_scanner_err_name hw_scanner_err_name
#define hg_scanner_err_description hw_scanner_err_description
#define hg_scanner_log hw_scanner_log
#define hg_scanner_log_is_enable hw_scanner_log_is_enable
#elif defined(OEM_LISICHENG)
#define hg_scanner_initialize lsc_scanner_initialize
#define hg_scanner_uninitialize lsc_scanner_uninitialize
@ -115,8 +120,16 @@
#define hg_scanner_get_status lsc_scanner_get_status
#define hg_scanner_reset lsc_scanner_reset
#define hg_scanner_control lsc_scanner_control
#define hg_scanner_set_sane_info lsc_scanner_set_sane_info
#define hg_scanner_err_name lsc_scanner_err_name
#define hg_scanner_err_description lsc_scanner_err_description
#define hg_scanner_log lsc_scanner_log
#define hg_scanner_log_is_enable lsc_scanner_log_is_enable
#endif
#define _TO_STR(str) #str
#define MAKE_STR(str) _TO_STR(str)
#define GET_BACKEND_NAME MAKE_STR(BACKEND_NAME)
typedef struct _device
{
@ -386,10 +399,105 @@ extern "C"{
// Return: 错误码
scanner_err hg_scanner_control(scanner_handle h, unsigned long code, void* data, unsigned *len);
// Function: 设置SANE组件信息
//
// Parameter: name - sane组件名字
//
// ver - sane组件版本
//
// Return: none
void hg_scanner_set_sane_info(const char* name, const char* ver);
const char* hg_scanner_err_name(int err);
const char* hg_scanner_err_description(int err);
enum log_level
{
LOG_LEVEL_ALL = 0,
LOG_LEVEL_DEBUG_INFO,
LOG_LEVEL_WARNING,
LOG_LEVEL_FATAL,
};
bool hg_scanner_log_is_enable(int level);
void hg_scanner_log(const char* info);
#ifdef __cplusplus
}
#endif
/////////////////////////////////////////////////////////////////////////////////////
// log ...
#define VLOG_MINI_BYTES 512
#define LOG_INFO(level, info) \
if(hg_scanner_log_is_enable(level)) \
hg_scanner_log(info);
#define VLOG_1(level, bytes, fmt, arg1) \
if(hg_scanner_log_is_enable(level)) \
{ \
char* msgbuf = (char*)malloc(bytes); \
sprintf(msgbuf, fmt, arg1); \
hg_scanner_log(msgbuf); \
free(msgbuf); \
}
#define VLOG_MINI_1(level, fmt, arg1) VLOG_1(level, VLOG_MINI_BYTES, fmt, arg1)
#define VLOG_2(level, bytes, fmt, arg1, arg2) \
if(hg_scanner_log_is_enable(level)) \
{ \
char* msgbuf = (char*)malloc(bytes); \
sprintf(msgbuf, fmt, arg1, arg2); \
hg_scanner_log(msgbuf); \
free(msgbuf); \
}
#define VLOG_MINI_2(level, fmt, arg1, arg2) VLOG_2(level, VLOG_MINI_BYTES, fmt, arg1, arg2)
#define VLOG_3(level, bytes, fmt, arg1, arg2, arg3) \
if(hg_scanner_log_is_enable(level)) \
{ \
char* msgbuf = (char*)malloc(bytes); \
sprintf(msgbuf, fmt, arg1, arg2, arg3); \
hg_scanner_log(msgbuf); \
free(msgbuf); \
}
#define VLOG_MINI_3(level, fmt, arg1, arg2, arg3) VLOG_3(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3)
#define VLOG_4(level, bytes, fmt, arg1, arg2, arg3, arg4) \
if(hg_scanner_log_is_enable(level)) \
{ \
char* msgbuf = (char*)malloc(bytes); \
sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4); \
hg_scanner_log(msgbuf); \
free(msgbuf); \
}
#define VLOG_MINI_4(level, fmt, arg1, arg2, arg3, arg4) \
VLOG_4(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4)
#define VLOG_5(level, bytes, fmt, arg1, arg2, arg3, arg4, arg5) \
if(hg_scanner_log_is_enable(level)) \
{ \
char* msgbuf = (char*)malloc(bytes); \
sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4, arg5); \
hg_scanner_log(msgbuf); \
free(msgbuf); \
}
#define VLOG_MINI_5(level, fmt, arg1, arg2, arg3, arg4, arg5) \
VLOG_5(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4, arg5)
#define VLOG_6(level, bytes, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
if(hg_scanner_log_is_enable(level)) \
{ \
char* msgbuf = (char*)malloc(bytes); \
sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4, arg5, arg6); \
hg_scanner_log(msgbuf); \
free(msgbuf); \
}
#define VLOG_MINI_6(level, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
VLOG_6(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
#endif // WRRPER_SANE_SCANNER_H_EX