生产工具增加测试项:验证畸变值,调整获取畸变界面卡死的问题
This commit is contained in:
parent
5f009ccd27
commit
5b8a9fcd15
|
@ -78,7 +78,7 @@ parameter *Dialog_UserInput::getParam()
|
||||||
|
|
||||||
void Dialog_UserInput::setDistortValue(double value)
|
void Dialog_UserInput::setDistortValue(double value)
|
||||||
{
|
{
|
||||||
ui->lineEdit->setText(QString::number(value, 'f'));
|
ui->lineEdit->setText(QString::number(value, 'f', 4));
|
||||||
ui->lineEdit->selectAll();
|
ui->lineEdit->selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,18 +273,22 @@ void Form_mainInterface::on_testResultImg(void *img)
|
||||||
HGBase_DestroyImage(image);
|
HGBase_DestroyImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form_mainInterface::on_testDistortion(SANE_DISTORTION_VAL data)
|
void Form_mainInterface::on_testDistortion(float width, float height, float distortion, bool verify)
|
||||||
{
|
{
|
||||||
ui->label_imgInfo->setVisible(true);
|
ui->label_imgInfo->setVisible(true);
|
||||||
ui->label_destortionInfo_200dpi->setVisible(true);
|
|
||||||
ui->label_destortionInfo_300dpi->setVisible(true);
|
|
||||||
|
|
||||||
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number((data.w > 0 && data.w < 9999) ? data.w : 0.0, 'f') +
|
ui->label_destortionInfo_200dpi->setVisible(!verify);
|
||||||
" * " + QString::number((data.h > 0 && data.h < 9999) ? data.h : 0.0, 'f'));
|
ui->label_destortionInfo_300dpi->setVisible(!verify);
|
||||||
|
|
||||||
|
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number((width > 0 && width < 9999) ? width : 0.0, 'f', 4) +
|
||||||
|
" * " + QString::number((height > 0 && height < 9999) ? height : 0.0, 'f', 4));
|
||||||
|
|
||||||
|
if (!verify)
|
||||||
|
{
|
||||||
if (200 == m_curDpi)
|
if (200 == m_curDpi)
|
||||||
{
|
{
|
||||||
m_distortion_200dpi = data.scaleXY > 0 ? data.scaleXY : 0;
|
m_distortion_200dpi = distortion > 0 ? distortion : 0;
|
||||||
ui->label_destortionInfo_200dpi->setText(" 200dpi" + tr("destortion value: ") + QString::number(m_distortion_200dpi, 'f'));
|
ui->label_destortionInfo_200dpi->setText(" 200dpi" + tr("destortion value: ") + QString::number(m_distortion_200dpi, 'f', 4));
|
||||||
|
|
||||||
if (m_hg != nullptr)
|
if (m_hg != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -293,8 +297,8 @@ void Form_mainInterface::on_testDistortion(SANE_DISTORTION_VAL data)
|
||||||
}
|
}
|
||||||
else if (300 == m_curDpi)
|
else if (300 == m_curDpi)
|
||||||
{
|
{
|
||||||
m_distortion_300dpi = data.scaleXY > 0 ? data.scaleXY : 0;
|
m_distortion_300dpi = distortion > 0 ? distortion : 0;
|
||||||
ui->label_destortionInfo_300dpi->setText(" 300dpi" + tr("destortion value: ") + QString::number(m_distortion_300dpi, 'f'));
|
ui->label_destortionInfo_300dpi->setText(" 300dpi" + tr("destortion value: ") + QString::number(m_distortion_300dpi, 'f', 4));
|
||||||
|
|
||||||
if (m_hg != nullptr)
|
if (m_hg != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -303,16 +307,15 @@ void Form_mainInterface::on_testDistortion(SANE_DISTORTION_VAL data)
|
||||||
}
|
}
|
||||||
else if (600 == m_curDpi)
|
else if (600 == m_curDpi)
|
||||||
{
|
{
|
||||||
m_distortion_600dpi = data.scaleXY > 0 ? data.scaleXY : 0;
|
m_distortion_600dpi = distortion > 0 ? distortion : 0;
|
||||||
ui->label_destortionInfo_600dpi->setText(" 600dpi" + tr("destortion value: ") + QString::number(m_distortion_600dpi, 'f'));
|
ui->label_destortionInfo_600dpi->setText(" 600dpi" + tr("destortion value: ") + QString::number(m_distortion_600dpi, 'f', 4));
|
||||||
|
|
||||||
if (m_hg != nullptr)
|
if (m_hg != nullptr)
|
||||||
{
|
{
|
||||||
m_hg->setDistortValue(m_distortion_600dpi);
|
m_hg->setDistortValue(m_distortion_600dpi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// updateImgPixelInfo();
|
|
||||||
|
|
||||||
updateUiEnabled(true);
|
updateUiEnabled(true);
|
||||||
m_isTesting = false;
|
m_isTesting = false;
|
||||||
|
@ -404,9 +407,9 @@ void Form_mainInterface::on_testGetDevdistortion(float dis_200dpi, float dis_300
|
||||||
{
|
{
|
||||||
QString info;
|
QString info;
|
||||||
info.append(tr("The device distortion:") + "\n\n\t");
|
info.append(tr("The device distortion:") + "\n\n\t");
|
||||||
info.append(tr("200dpi: %1").arg(QString::number(dis_200dpi, 'f', 6)) + "\n\t");
|
info.append(tr("200dpi: %1").arg(QString::number(dis_200dpi, 'f', 4)) + "\n\t");
|
||||||
info.append(tr("300dpi: %1").arg(QString::number(dis_300dpi, 'f', 6)) + "\n\t");
|
info.append(tr("300dpi: %1").arg(QString::number(dis_300dpi, 'f', 4)) + "\n\t");
|
||||||
info.append(tr("600dpi: %1").arg(QString::number(dis_600dpi, 'f', 6)));
|
info.append(tr("600dpi: %1").arg(QString::number(dis_600dpi, 'f', 4)));
|
||||||
|
|
||||||
m_textTips->setViewContent(info);
|
m_textTips->setViewContent(info);
|
||||||
}
|
}
|
||||||
|
@ -958,13 +961,20 @@ void Form_mainInterface::on_pbtn_start_clicked()
|
||||||
{
|
{
|
||||||
resetCorrectItems();
|
resetCorrectItems();
|
||||||
}
|
}
|
||||||
|
if (name == HGPDTTOOLDB_NAME_VERIFY_DISTORTION_VAL && title.contains("200dpi"))
|
||||||
|
{
|
||||||
|
ui->label_imgInfo->clear();
|
||||||
|
ui->label_destortionInfo_200dpi->clear();
|
||||||
|
ui->label_destortionInfo_300dpi->clear();
|
||||||
|
ui->label_destortionInfo_600dpi->clear();
|
||||||
|
}
|
||||||
|
|
||||||
int dpi = 0;
|
int dpi = 0;
|
||||||
if (title == "扫描图像彩色质量确认_200dpi" || title == "扫描图像灰度质量确认_200dpi" || title == "计算畸变修正值_200dpi" || title == "设置畸变修正值_200dpi")
|
if (title.contains("200dpi")) // == "扫描图像彩色质量确认_200dpi" || title == "扫描图像灰度质量确认_200dpi" || title == "计算畸变修正值_200dpi" || title == "设置畸变修正值_200dpi")
|
||||||
dpi = 200;
|
dpi = 200;
|
||||||
else if (title == "扫描图像彩色质量确认_300dpi" || title == "扫描图像灰度质量确认_300dpi" || title == "计算畸变修正值_300dpi" || title == "设置畸变修正值_300dpi")
|
else if (title.contains("300dpi"))// == "扫描图像彩色质量确认_300dpi" || title == "扫描图像灰度质量确认_300dpi" || title == "计算畸变修正值_300dpi" || title == "设置畸变修正值_300dpi")
|
||||||
dpi = 300;
|
dpi = 300;
|
||||||
else if (title == "扫描图像彩色质量确认_600dpi" || title == "扫描图像灰度质量确认_600dpi" || title == "计算畸变修正值_600dpi" || title == "设置畸变修正值_600dpi")
|
else if (title.contains("600dpi")) // == "扫描图像彩色质量确认_600dpi" || title == "扫描图像灰度质量确认_600dpi" || title == "计算畸变修正值_600dpi" || title == "设置畸变修正值_600dpi")
|
||||||
dpi = 600;
|
dpi = 600;
|
||||||
|
|
||||||
wchar_t buf[128] = {0};
|
wchar_t buf[128] = {0};
|
||||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
||||||
signals:
|
signals:
|
||||||
void testResult(QString text);
|
void testResult(QString text);
|
||||||
void testResultImg(void* img);
|
void testResultImg(void* img);
|
||||||
void testDistortion(SANE_DISTORTION_VAL data);
|
void testDistortion(float width, float height, float distortion, bool verify);
|
||||||
void testCorrectInfo(QString info);
|
void testCorrectInfo(QString info);
|
||||||
void testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel);
|
void testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel);
|
||||||
void testGetDevCpuDisk(int cpu, int disk);
|
void testGetDevCpuDisk(int cpu, int disk);
|
||||||
|
@ -50,7 +50,7 @@ signals:
|
||||||
private slots:
|
private slots:
|
||||||
void on_testResult(QString text);
|
void on_testResult(QString text);
|
||||||
void on_testResultImg(void* img);
|
void on_testResultImg(void* img);
|
||||||
void on_testDistortion(SANE_DISTORTION_VAL data);
|
void on_testDistortion(float width, float height, float distortion, bool verify);
|
||||||
void on_testCorrectInfo(QString info);
|
void on_testCorrectInfo(QString info);
|
||||||
void on_testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel);
|
void on_testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel);
|
||||||
void on_testGetDevCpuDisk(int cpu, int disk);
|
void on_testGetDevCpuDisk(int cpu, int disk);
|
||||||
|
|
|
@ -191,7 +191,16 @@ void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, si
|
||||||
{
|
{
|
||||||
if (m_interface != nullptr)
|
if (m_interface != nullptr)
|
||||||
{
|
{
|
||||||
emit m_interface->testDistortion(*((SANE_DISTORTION_VAL*)data));
|
SANE_DISTORTION_VAL *value = (SANE_DISTORTION_VAL*)data;
|
||||||
|
float width = value->w;
|
||||||
|
float height = value->h;
|
||||||
|
float distortion = value->scaleXY;
|
||||||
|
|
||||||
|
bool verify = false;
|
||||||
|
if (wcscmp(name, HGPDTTOOLDB_NAME_VERIFY_DISTORTION_VAL) == 0)
|
||||||
|
verify = true;
|
||||||
|
|
||||||
|
emit m_interface->testDistortion(width, height, distortion, verify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,6 +543,8 @@ void MainWindow::on_sane_create_interface(SaneParams *saneParams)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func_test_distortion();
|
||||||
|
|
||||||
mainInterface->getScanner()->cb_(saneParams->hdev, saneParams->code, saneParams->data, &saneParams->len, mainInterface->getScanner());
|
mainInterface->getScanner()->cb_(saneParams->hdev, saneParams->code, saneParams->data, &saneParams->len, mainInterface->getScanner());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,7 +392,9 @@ static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int
|
||||||
wcscpy(buf, L"平场校正失败, 原因--->");
|
wcscpy(buf, L"平场校正失败, 原因--->");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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)
|
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 ||
|
||||||
|
wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_VERIFY_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)
|
||||||
{
|
{
|
||||||
|
@ -400,6 +402,7 @@ static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int
|
||||||
is_distortion_get_image = false;
|
is_distortion_get_image = false;
|
||||||
is_distortion_get_image_abnormal = true;
|
is_distortion_get_image_abnormal = true;
|
||||||
wcscpy(buf, L"畸变修正值获取失败,原因--->");
|
wcscpy(buf, L"畸变修正值获取失败,原因--->");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -560,6 +563,7 @@ static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_GRAY_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_GET_DISTORTION_VAL) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL) == 0
|
||||||
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_VERIFY_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
|
||||||
|
@ -605,6 +609,10 @@ test::~test()
|
||||||
m_waitCorrect.notify_all();
|
m_waitCorrect.notify_all();
|
||||||
if (thread_dynamic_correct_handle.get() && thread_dynamic_correct_handle->joinable())
|
if (thread_dynamic_correct_handle.get() && thread_dynamic_correct_handle->joinable())
|
||||||
thread_dynamic_correct_handle->join();
|
thread_dynamic_correct_handle->join();
|
||||||
|
|
||||||
|
m_waitDistortion.notify_all();
|
||||||
|
if (thread_distortion_handle.get() && thread_distortion_handle->joinable())
|
||||||
|
thread_distortion_handle->join();
|
||||||
}
|
}
|
||||||
|
|
||||||
void test::init_test_map_()
|
void test::init_test_map_()
|
||||||
|
@ -636,6 +644,7 @@ void test::init_test_map_()
|
||||||
test_map_[HGPDTTOOLDB_NAME_GET_DISTORTION_VAL] = &test::test_get_auto_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_SET_DISTORTION_VAL] = &test::test_set_auto_distortion;
|
||||||
test_map_[HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL] = &test::test_confirm_auto_distortion;
|
test_map_[HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL] = &test::test_confirm_auto_distortion;
|
||||||
|
test_map_[HGPDTTOOLDB_NAME_VERIFY_DISTORTION_VAL] = &test::test_verify_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;
|
||||||
|
@ -752,6 +761,35 @@ void test::thread_dynamic_correct(std::string correctData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test::thread_distortion()
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(m_lock);
|
||||||
|
|
||||||
|
SANE_Bool type = true;
|
||||||
|
unsigned int len = sizeof(int);
|
||||||
|
|
||||||
|
int ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
|
||||||
|
if (ret != SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"自动计算畸变值获取失败", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
SANE_DISTORTION_VAL dis = { 0 };
|
||||||
|
|
||||||
|
m_waitDistortion.wait(lock);
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_GET_PC_DISTORTION_CHECK_VAL, &dis, &len);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int test::set_init_cfg(void* data)
|
int test::set_init_cfg(void* data)
|
||||||
{
|
{
|
||||||
const wchar_t* p = (const wchar_t*)data;
|
const wchar_t* p = (const wchar_t*)data;
|
||||||
|
@ -1188,38 +1226,11 @@ int test::test_get_auto_distortion(void* data)
|
||||||
|
|
||||||
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_DEVS_CHECK_VAL, &distortion, &len);
|
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_DEVS_CHECK_VAL, &distortion, &len);
|
||||||
|
|
||||||
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
|
if (thread_distortion_handle.get() && thread_distortion_handle->joinable())
|
||||||
if (ret != SCANNER_ERR_OK)
|
thread_distortion_handle->join();
|
||||||
{
|
thread_distortion_handle.reset(new std::thread(&test::thread_distortion, this));
|
||||||
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_PC_DISTORTION_CHECK_VAL, &dis, &llen);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (cnt == 20)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (is_distortion_get_image_abnormal)
|
return SCANNER_ERR_OK;
|
||||||
break;
|
|
||||||
|
|
||||||
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::test_set_auto_distortion(void* data)
|
int test::test_set_auto_distortion(void* data)
|
||||||
{
|
{
|
||||||
|
@ -1326,6 +1337,52 @@ int test::test_confirm_auto_distortion(void* data)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/* 扫描验证畸变值 */
|
||||||
|
int test::test_verify_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());
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_GET_PAPER_ON, &type, &llen);
|
||||||
|
if (!type)
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"自动计算畸变值获取失败: 无纸", false);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dpi > 0)
|
||||||
|
{
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &llen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thread_distortion_handle.get() && thread_distortion_handle->joinable())
|
||||||
|
thread_distortion_handle->join();
|
||||||
|
thread_distortion_handle.reset(new std::thread(&test::thread_distortion, this));
|
||||||
|
|
||||||
|
return SCANNER_ERR_OK;
|
||||||
|
}
|
||||||
/* 分纸强度检测 */
|
/* 分纸强度检测 */
|
||||||
int test::test_paper_separation_strength(void* data)
|
int test::test_paper_separation_strength(void* data)
|
||||||
{
|
{
|
||||||
|
@ -1900,3 +1957,14 @@ DECL_API(int) func_test_correct(bool isSuccess, int *currentIndex)
|
||||||
test_->m_waitCorrect.notify_all();
|
test_->m_waitCorrect.notify_all();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECL_API(int) func_test_distortion()
|
||||||
|
{
|
||||||
|
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0 ||
|
||||||
|
wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_VERIFY_DISTORTION_VAL) == 0)
|
||||||
|
{
|
||||||
|
test_->m_waitDistortion.notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -186,6 +186,8 @@
|
||||||
#define HGPDTTOOLDB_NAME_SET_DISTORTION_VAL L"SET_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_CONFIRM_DISTORTION_VAL L"CONFIRM_DISTORTION_VAL"
|
||||||
|
/* 扫描验证畸变修正值 */
|
||||||
|
#define HGPDTTOOLDB_NAME_VERIFY_DISTORTION_VAL L"VERIFY_DISTORTION_VAL"
|
||||||
/* 设置休眠 */
|
/* 设置休眠 */
|
||||||
#define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY"
|
#define HGPDTTOOLDB_NAME_DORMANCY L"DORMANCY"
|
||||||
/* 歪斜挡位检测 */
|
/* 歪斜挡位检测 */
|
||||||
|
@ -287,6 +289,7 @@ DECL_API(int) func_test_uninit(void*);
|
||||||
// Return: error code
|
// Return: error code
|
||||||
DECL_API(int) func_test_correct(bool isSuccess, int* currentIndex);
|
DECL_API(int) func_test_correct(bool isSuccess, int* currentIndex);
|
||||||
|
|
||||||
|
DECL_API(int) func_test_distortion();
|
||||||
|
|
||||||
class test
|
class test
|
||||||
{
|
{
|
||||||
|
@ -296,6 +299,7 @@ public:
|
||||||
|
|
||||||
std::map<std::wstring, int(test::*)(void*)> test_map_;
|
std::map<std::wstring, int(test::*)(void*)> test_map_;
|
||||||
std::condition_variable m_waitCorrect;
|
std::condition_variable m_waitCorrect;
|
||||||
|
std::condition_variable m_waitDistortion;
|
||||||
std::mutex m_lock;
|
std::mutex m_lock;
|
||||||
ui_helper* helper_;
|
ui_helper* helper_;
|
||||||
int fw_;
|
int fw_;
|
||||||
|
@ -310,6 +314,9 @@ private:
|
||||||
std::unique_ptr<std::thread> thread_dynamic_correct_handle;
|
std::unique_ptr<std::thread> thread_dynamic_correct_handle;
|
||||||
void thread_dynamic_correct(std::string correctData);
|
void thread_dynamic_correct(std::string correctData);
|
||||||
|
|
||||||
|
std::unique_ptr<std::thread> thread_distortion_handle;
|
||||||
|
void thread_distortion();
|
||||||
|
|
||||||
struct CorrectMode
|
struct CorrectMode
|
||||||
{
|
{
|
||||||
int dpi;
|
int dpi;
|
||||||
|
@ -385,6 +392,7 @@ private:
|
||||||
int test_get_auto_distortion(void* data);
|
int test_get_auto_distortion(void* data);
|
||||||
int test_set_auto_distortion(void* data);
|
int test_set_auto_distortion(void* data);
|
||||||
int test_confirm_auto_distortion(void* data);
|
int test_confirm_auto_distortion(void* data);
|
||||||
|
int test_verify_auto_distortion(void* data);
|
||||||
/* 分纸强度检测 */
|
/* 分纸强度检测 */
|
||||||
int test_paper_separation_strength(void* data);
|
int test_paper_separation_strength(void* data);
|
||||||
/* 机械走纸倾斜检测 */
|
/* 机械走纸倾斜检测 */
|
||||||
|
|
Loading…
Reference in New Issue