初始化IP地址;修复重构属性时的序号错误
This commit is contained in:
parent
9007ae0c28
commit
6ca7d1674d
|
@ -2261,6 +2261,14 @@ void hg_scanner::init_settings(const char* json_setting_text)
|
|||
child->set_value("default", val.c_str());
|
||||
child->release();
|
||||
}
|
||||
jsn->get_value(SANE_STD_OPT_NAME_DEVICE_IP_ADDR, child);
|
||||
if(child)
|
||||
{
|
||||
std::string val(get_ip());
|
||||
child->set_value("cur", val.c_str());
|
||||
child->set_value("default", val.c_str());
|
||||
child->release();
|
||||
}
|
||||
|
||||
text = std::move(jsn->to_string());
|
||||
}
|
||||
|
|
|
@ -801,18 +801,18 @@ SANE_Status hg_sane_middleware::control_option(SANE_Handle h, const void* option
|
|||
if (action == SANE_ACTION_SET_AUTO)
|
||||
{
|
||||
if(after.empty())
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "Restore '%s' = %s\n"
|
||||
, title.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "Restore %d - '%s' = %s\n"
|
||||
, (int)(long)option, title.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
else
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "Restore '%s' to '%s' = %s\n"
|
||||
, title.c_str(), after.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "Restore %d - '%s' to '%s' = %s\n"
|
||||
, (int)(long)option, title.c_str(), after.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
}
|
||||
else if(before != after)
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "set '%s' to '%s'(APPLIED: %s) = %s\n"
|
||||
, title.c_str(), before.c_str(), after.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "set %d - '%s' to '%s'(APPLIED: %s) = %s\n"
|
||||
, (int)(long)option, title.c_str(), before.c_str(), after.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
else
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "set '%s' to '%s' = %s\n"
|
||||
, title.c_str(), before.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
utils::to_log_with_api(hg_scanner_log_is_enable, hg_scanner_log, LOG_LEVEL_DEBUG, "set %d - '%s' to '%s' = %s\n"
|
||||
, (int)(long)option, title.c_str(), before.c_str(), hg_scanner_err_description(local_utility::sane_statu_2_scanner_err(err)));
|
||||
}
|
||||
|
||||
// extension ...
|
||||
|
|
|
@ -397,7 +397,6 @@ bool sane_options::init_from(const char* jsn_text/*all options*/, void(*err_msg)
|
|||
|
||||
while (child)
|
||||
{
|
||||
str = std::move(child->to_string());
|
||||
sn++;
|
||||
ret = add_or_replace_opt(sn, child, err_msg);
|
||||
child->release();
|
||||
|
@ -438,7 +437,11 @@ bool sane_options::add_or_replace_opt(int& sn, gb_json* jsn, void(*err_msg)(cons
|
|||
|
||||
if (opts_.count(id))
|
||||
{
|
||||
return opts_[id]->from_json_object(jsn, err_msg);
|
||||
bool ret = opts_[id]->from_json_object(jsn, err_msg);
|
||||
if (!opts_[id]->is_visible())
|
||||
sn--;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
sane_opt* opt = new sane_opt();
|
||||
|
|
Loading…
Reference in New Issue