响应获取默认值命令;button & group属性不支持获取值操作
This commit is contained in:
parent
9efd34e96e
commit
d3e8b91233
|
@ -1738,7 +1738,11 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SANE_Int id = -1;
|
SANE_Int id = -1;
|
||||||
find_stored_descriptor(handle, option, &id);
|
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option);
|
||||||
|
if (desc &&
|
||||||
|
(desc->type == SANE_TYPE_BUTTON || desc->type == SANE_TYPE_GROUP))
|
||||||
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
|
|
||||||
if (dev->std_opt && dev->std_opt->is_known_option(id))
|
if (dev->std_opt && dev->std_opt->is_known_option(id))
|
||||||
{
|
{
|
||||||
dev->std_opt->get_value(h, id, value);
|
dev->std_opt->get_value(h, id, value);
|
||||||
|
@ -1750,7 +1754,24 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else if (action == SANE_ACTION_GET_DEFAULT_VALUE)
|
||||||
|
{
|
||||||
|
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option);
|
||||||
|
if (desc &&
|
||||||
|
(desc->type == SANE_TYPE_BUTTON || desc->type == SANE_TYPE_GROUP))
|
||||||
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
|
|
||||||
|
int len = 0;
|
||||||
|
void* val = get_default_value(handle, option, &len);
|
||||||
|
if (!val)
|
||||||
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
|
|
||||||
|
memcpy(value, val, len);
|
||||||
|
local_utility::free_memory(val);
|
||||||
|
|
||||||
|
return SANE_STATUS_GOOD;
|
||||||
|
}
|
||||||
|
else if(action == SANE_ACTION_SET_AUTO || action == SANE_ACTION_SET_VALUE)
|
||||||
{
|
{
|
||||||
SANE_Int id = -1;
|
SANE_Int id = -1;
|
||||||
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option, &id);
|
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option, &id);
|
||||||
|
@ -1897,6 +1918,8 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
}
|
}
|
||||||
bool hg_sane_middleware::get_cur_value(SANE_Handle handle, void* option, void* value, SANE_Value_Type* type)
|
bool hg_sane_middleware::get_cur_value(SANE_Handle handle, void* option, void* value, SANE_Value_Type* type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue