From 397f919b1dcb9916f2b60ee9ec1e51deb262d33f Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Tue, 31 Jan 2023 16:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=8C=85=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/char_const.h | 4 +- hgdriver/hgdev/scanner_manager.cpp | 85 +++++++++++++++--------------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/hgdriver/hgdev/char_const.h b/hgdriver/hgdev/char_const.h index 3526241..1b87c45 100644 --- a/hgdriver/hgdev/char_const.h +++ b/hgdriver/hgdev/char_const.h @@ -194,8 +194,8 @@ #define SCANNER_NAME_HW_8000 "Hanvon HW-8000" #define SCANNER_NAME_HW_9000 "Hanvon HW-9000" -#define SCANNER_NAME_CT_9020 "CUMTENN CT-9020" -#define SCANNER_NAME_CT_4520 "CUMTENN CT-4520" +#define SCANNER_NAME_CT_9020 "CUMTENN CT-6900" +#define SCANNER_NAME_CT_4520 "CUMTENN CT-6005" #define SCANNER_NAME_CT_138 "CUMTENN CT-138" #define SCANNER_NAME_CT_238 "CUMTENN CT-238" diff --git a/hgdriver/hgdev/scanner_manager.cpp b/hgdriver/hgdev/scanner_manager.cpp index 968ed2f..8fdb11e 100644 --- a/hgdriver/hgdev/scanner_manager.cpp +++ b/hgdriver/hgdev/scanner_manager.cpp @@ -23,7 +23,7 @@ /// #define TO_STR(s) #s #define PID_AND_NAME(p, n) 0x##p, std::string(n) + " - " + TO_STR(p) - +#define GET_LANG(str,b) from_default_language(str,b) static struct { uint16_t vid; // vendor ID @@ -74,7 +74,8 @@ g_supporting_devices[] = { , {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100} #endif }; -static std::string g_vendor = COMPANY_NAME; +bool islang = false; +static std::string g_vendor = GET_LANG(COMPANY_NAME, &islang); #define BRAND_LOGO_SIZE 8 * 1024 @@ -431,7 +432,7 @@ void hg_scanner_mgr::set_appendix_info_for_about(SANE_About* about, char*& ptr, { #ifdef BRAND_DISPLAY_ALL_EXPAND if (!info || *info == 0) - info = BRAND_COMMUNICATION_FAIL; + info = GET_LANG(BRAND_COMMUNICATION_FAIL,&islang); #endif if (info && strlen(info)) @@ -461,32 +462,32 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne SANE_About tmp; bytes += sizeof(g_logo); - bytes += strlen(BRAND_APP_NAME) + 8; - bytes += strlen(BRAND_TITLE_VERSION) + 8; - bytes += strlen(BRAND_TITLE_COPYRIGHT) + 8; - bytes += strlen(BRAND_COPYRIGHT) + 8; - bytes += strlen(BRAND_TITE_MANUFACTOR) + 8; - bytes += strlen(BRAND_TITLE_URL) + 8; - bytes += strlen(BRAND_COMPANY_URL) + 8; - bytes += strlen(BRAND_URL_COMPANY_URL) + 8; - bytes += strlen(BRAND_TITLE_TEL) + 8; - bytes += strlen(BRAND_COMPANY_TEL) + 8; - bytes += strlen(BRAND_TITLE_ADDRESS) + 8; - bytes += strlen(BRAND_COMPANY_ADDRESS) + 8; - bytes += strlen(BRAND_TITLE_GPS) + 8; - bytes += strlen(BRAND_COMPANY_GPS) + 8; - bytes += strlen(BRAND_URL_GPS) + 8; + bytes += strlen(GET_LANG(BRAND_APP_NAME,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITLE_VERSION,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITLE_COPYRIGHT,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_COPYRIGHT,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITE_MANUFACTOR,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITLE_URL,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_COMPANY_URL,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_URL_COMPANY_URL,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITLE_TEL,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_COMPANY_TEL,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITLE_ADDRESS,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_COMPANY_ADDRESS,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_TITLE_GPS,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_COMPANY_GPS,&islang)) + 8; + bytes += strlen(GET_LANG(BRAND_URL_GPS,&islang)) + 8; // bytes += 5 * sizeof(tmp.appendix[0]); #ifndef BRAND_DISPLAY_ALL_EXPAND if (scanner) #endif { - bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(BRAND_TITLE_FIRM_VERSION) + 8; - bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(BRAND_TITLE_SERIAL_NUM) + 8; - bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(BRAND_TITLE_IP) + 8; - bytes += sizeof(tmp.appendix[0]) + 28 + strlen(BRAND_TITLE_ROLLER_COUNT) + 8; - bytes += sizeof(tmp.appendix[0]) + 28 + strlen(BRAND_TITLE_HISTORY_COUNT) + 8; + bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(GET_LANG(BRAND_TITLE_FIRM_VERSION,&islang)) + 8; + bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(GET_LANG(BRAND_TITLE_SERIAL_NUM,&islang)) + 8; + bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(GET_LANG(BRAND_TITLE_IP,&islang)) + 8; + bytes += sizeof(tmp.appendix[0]) + 28 + strlen(GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang)) + 8; + bytes += sizeof(tmp.appendix[0]) + 28 + strlen(GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang)) + 8; bytes += sizeof(tmp.appendix[0]); } @@ -503,7 +504,7 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne char* ptr = (char*)data + sizeof(SANE_About) + 9 * sizeof(about->appendix[0]); about->title = ptr; - strcpy(ptr, BRAND_APP_NAME); + strcpy(ptr, GET_LANG(BRAND_APP_NAME,&islang)); MOVE_TO_NEXT_STR(ptr); about->version = ptr; @@ -511,7 +512,7 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne MOVE_TO_NEXT_STR(ptr); about->copyright = ptr; - strcpy(ptr, BRAND_COPYRIGHT); + strcpy(ptr, GET_LANG(BRAND_COPYRIGHT,&islang)); MOVE_TO_NEXT_STR(ptr); about->logo_bytes = sizeof(g_logo);; @@ -521,29 +522,29 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne int count = 0, rolls = 0, ret = SCANNER_ERR_OK; - set_appendix_info_for_about(about, ptr, count, BRAND_TITE_MANUFACTOR, g_vendor.c_str(), NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_URL, BRAND_COMPANY_URL, BRAND_URL_COMPANY_URL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_TEL, BRAND_COMPANY_TEL, NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ADDRESS, BRAND_COMPANY_ADDRESS, NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_GPS, BRAND_COMPANY_GPS, BRAND_URL_GPS); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITE_MANUFACTOR,&islang), g_vendor.c_str(), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_URL,&islang), GET_LANG(BRAND_COMPANY_URL,&islang), GET_LANG(BRAND_URL_COMPANY_URL,&islang)); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_TEL,&islang), GET_LANG(BRAND_COMPANY_TEL,&islang), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ADDRESS,&islang), GET_LANG(BRAND_COMPANY_ADDRESS,&islang), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_GPS,&islang), GET_LANG(BRAND_COMPANY_GPS,&islang), GET_LANG(BRAND_URL_GPS,&islang)); if (scanner) { - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_FIRM_VERSION, scanner->get_firmware_version().c_str(), NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_SERIAL_NUM, scanner->get_serial_num().c_str(), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_FIRM_VERSION,&islang), scanner->get_firmware_version().c_str(), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_SERIAL_NUM,&islang), scanner->get_serial_num().c_str(), NULL); info = scanner->get_ip(); if (info.length() > 10) - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_IP, info.c_str(), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_IP,&islang), info.c_str(), NULL); ret = scanner->get_roller_num(rolls); if (ret == SCANNER_ERR_OK) { char buf[40]; sprintf(buf, "%u", rolls); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ROLLER_COUNT, buf, NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang), buf, NULL); } #ifdef BRAND_DISPLAY_ALL_EXPAND else - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ROLLER_COUNT, rolls == -1 ? BRAND_COMMUNICATION_FAIL : BRAND_DEVICE_NOT_SUPPORT, NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang), rolls == -1 ? GET_LANG(BRAND_COMMUNICATION_FAIL,&islang) : GET_LANG(BRAND_DEVICE_NOT_SUPPORT,&islang), NULL); #endif ret = scanner->get_history_scan_count(rolls); @@ -551,21 +552,21 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne { char buf[40]; sprintf(buf, "%u", rolls); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_HISTORY_COUNT, buf, NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang), buf, NULL); } #ifdef BRAND_DISPLAY_ALL_EXPAND else - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_HISTORY_COUNT, rolls == -1 ? BRAND_COMMUNICATION_FAIL : BRAND_DEVICE_NOT_SUPPORT, NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang), rolls == -1 ? GET_LANG(BRAND_COMMUNICATION_FAIL,&islang) : GET_LANG(BRAND_DEVICE_NOT_SUPPORT,&islang), NULL); #endif } #ifdef BRAND_DISPLAY_ALL_EXPAND else { - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_FIRM_VERSION, BRAND_NO_DEVICE, NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_SERIAL_NUM, BRAND_NO_DEVICE, NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_IP, BRAND_NO_DEVICE, NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ROLLER_COUNT, BRAND_NO_DEVICE, NULL); - set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_HISTORY_COUNT, BRAND_NO_DEVICE, NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_FIRM_VERSION,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_SERIAL_NUM,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_IP,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL); + set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL); } #endif