新增获取固件,平场校正设置dpi颜色

This commit is contained in:
13038267101 2023-03-06 11:36:06 +08:00
parent 46ae654ac6
commit bf848326aa
2 changed files with 76 additions and 3 deletions

View File

@ -39,10 +39,11 @@ static struct Test_Map
{HGPDTTOOLDB_NAME_REBOOT_DEVICE ,HGPDTTOOLDB_TITLE_REBOOT_DEVICE},
{HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION ,HGPDTTOOLDB_TITLE_MECH_PAPER_FEEDING_INCLINATION},
{HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT ,HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT},
{HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT ,HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT},
{HGPDTTOOLDB_NAME_CLEAR_HISTORY_COUNT ,HGPDTTOOLDB_TITLE_CLEAR_HISTORY_COUNT},
{HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH ,HGPDTTOOLDB_TITLE_PAPER_SEPARATION_STRENGTH},
{HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE ,HGPDTTOOLDB_TITLE_CONFIGURE_SPEED_MODE},
{HGPDTTOOLDB_NAME_DORMANCY ,HGPDTTOOLDB_TITLE_DORMANCY},
{HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG ,HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG}
};
static std::string StringToUtf(std::string strValue)
@ -867,7 +868,28 @@ public:
/* 自动平场校正 */
int test_auto_flat_field(void *data)
{
return helper_->io_control(IO_CTRL_CODE_SET_AUTO_FALT, NULL, NULL);;
if (!data)
return SCANNER_ERR_DATA_DAMAGED;
unsigned int len = sizeof(int);
wchar_t* p = (wchar_t*)data;
std::string str;
int ret = SCANNER_ERR_OK,
dpi_type = 0;
unsigned int llen = sizeof(int);
size_t strl = 0;
ret = wchar_to_char(str, p, &strl);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
str.resize(strl);
ret = wchar_to_char(str, p, &strl);
if (str.empty())
{
return SCANNER_ERR_DATA_DAMAGED;
}
dpi_type = atoi(str.c_str());
}
return helper_->io_control(IO_CTRL_CODE_SET_AUTO_FALT, &dpi_type, &len);;
}
/* 重启设备 */
int test_reboot_device(void *data)
@ -1075,6 +1097,11 @@ public:
}
int setdistortion = *(int*)&distortion;
int getdistortion = 0;
//先默认设置1
int in = 1;
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_CHECK_VAL, &in, &len);
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_CHECK_VAL, &setdistortion, &len);
if (ret != SCANNER_ERR_OK)
{
@ -1128,6 +1155,30 @@ public:
return ret;
}
/* 清除历史计数 */
int test_clear_history_count(void* data)
{
SANE_Int num = -1;
const wchar_t* info = NULL;
bool type = false;
unsigned int len = sizeof(SANE_Int);
int ret = helper_->io_control(IO_CTRL_CODE_SET_CLEAR_HISTORY_COUNT, NULL, NULL);
ret = helper_->io_control(IO_CTRL_CODE_GET_HISTORY_SCAN_NUM, &num, &len);
if ((num == 0 && num != -1))
{
type = true;
info = L"清除历史计数成功";
}
else
{
type = false;
info = L"清除历史计数成功";
}
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)info, type);
return ret;
}
/* 单张测试 */
int test_single_page_test(void* data)
{
@ -1250,6 +1301,22 @@ public:
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_CONFIG_SP, (void*)&save_num, true);
std::string fw(get_firmware_version());
size_t fwlen= 0;
wstr.clear();
ret = str_to_wchar(fw.c_str(), (wchar_t*)wstr.c_str(), &fwlen);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
wstr.resize(fwlen);
ret = str_to_wchar(fw.c_str(), (wchar_t*)wstr.c_str(), &fwlen);
}
if (wstr.empty())
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_CONFIG_FW, (void*)L"获取固件号失败", false);
return ret;
}
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_CONFIG_FW, (void*)wstr.c_str(), true);
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)(L"配置获取完成"), true);
return ret;
}

View File

@ -70,6 +70,8 @@
#define HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_1 L"单张测试"
/* 清除滚轴计数 */
#define HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT L"清除滚轴计数"
/* 清除滚轴计数 */
#define HGPDTTOOLDB_TITLE_CLEAR_HISTORY_COUNT L"清除历史计数"
/*压力测试彩色+200dpi*/
#define HGPDTTOOLDB_TITLE_PRESSUER_TEST_RGB_200DPI L"压力测试彩色_200dpi"
/*压力测试灰色+200dpi*/
@ -78,6 +80,8 @@
#define HGPDTTOOLDB_TITLE_PRESSUER_TEST_GRAY_200DPI L"压力测试灰色_200dpi"
/*压力测试灰色+300dpi*/
#define HGPDTTOOLDB_TITLE_PRESSUER_TEST_GRAY_300DPI L"压力测试灰色_300dpi"
/*获取设备配置*/
#define HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG L"获取设备配置"
//////////////////////////////////////NAME//////////////////////////////////////
#define WRITE_CFG_NAME L"write-cfg"
/* 设置json序列号 */
@ -152,6 +156,8 @@
#define HGPDTTOOLDB_NAME_PRESSUER_TEST L"PRESSUER_TEST"
/* 清除滚轴计数 */
#define HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT L"CLEAR_ROLLER_COUNT"
/* 清除历史计数 */
#define HGPDTTOOLDB_NAME_CLEAR_HISTORY_COUNT L"CLEAR_HISTORY_COUNT"
/*压力测试彩色+200dpi*/
#define HGPDTTOOLDB_NAME_PRESSUER_TEST_RGB_200DPI L"PRESSUER_TEST_RGB_200DPI"
/*压力测试灰色+200dpi*/