增加确认畸变值测试项

This commit is contained in:
yangjiaxuan 2023-03-14 18:00:47 +08:00
parent 3f9bb9a9bb
commit 3c950f8577
2 changed files with 69 additions and 1 deletions

View File

@ -369,7 +369,7 @@ public:
wcscpy(buf, L"平场校正失败, 原因--->");
}
}
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0)
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0 || wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL) == 0)
{
if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0 || strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_DISTORTION) == 0)
@ -489,6 +489,7 @@ public:
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_GRAY_QUALITY) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SCANNING_SENSOR) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY) == 0
@ -546,6 +547,7 @@ public:
test_map_[HGPDTTOOLDB_NAME_GET_DISTORTION_VAL] = &test::test_get_auto_distortion;
test_map_[HGPDTTOOLDB_NAME_SET_DISTORTION_VAL] = &test::test_set_auto_distortion;
test_map_[HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL] = &test::test_confirm_auto_distortion;
test_map_[HGPDTTOOLDB_NAME_DORMANCY] = &test::test_dormancy;
test_map_[HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH] = &test::test_paper_separation_strength;
test_map_[HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION] = &test::test_mech_paper_feeding_inclination;
@ -1130,6 +1132,70 @@ public:
return ret;
}
int test_confirm_auto_distortion(void *data)
{
if (!data )
{
return SCANNER_ERR_DATA_DAMAGED;
}
wchar_t* p = (wchar_t*)data;
std::string str;
int ret = SCANNER_ERR_OK,
dpi = 0;
SANE_Bool type = true;
unsigned int len = sizeof(SANE_Bool),
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 = atoi(str.c_str());
}
if (dpi > 0)
{
ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &llen);
}
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
if (ret != SCANNER_ERR_OK)
{
return ret;
}
int cnt = 0;
SANE_DISTORTION_VAL dis = { 0 };
while (ret == SCANNER_ERR_OK)
{
if (is_distortion_get_image)
{
ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_CHECK_VAL, &dis, &llen);
break;
}
else if (cnt == 30)
break;
if (is_distortion_get_image_abnormal)
return -1;
Sleep(1000);
cnt++;
}
if (dis.h > 0 && dis.scaleXY < 10)
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true);
}
else
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false);
}
return ret;
}
/* 分纸强度检测 */
int test_paper_separation_strength(void *data)
{

View File

@ -142,6 +142,8 @@
#define HGPDTTOOLDB_NAME_GET_DISTORTION_VAL L"GET_DISTORTION_VAL"
/* 设置畸变修正值 */
#define HGPDTTOOLDB_NAME_SET_DISTORTION_VAL L"SET_DISTORTION_VAL"
/* 确认畸变修正值 */
#define HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL L"CONFIRM_DISTORTION_VAL"
/* 设置休眠 */
#define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY"
/* 歪斜挡位检测 */