修改待纸扫描协议SANE匹配项

This commit is contained in:
gb 2023-06-03 10:09:01 +08:00
parent 935374f2cb
commit 1b8e8f6aa3
1 changed files with 13 additions and 7 deletions

View File

@ -1629,10 +1629,16 @@ Result huagao_ds::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, v
rt = Base::call(origin, dg, dat, msg, data); rt = Base::call(origin, dg, dat, msg, data);
if (log_all_triple_ || ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent)) if (log_all_triple_ || ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent))
{ {
wchar_t buf[128] = { 0 }, dgs[20] = { 0 }, dts[20] = { 0 }, ms[20] = { 0 }, ss[20] = { 0 }, rcs[20] = { 0 }, cs[20] = { 0 }; wchar_t dgs[20] = { 0 }, dts[20] = { 0 }, ms[20] = { 0 }, ss[20] = { 0 }, rcs[20] = { 0 }, cs[20] = { 0 };
swprintf_s(buf, _countof(buf) - 1, L"[%x - %s]DSEntry(%s, %s, %s) = {%s, %s}\r\n", GetCurrentThreadId(), desc_state(state(), ss), if (dat == Dat::Capability)
desc_data_group(dg, dgs), desc_data(dat, dts), desc_msg(msg, ms), desc_return_code(rt, rcs), desc_condition_code((ConditionCode)(Status)rt, cs)); {
load_sane_util::log_info(buf, 7); Twpp::Capability& cap = *(Twpp::Capability*)data;
load_sane_util::to_log(7, L"[%x - %s]DSEntry(%s, %s.%x, %s) = {%s, %s}\r\n", GetCurrentThreadId(), desc_state(state(), ss),
desc_data_group(dg, dgs), desc_data(dat, dts), (int)cap.type(), desc_msg(msg, ms), desc_return_code(rt, rcs), desc_condition_code((ConditionCode)(Status)rt, cs));
}
else
load_sane_util::to_log(7, L"[%x - %s]DSEntry(%s, %s, %s) = {%s, %s}\r\n", GetCurrentThreadId(), desc_state(state(), ss),
desc_data_group(dg, dgs), desc_data(dat, dts), desc_msg(msg, ms), desc_return_code(rt, rcs), desc_condition_code((ConditionCode)(Status)rt, cs));
if ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent) if ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent)
{ {
bool changed = false; bool changed = false;
@ -2424,7 +2430,7 @@ void huagao_ds::init_support_caps(void)
return CapSupGetAll<Str255, Str255, CapType::SerialNumber>(msg, data, str, str); return CapSupGetAll<Str255, Str255, CapType::SerialNumber>(msg, data, str, str);
}; };
if (SANE_ID(ex_to_be_scan) > 0) if (SANE_ID(scan_when_paper_on) > 0)
{ {
m_query[CapType::AutoScan] = msgSupportGetAllSetReset; m_query[CapType::AutoScan] = msgSupportGetAllSetReset;
m_caps[CapType::AutoScan] = [this](Msg msg, Capability& data)->Result { m_caps[CapType::AutoScan] = [this](Msg msg, Capability& data)->Result {
@ -2435,11 +2441,11 @@ void huagao_ds::init_support_caps(void)
val = (bool)data.currentItem<CapType::AutoScan>(); val = (bool)data.currentItem<CapType::AutoScan>();
int ret = SANE_STATUS_GOOD; int ret = SANE_STATUS_GOOD;
m_autoscan = val; m_autoscan = val;
SET_SANE_OPT_EX(ret, scanner_, ex_to_be_scan, &val); SET_SANE_OPT_EX(ret, scanner_, scan_when_paper_on, &val);
return ret == SANE_STATUS_GOOD ? success() : badValue(); return ret == SANE_STATUS_GOOD ? success() : badValue();
} }
std::vector<bool> all; std::vector<bool> all;
GET_SANE_OPT_EX(bool, scanner_, ex_to_be_scan, NULL, &all); GET_SANE_OPT_EX(bool, scanner_, scan_when_paper_on, NULL, &all);
m_autoscan = (bool)all[sane_opts::RANGE_POS_CURRENT]; m_autoscan = (bool)all[sane_opts::RANGE_POS_CURRENT];
//return oneValGetSet<Bool>(msg, data, (Bool)all[sane_opts::RANGE_POS_CURRENT], 0); //return oneValGetSet<Bool>(msg, data, (Bool)all[sane_opts::RANGE_POS_CURRENT], 0);
//data = Capability::createOneValue<Bool>(CapType::AutoScan, (BYTE)all[sane_opts::RANGE_POS_CURRENT]); //data = Capability::createOneValue<Bool>(CapType::AutoScan, (BYTE)all[sane_opts::RANGE_POS_CURRENT]);