添加自定义GAMMA属性访问接口
This commit is contained in:
parent
6cea8a7632
commit
9efd34e96e
|
@ -864,6 +864,9 @@ scanner_err hg_scanner_mgr::hg_scanner_get_parameter(scanner_handle h, const cha
|
|||
else
|
||||
return SCANNER_ERR_ACCESS_DENIED;
|
||||
}
|
||||
else if (strcmp(SANE_STD_OPT_NAME_CUSTOM_GAMMA, name) == 0)
|
||||
return (scanner_err)SCAN_PTR(h)->device_io_control(IO_CTRL_CODE_GET_CUSTOM_GAMMA, data, (unsigned int*)len);
|
||||
|
||||
if (strcmp(SANE_STD_OPT_NAME_LOGIN, name) == 0 ||
|
||||
strcmp(SANE_STD_OPT_NAME_LOGOUT, name) == 0)
|
||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||
|
@ -943,6 +946,8 @@ scanner_err hg_scanner_mgr::hg_scanner_set_parameter(scanner_handle h, const cha
|
|||
|
||||
return SCANNER_ERR_ACCESS_DENIED;
|
||||
}
|
||||
else if (strcmp(SANE_STD_OPT_NAME_CUSTOM_GAMMA, name) == 0)
|
||||
return (scanner_err)SCAN_PTR(h)->device_io_control(IO_CTRL_CODE_SET_CUSTOM_GAMMA, data, (unsigned int*)len);
|
||||
}
|
||||
|
||||
return (scanner_err)SCAN_PTR(h)->set_setting(name, data, len);
|
||||
|
|
|
@ -394,6 +394,8 @@ namespace local_utility
|
|||
FIX_ID_TO_NAME(DEVICE_IP_ADDR, 255);
|
||||
FIX_ID_TO_NAME(DEVICE_MAC_ADDR, 255);
|
||||
|
||||
FIX_ID_TO_NAME(CUSTOM_GAMMA, sizeof(SANE_Gamma));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -1357,17 +1359,21 @@ bool hg_sane_middleware::get_current_value(scanner_handle handle, const void* op
|
|||
|
||||
if(!name.empty())
|
||||
{
|
||||
char buf[256] = { 0 };
|
||||
long len = sizeof(buf) - 1;
|
||||
char *buf = new char[l + 4];
|
||||
long len = l;
|
||||
bool ret = false;
|
||||
|
||||
memcpy(buf, value, l);
|
||||
buf[l] = 0;
|
||||
if (hg_scanner_get_parameter(handle, name.c_str(), buf, &len) == SCANNER_ERR_OK)
|
||||
{
|
||||
setv(buf, len, value);
|
||||
|
||||
return true;
|
||||
ret = true;
|
||||
}
|
||||
delete[] buf;
|
||||
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue