调整设置图像数量的时候 是指图像页数

This commit is contained in:
13038267101 2023-04-04 17:37:38 +08:00
parent ddb7aafffc
commit eb59849a8f
2 changed files with 44 additions and 2 deletions

View File

@ -853,7 +853,7 @@ static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
static std::once_flag oc;
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT)
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT),count_(-1)
{
//std::call_once(oc, [&]() { log4cplus::Initializer(); });
}
@ -1742,7 +1742,17 @@ void huagao_ds::init_support_caps(void)
return badValue();
}
int ret = SCANNER_ERR_OK;
int count = item;
int count = count_ = item;
BYTE dup = 1;
std::vector<bool> all;
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
dup = all[sane_opts::RANGE_POS_CURRENT];
if (dup && count >= 2)
{
count /= 2;
}
SET_SANE_OPT(ret, scanner_, scan_count, &count);
return ret == SCANNER_ERR_OK ? success() : badValue();
}
@ -1750,6 +1760,16 @@ void huagao_ds::init_support_caps(void)
Int16 tmp_count = 0;
GET_SANE_OPT(int, scanner_, scan_count, NULL, &count);
tmp_count = count[sane_opts::RANGE_POS_CURRENT];
BYTE dup = 1;
std::vector<bool> all;
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
dup = all[sane_opts::RANGE_POS_CURRENT];
if (dup && tmp_count > 0 && tmp_count < 65535)
{
tmp_count *= 2;
}
return oneValGetSet<Int16>(msg, data, tmp_count, -1);
};
@ -2234,14 +2254,35 @@ void huagao_ds::init_support_caps(void)
log_attr_access((int)CapType::DuplexEnabled, (int)msg);
if (Msg::Set == msg) {
bool mech = data.currentItem<CapType::DuplexEnabled>();
int ret = SCANNER_ERR_OK;
SET_SANE_OPT(ret, scanner_, ex_duplex, &mech);
int count = count_;
if (mech && count_ >= 2)
{
count /= 2;
SET_SANE_OPT(ret, scanner_, scan_count, &count);
}
else if (!mech && count_ >= 2)
SET_SANE_OPT(ret, scanner_, scan_count, &count);
return ret == SCANNER_ERR_OK ? success() : badValue();
}
BYTE dup = 1;
std::vector<bool> all;
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
dup = all[sane_opts::RANGE_POS_CURRENT];
int ret = SCANNER_ERR_OK;
int count = count_;
if (dup && count_ >= 2)
{
count /= 2;
SET_SANE_OPT(ret, scanner_, scan_count, &count);
}
else if (!dup && count_ >= 2)
SET_SANE_OPT(ret, scanner_, scan_count, &count)
return CapSupGetAllReset<BYTE, Bool, CapType::DuplexEnabled>(msg, data, dup, Bool(true));
};

View File

@ -55,6 +55,7 @@ class huagao_ds : public Twpp::SourceFromThis<huagao_ds> {
bool log_all_triple_;
bool app_trigger_event_;
int count_;
static std::string get_hidedlg_path(void);
static void showmsg(const char* msg, int err);
static int __stdcall on_scanner_event(int ev, void* param);