序列号和畸变调整
This commit is contained in:
parent
66803c9b29
commit
7ef134bdaf
|
@ -96,8 +96,9 @@ void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, si
|
||||||
emit m_burnMode->testResult(flag);
|
emit m_burnMode->testResult(flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ev == TEST_EVENT_DISTORTION)
|
else if (ev == TEST_EVENT_DISTORTION_VAL)
|
||||||
{
|
{
|
||||||
|
float f = *(float*)data;
|
||||||
QString title = QString::fromStdWString(name);
|
QString title = QString::fromStdWString(name);
|
||||||
emit m_interface->testDistortion(title, data);
|
emit m_interface->testDistortion(title, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
TEST_EVENT_MANUAL_CONFIRMATION, // After send cmd ,need manual confirmation.
|
TEST_EVENT_MANUAL_CONFIRMATION, // After send cmd ,need manual confirmation.
|
||||||
TEST_EVENT_RESULT, // test result, data is (wchar_t*)description, flag is (bool)result, true - test pass
|
TEST_EVENT_RESULT, // test result, data is (wchar_t*)description, flag is (bool)result, true - test pass
|
||||||
TEST_EVENT_HAVE_IMAGE, // have image.
|
TEST_EVENT_HAVE_IMAGE, // have image.
|
||||||
TEST_EVENT_DISTORTION, //
|
TEST_EVENT_DISTORTION_VAL, // get distortion_val, data is (float) data > 0 flag is true else false
|
||||||
TEST_EVENT_FALT_INFO, //
|
TEST_EVENT_FALT_INFO, //
|
||||||
};
|
};
|
||||||
virtual void test_callback(const wchar_t* name/*test name*/, test_event ev, void* data, size_t flag)=0 ;
|
virtual void test_callback(const wchar_t* name/*test name*/, test_event ev, void* data, size_t flag)=0 ;
|
||||||
|
|
|
@ -30,7 +30,7 @@ static struct Test_Map
|
||||||
{HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_IMAGEING_QUALITY},
|
{HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_IMAGEING_QUALITY},
|
||||||
{HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_BIAS_IMAGEING_QUALITY},
|
{HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_BIAS_IMAGEING_QUALITY},
|
||||||
{HGPDTTOOLDB_NAME_CLARITY_QUALITY ,HGPDTTOOLDB_TITLE_CLARITY_QUALITY},
|
{HGPDTTOOLDB_NAME_CLARITY_QUALITY ,HGPDTTOOLDB_TITLE_CLARITY_QUALITY},
|
||||||
{HGPDTTOOLDB_NAME_DISTORTION ,HGPDTTOOLDB_TITLE_DISTORTION},
|
{HGPDTTOOLDB_NAME_GET_DISTORTION_VAL ,HGPDTTOOLDB_TITLE_DISTORTION},
|
||||||
{HGPDTTOOLDB_NAME_SEPARATER_MOTOR ,HGPDTTOOLDB_TITLE_SEPARATER_MOTOR},
|
{HGPDTTOOLDB_NAME_SEPARATER_MOTOR ,HGPDTTOOLDB_TITLE_SEPARATER_MOTOR},
|
||||||
{HGPDTTOOLDB_NAME_CLEAR_PAPER_PATH ,HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH},
|
{HGPDTTOOLDB_NAME_CLEAR_PAPER_PATH ,HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH},
|
||||||
{HGPDTTOOLDB_NAME_SKEW_DETECTION ,HGPDTTOOLDB_TITLE_SKEW_DETECTION},
|
{HGPDTTOOLDB_NAME_SKEW_DETECTION ,HGPDTTOOLDB_TITLE_SKEW_DETECTION},
|
||||||
|
@ -121,6 +121,7 @@ int get_json_config_file()
|
||||||
std::cout << buf << std::endl;
|
std::cout << buf << std::endl;
|
||||||
}
|
}
|
||||||
static std::wstring set_test_name_ =L"";
|
static std::wstring set_test_name_ =L"";
|
||||||
|
bool is_distortion_get_image = false;
|
||||||
class test
|
class test
|
||||||
{
|
{
|
||||||
ui_helper* helper_;
|
ui_helper* helper_;
|
||||||
|
@ -360,19 +361,19 @@ public:
|
||||||
wcscpy(buf, L"平场校正失败, 原因--->");
|
wcscpy(buf, L"平场校正失败, 原因--->");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_DISTORTION) == 0)
|
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0 || strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_DISTORTION) == 0)
|
if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0 || strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_DISTORTION) == 0)
|
||||||
{
|
{
|
||||||
type = false;
|
type = false;
|
||||||
wcscpy(buf, L"畸变修正失败,原因--->");
|
wcscpy(buf, L"畸变修正值获取失败,原因--->");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = true;
|
type = true;
|
||||||
wcscpy(buf, L"畸变修正完成:");
|
wcscpy(buf, L"畸变修正值获取完成:");
|
||||||
}
|
}
|
||||||
ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &close, &closelen);//结束恢复默认
|
//ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &close, &closelen);//结束恢复默认
|
||||||
}
|
}
|
||||||
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0)
|
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0)
|
||||||
{
|
{
|
||||||
|
@ -471,13 +472,17 @@ public:
|
||||||
{
|
{
|
||||||
if ( wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0
|
if ( wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0
|
||||||
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0
|
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0
|
||||||
//||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_DISTORTION) == 0
|
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SCANNING_SENSOR) == 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_IMAGEING_QUALITY) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CLARITY_QUALITY) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CLARITY_QUALITY) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST) == 0)
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST) == 0)
|
||||||
{
|
{
|
||||||
|
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0)
|
||||||
|
{
|
||||||
|
is_distortion_get_image = true;
|
||||||
|
}
|
||||||
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_HAVE_IMAGE, data, true);
|
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_HAVE_IMAGE, data, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -527,7 +532,9 @@ public:
|
||||||
test_map_[HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD] = &test::test_auto_flat_field;
|
test_map_[HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD] = &test::test_auto_flat_field;
|
||||||
test_map_[HGPDTTOOLDB_NAME_REBOOT_DEVICE] = &test::test_reboot_device;
|
test_map_[HGPDTTOOLDB_NAME_REBOOT_DEVICE] = &test::test_reboot_device;
|
||||||
test_map_[HGPDTTOOLDB_NAME_IMAGE_QUALITY] = &test::test_image_quality;
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_QUALITY] = &test::test_image_quality;
|
||||||
test_map_[HGPDTTOOLDB_NAME_DISTORTION] = &test::test_distortion;
|
|
||||||
|
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_DORMANCY] = &test::test_dormancy;
|
test_map_[HGPDTTOOLDB_NAME_DORMANCY] = &test::test_dormancy;
|
||||||
test_map_[HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH] = &test::test_paper_separation_strength;
|
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;
|
test_map_[HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION] = &test::test_mech_paper_feeding_inclination;
|
||||||
|
@ -598,7 +605,73 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*设置序列号*/
|
||||||
|
int test_set_json_serial_num(void* data)
|
||||||
|
{
|
||||||
|
int ret = SCANNER_ERR_OK,
|
||||||
|
val = 0;
|
||||||
|
wchar_t* sn;
|
||||||
|
|
||||||
|
std::string set_sn,get_sn;
|
||||||
|
size_t len = 0;
|
||||||
|
parameter* prt = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_FLOAT, set_test_name_.c_str(), L"请设置序列号");
|
||||||
|
if (!prt)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"已退出序列号设置", false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sn = (wchar_t*)prt->get_data();
|
||||||
|
if (!sn)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置序列号失败", false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ret = wchar_to_char(set_sn, sn, &len);
|
||||||
|
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
{
|
||||||
|
if (fw_ == 3 || fw_ == 4)
|
||||||
|
{
|
||||||
|
if (len != 14)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置序列号不足:14位", false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
set_sn.resize(len);
|
||||||
|
ret = wchar_to_char(set_sn, sn, &len);
|
||||||
|
}
|
||||||
|
unsigned int setlen = set_sn.size(),
|
||||||
|
getlen = 0;
|
||||||
|
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_SERIAL, &set_sn[0], &setlen);
|
||||||
|
|
||||||
|
if (ret != SCANNER_ERR_OK)return ret;
|
||||||
|
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_GET_SERIAL, &get_sn[0], &getlen);
|
||||||
|
if (ret == SANE_STATUS_NO_MEM)
|
||||||
|
{
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_GET_SERIAL, &get_sn[0], &setlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set_sn == get_sn)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置序列号完成", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置序列号失败", true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
/* 清理纸道功能确认 */
|
/* 清理纸道功能确认 */
|
||||||
int tset_clear_paper_path(void *data)
|
int tset_clear_paper_path(void *data)
|
||||||
{
|
{
|
||||||
|
@ -785,15 +858,93 @@ public:
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* 畸变修正 */
|
/* 获取自动计算畸变值 */
|
||||||
int test_distortion(void *data)
|
int test_get_auto_distortion(void *data)
|
||||||
{
|
{
|
||||||
const wchar_t* NAME = set_test_name_.c_str();
|
int ret = SCANNER_ERR_OK,
|
||||||
|
val = 0;
|
||||||
SANE_Bool type = true;
|
SANE_Bool type = true;
|
||||||
unsigned int len = sizeof(SANE_Bool);
|
unsigned int len = sizeof(SANE_Bool),
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &type, &len);
|
llen = sizeof(int);
|
||||||
|
helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (is_distortion_get_image)
|
||||||
|
{
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_CHECK_VAL, &val, &llen);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
Sleep(2);
|
||||||
|
}
|
||||||
|
if (val > 0)
|
||||||
|
{
|
||||||
|
float f = *(float*)&val;
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&f, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
int test_set_auto_distortion(void* data)
|
||||||
|
{
|
||||||
|
int ret = SCANNER_ERR_OK,
|
||||||
|
val = 0;
|
||||||
|
unsigned int len = sizeof(int);
|
||||||
|
float distortion =0.0;
|
||||||
|
parameter* prt = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_FLOAT, set_test_name_.c_str(), L"请设置畸变值");
|
||||||
|
if (!prt)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"已退出畸变值设置", false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
void * p = prt->get_data();
|
||||||
|
distortion = *(float*)p;
|
||||||
|
}
|
||||||
|
if (distortion == 0.0)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void *)L"已退出畸变值设置", false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int setdistortion = *(int*)&distortion;
|
||||||
|
int getdistortion = 0;
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_CHECK_VAL, &setdistortion, &len);
|
||||||
|
if (ret != SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_DEVS_CHECK_VAL, &getdistortion, &len);
|
||||||
|
if (ret != SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
wchar_t buf[128];
|
||||||
|
if (setdistortion != getdistortion)
|
||||||
|
{
|
||||||
|
wchar_t buf[30] = L"设置畸变值失败...现在畸变值是:";
|
||||||
|
wchar_t c[10];
|
||||||
|
float f = *(float*)&getdistortion;
|
||||||
|
wsprintfW(c, L"%fppm", f);
|
||||||
|
wcscat(buf, c);
|
||||||
|
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, buf, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wchar_t buf[30] = L"设置畸变值成功...现在畸变值是:";
|
||||||
|
wchar_t c[10];
|
||||||
|
float f = *(float*)&getdistortion;
|
||||||
|
wsprintfW(c, L"%fppm", f);
|
||||||
|
wcscat(buf, c);
|
||||||
|
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, buf, false);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
/* 分纸强度检测 */
|
/* 分纸强度检测 */
|
||||||
int test_paper_separation_strength(void *data)
|
int test_paper_separation_strength(void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,6 +80,8 @@
|
||||||
#define HGPDTTOOLDB_TITLE_PRESSUER_TEST_GRAY_300DPI L"压力测试灰色_300dpi"
|
#define HGPDTTOOLDB_TITLE_PRESSUER_TEST_GRAY_300DPI L"压力测试灰色_300dpi"
|
||||||
//////////////////////////////////////NAME//////////////////////////////////////
|
//////////////////////////////////////NAME//////////////////////////////////////
|
||||||
#define WRITE_CFG_NAME L"write-cfg"
|
#define WRITE_CFG_NAME L"write-cfg"
|
||||||
|
/* 设置json序列号 */
|
||||||
|
#define HGPDTTOOLDB_NAME_SET_JSON_SN L"SET_JSON_SN"
|
||||||
/* 拨码开关校验 */
|
/* 拨码开关校验 */
|
||||||
#define HGPDTTOOLDB_NAME_DIAL_SWITCH L"DIAL_SWITCH"
|
#define HGPDTTOOLDB_NAME_DIAL_SWITCH L"DIAL_SWITCH"
|
||||||
/* 检查船型开关功能 */
|
/* 检查船型开关功能 */
|
||||||
|
@ -130,8 +132,10 @@
|
||||||
#define HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY L"COLORCARD_BIAS_IMAGEING_QUALITY"
|
#define HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY L"COLORCARD_BIAS_IMAGEING_QUALITY"
|
||||||
/* 清晰度质量评估 */
|
/* 清晰度质量评估 */
|
||||||
#define HGPDTTOOLDB_NAME_CLARITY_QUALITY L"CLARITY_QUALITY"
|
#define HGPDTTOOLDB_NAME_CLARITY_QUALITY L"CLARITY_QUALITY"
|
||||||
/* 畸变修正 */
|
/* 获取畸变修正值 */
|
||||||
#define HGPDTTOOLDB_NAME_DISTORTION L"DISTORTION"
|
#define HGPDTTOOLDB_NAME_GET_DISTORTION_VAL L"GET_DISTORTION_VAL"
|
||||||
|
/* 设置畸变修正值 */
|
||||||
|
#define HGPDTTOOLDB_NAME_SET_DISTORTION_VAL L"SET_DISTORTION_VAL"
|
||||||
/* 设置休眠 */
|
/* 设置休眠 */
|
||||||
#define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY"
|
#define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY"
|
||||||
/* 歪斜挡位检测 */
|
/* 歪斜挡位检测 */
|
||||||
|
|
Loading…
Reference in New Issue