兼容领亿……第三方APP,取图模式与之前设置的XferMech不同,图像数据放到取图的时候根据实际的模式进行准备;添加打开设备时的日志

This commit is contained in:
gb 2023-12-12 09:14:31 +08:00
parent b071d7d4b7
commit 515003e0e5
2 changed files with 16 additions and 14 deletions

View File

@ -385,7 +385,7 @@ scanned_img::scanned_img(SANE_Handle dev, SANE_Parameters head, void* data, unsi
, twain_xfer xfer, SANE_FinalImgFormat* fmt) : head_(head), dpi_(dpi), header_size_(0)
, file_(tmp_file ? tmp_file : L""), dev_(dev), status_(IMG_STATUS_OK)
{
const bool prepare_data = true;
const bool prepare_data = false; // Compatible with apps that have different actual image retrieval modes from the previously set modes, the data is re-organized at fetch - prepare_data_for_transfer
if (fmt)
fmt_ = *fmt;

View File

@ -972,7 +972,7 @@ Twpp::Result huagao_ds::deviceEventGet(const Twpp::Identity& origin, Twpp::Devic
Result huagao_ds::identityOpenDs(const Identity& id)
{
//singleton_ = CreateMutexA(NULL, FALSE, "LookitApp");
//if (GetLastError() == ERROR_ALREADY_EXISTS) { //婵″倹鐏夊鑼病鐎涙ê婀崥灞芥倳閻ㄥ嚜utex娴兼艾绶遍崚鎷岀箹娑擃亪鏁婄拠?
//if (GetLastError() == ERROR_ALREADY_EXISTS) { //蟀オ窶ウ蛟ケ髏丞、基<EFBFBD>髑シ﨡ら羅髏取カ凖ェ蟀€﨟亥エ・轣櫁冠蛟ウ髢サ繖・蝴忖tex螽エ蜈シ濶セ扈カ驕榊エ夐執蟯€邂ケ螽第塔莠ェ髀∝ゥ<EFBFBD><EFBFBD>?
// CloseHandle(singleton_);
// singleton_ = NULL;
// showmsg("閹绘劗銇?, 202);
@ -983,8 +983,9 @@ Result huagao_ds::identityOpenDs(const Identity& id)
load_sane_util::initialize(me_);
if (!load_sane_util::is_ok())
{
CloseHandle(singleton_);
singleton_ = NULL;
//CloseHandle(singleton_);
//singleton_ = NULL;
load_sane_util::to_log(1, L"huagao_ds::identityOpenDs: %s\r\n", "load_sane_util::initialize failed");
return bummer();
}
@ -996,9 +997,10 @@ Result huagao_ds::identityOpenDs(const Identity& id)
if (result.returnCode() != ReturnCode::Success)
{
CloseHandle(singleton_);
singleton_ = NULL;
//CloseHandle(singleton_);
//singleton_ = NULL;
load_sane_util::uninitialize();
load_sane_util::to_log(1, L"huagao_ds::identityOpenDs: selectIdentity failed: %d\r\n", (int)result.status());
return result;
}
@ -1043,7 +1045,7 @@ Result huagao_ds::identityOpenDs(const Identity& id)
name = wcsrchr(pe, L'\\');
if (name++ == NULL)
name = pe;
if (wcsicmp(name, L"\u597D\u5206\u6570\u9605\u5377\u626B\u63CF\u7AEF.exe") == 0) // 爱云校PE好分数阅卷扫描端.exe
if (wcsicmp(name, L"\u597D\u5206\u6570\u9605\u5377\u626B\u63CF\u7AEF.exe") == 0) // 辷ア莠第<EFBFBD>。PE<EFBFBD>壼・ス蛻<EFBFBD>焚髦<EFBFBD>差謇ォ謠冗ォ?exe
double_check_mode_ = DOUBLE_CHECK_ULTRASONIC;
else
double_check_mode_ = DOUBLE_CHECK_TWAIN;
@ -1104,7 +1106,7 @@ Result huagao_ds::pendingXfersGet(const Identity&, PendingXfers& data)
// 显示设置界面时不能阻塞在EndXfer否则最后一张图片传输后显示不出来故在此做阻塞调用
int cnt = get_scanned_image_count(-1);
// FIX-2023-05-29: 是否保持设置界面显示由APP决定此处不再由是否显示UI来决定保持一个扫描流程正常结束
// FIX-2023-05-29: 譏ッ蜷ヲ菫晄戟隶セ鄂ョ逡碁擇譏セ遉コ<EFBFBD>檎罰APP蜀ウ螳夲シ梧ュ、螟<EFBFBD>ク榊<EFBFBD>逕ア譏ッ蜷ヲ譏セ遉コUI譚・蜀ウ螳夲シ御ソ晄戟荳€荳ェ謇ォ謠乗オ∫ィ区ュ」蟶ク扈捺<EFBFBD>?
//int cnt = show_setting_ ? 1 : get_scanned_image_count(-1);
data.setCount(cnt);
@ -1286,9 +1288,9 @@ Result huagao_ds::imageInfoGet(const Identity&, ImageInfo& data)
//if (!scanner_->wait_image())
//{
//// notifyCloseOk();
// return success(); // 婵傝棄鍨庨弫浼存付鐟曚浇绻戦崶鐐村灇閸?
// return success(); // 蟀オ蛯晄」<EFBFBD>昏蠎ィ蠑ォ豬シ蟄倅サ倬澄譖壽オ<EFBFBD>ササ謌ヲ蟠カ髏先搗轣<EFBFBD><EFBFBD>?
//}
if (get_scanned_image_count(-1) > 0) // 閺勫墽銇氱拋鍓х枂閻矂娼伴弮璁圭礉娑撳秷鍏橀梼璇差敚閸︹€dXfer閿涘苯鎯侀崚娆愭付閸氬簼绔村鐘叉禈閻楀洣绱舵潏鎾虫倵閺勫墽銇氭稉宥呭毉閺夈儻绱濋弫鍛躬濮濄倕浠涢梼璇差敚鐠嬪啰鏁?
if (get_scanned_image_count(-1) > 0) // 髢コ蜍ォ蠅ス驫<EFBFBD>ーア諡矩酷ム<EFBFBD>桙髢サ<EFBFBD><EFBFBD>氓螽シ莨エ蠑ョ迺∝惆遉牙ィ第諜遘キ骰乗ゥ€譴シ迺<EFBFBD>キョ謨夐椋<EFBFBD>ケ竄ャ遧エdXfer髢ソ豸倩怯骼ッ萓€蟠壼ィ<EFBFBD>┓莉倬椋豌ャ邁シ扈疲搗訒」髏伜初遖磯冥讌€豢」扈ア闊オ貎城疾陌ォ蛟オ髢コ蜍ォ蠅ス驫<EFBFBD>ーュ遞牙ョ・蜻ュ豈蛾娘螟亥┰扈ア豼句シォ骰幟<EFBFBD>霄ャ豼ョ豼<EFBFBD>€墓オ<EFBFBD>豸「譴シ迺<EFBFBD>キョ謨夐摺螫ェ蝠ー髀?
{
ok = scanner_->get_first_image_header(&head, NULL, &res);
if (ok)
@ -1905,7 +1907,7 @@ void huagao_ds::init_support_caps(void)
return success();
}
// data.type
if (!data.operator bool()) //閸忛攱婀佹搴ㄦ珦閹?(閸滃本鐨? Twain sample app ,data.m_cont is null,but DotNet閿涘牆鎷板鏃撶礆 data.m_cont not is null .
if (!data.operator bool()) //髢ク蠢帶罰蟀€菴ケ逸ー謳エ繖ヲ迴ヲ髢ケ?(髢ク貊<EFBDB8>悽髏ィ? Twain sample app ,data.m_cont is null,but DotNet髢ソ豸倡掩骼キ譚ソ鄧晞純謦カ遉?data.m_cont not is null .
{
data = Capability::createEnumeration<CapType::Indicators>({ FALSE,TRUE }, m_bIndicator ? 1 : 0, 1);
}
@ -2742,7 +2744,7 @@ void huagao_ds::init_support_caps(void)
float sf = trans_range((float)step, (float)l, (float)u, range_l, range_h, true),
nf = trans_range((float)now, (float)l, (float)u, range_l, range_h),
initf = trans_range((float)init, (float)l, (float)u, range_l, range_h);
sf = 333.30f; // 全通……部分第三方需要固定该值 :( - 2023-10-25
sf = 333.30f; // 蜈ィ騾壺€ヲ窶ヲ驛ィ蛻<EFBFBD>ャャ荳画婿髴€隕∝崋螳夊ッ・蛟?:( - 2023-10-25
switch (msg) {
case Msg::Get:
//sf = 333.333f;
@ -2791,7 +2793,7 @@ void huagao_ds::init_support_caps(void)
float sf = trans_range((float)step, (float)l, (float)u, range_l, range_h, true),
nf = trans_range((float)now, (float)l, (float)u, range_l, range_h),
initf = trans_range((float)init, (float)l, (float)u, range_l, range_h);
sf = 333.30f; // 全通……部分第三方需要固定该值 :( - 2023-10-25
sf = 333.30f; // 蜈ィ騾壺€ヲ窶ヲ驛ィ蛻<EFBFBD>ャャ荳画婿髴€隕∝崋螳夊ッ・蛟?:( - 2023-10-25
switch (msg) {
case Msg::Get:
// sf = 333.333f;
@ -3887,7 +3889,7 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
break;
case SANE_EVENT_UI_CLOSE_CANCEL:
//scanner_->stop();
//notifyCloseCancel(); // 娣囶喖顦查悙鐟板毊鏉╂稑瀹冲?閸欐牗绉?閹稿鎸抽敍瀛禝娑撳秷鍏樺锝呯埗缂佹挻娼惃鍑歎G - added on 2023-02-14
//notifyCloseCancel(); // 螽」蝗カ蝟夜。ヲ譟・謔咎澄譚ソ豈企初笊らィ醍€ケ蜀イ都?髢ク谺千於扈<E696BC>?髢ケ遞ソ逸オ骼ク謚ス謨咲€帷ヲ晏ィ第諜遘キ骰乗ィコ鄧「髞晏賊蝓礼シゆスケ謖サ螽シ薰ヲ諠<EFBDA6>国豁雑 - added on 2023-02-14
//break;
case SANE_EVENT_UI_CLOSE_NORMAL:
case SANE_EVENT_SCAN_FINISHED: