合并六项动态图像校正为一项
This commit is contained in:
parent
01b14d580f
commit
e3013c9e7d
|
@ -68,7 +68,11 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_l
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_handle != nullptr)
|
if (m_handle != nullptr)
|
||||||
|
{
|
||||||
m_hg = new hgscanner(nullptr, nullptr, this, m_handle);
|
m_hg = new hgscanner(nullptr, nullptr, this, m_handle);
|
||||||
|
func_test_uninit(NULL);
|
||||||
|
func_test_init(NULL, m_hg);
|
||||||
|
}
|
||||||
|
|
||||||
connect(this, SIGNAL(testResult()), this, SLOT(on_testResult()));
|
connect(this, SIGNAL(testResult()), this, SLOT(on_testResult()));
|
||||||
|
|
||||||
|
@ -118,7 +122,7 @@ void Dialog_InputSerialNum::setSpeedMode()
|
||||||
int speedMode = jsonGlobal.speed_mode;
|
int speedMode = jsonGlobal.speed_mode;
|
||||||
lp->cat = WRITE_CAT_SPEED;
|
lp->cat = WRITE_CAT_SPEED;
|
||||||
lp->val = (void*)&speedMode;
|
lp->val = (void*)&speedMode;
|
||||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp);
|
||||||
|
|
||||||
delete lp;
|
delete lp;
|
||||||
|
|
||||||
|
@ -135,7 +139,7 @@ void Dialog_InputSerialNum::setSleepTime()
|
||||||
int sleepTime = jsonGlobal.sleep_time;
|
int sleepTime = jsonGlobal.sleep_time;
|
||||||
lp->cat = WRITE_CAT_SLEEP;
|
lp->cat = WRITE_CAT_SLEEP;
|
||||||
lp->val = (void*)&sleepTime;
|
lp->val = (void*)&sleepTime;
|
||||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp);
|
||||||
|
|
||||||
delete lp;
|
delete lp;
|
||||||
|
|
||||||
|
@ -155,7 +159,7 @@ void Dialog_InputSerialNum::setVidPid()
|
||||||
int vidpidValue = vidpid.Value;
|
int vidpidValue = vidpid.Value;
|
||||||
lp->cat = WRITE_CAT_VID_PID;
|
lp->cat = WRITE_CAT_VID_PID;
|
||||||
lp->val = (void*)&vidpidValue;
|
lp->val = (void*)&vidpidValue;
|
||||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp);
|
||||||
|
|
||||||
delete lp;
|
delete lp;
|
||||||
|
|
||||||
|
@ -187,7 +191,7 @@ void Dialog_InputSerialNum::setDevceModel()
|
||||||
void Dialog_InputSerialNum::rebootDevice()
|
void Dialog_InputSerialNum::rebootDevice()
|
||||||
{
|
{
|
||||||
const wchar_t *p = L"0";
|
const wchar_t *p = L"0";
|
||||||
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg);
|
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Dialog_InputSerialNum::getSpeedMode()
|
int Dialog_InputSerialNum::getSpeedMode()
|
||||||
|
|
|
@ -196,6 +196,8 @@ DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *bur
|
||||||
m_serialNum = serialNum;
|
m_serialNum = serialNum;
|
||||||
|
|
||||||
m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle);
|
m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle);
|
||||||
|
func_test_uninit(NULL);
|
||||||
|
func_test_init(NULL, m_hg);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceManager::~DeviceManager()
|
DeviceManager::~DeviceManager()
|
||||||
|
@ -203,6 +205,8 @@ DeviceManager::~DeviceManager()
|
||||||
delete m_hg;
|
delete m_hg;
|
||||||
m_hg = nullptr;
|
m_hg = nullptr;
|
||||||
|
|
||||||
|
func_test_uninit(NULL);
|
||||||
|
|
||||||
sane_close(m_handle);
|
sane_close(m_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +224,7 @@ void DeviceManager::setBurnMode()
|
||||||
{
|
{
|
||||||
const wchar_t *p = L"1";
|
const wchar_t *p = L"1";
|
||||||
// m_mainwnd->addTestingRef();
|
// m_mainwnd->addTestingRef();
|
||||||
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg);
|
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +237,7 @@ void DeviceManager::setSpeedMode()
|
||||||
int speedMode = jsonGlobal.speed_mode;
|
int speedMode = jsonGlobal.speed_mode;
|
||||||
lp->cat = WRITE_CAT_SPEED;
|
lp->cat = WRITE_CAT_SPEED;
|
||||||
lp->val = (void*)&speedMode;
|
lp->val = (void*)&speedMode;
|
||||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp);
|
||||||
|
|
||||||
delete lp;
|
delete lp;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +251,7 @@ void DeviceManager::setSleepTime()
|
||||||
int sleepTime = jsonGlobal.sleep_time;
|
int sleepTime = jsonGlobal.sleep_time;
|
||||||
lp->cat = WRITE_CAT_SLEEP;
|
lp->cat = WRITE_CAT_SLEEP;
|
||||||
lp->val = (void*)&sleepTime;
|
lp->val = (void*)&sleepTime;
|
||||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp);
|
||||||
|
|
||||||
delete lp;
|
delete lp;
|
||||||
}
|
}
|
||||||
|
@ -264,7 +268,7 @@ void DeviceManager::setVidPid()
|
||||||
int vidpidValue = vidpid.Value;
|
int vidpidValue = vidpid.Value;
|
||||||
lp->cat = WRITE_CAT_VID_PID;
|
lp->cat = WRITE_CAT_VID_PID;
|
||||||
lp->val = (void*)&vidpidValue;
|
lp->val = (void*)&vidpidValue;
|
||||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp);
|
||||||
|
|
||||||
delete lp;
|
delete lp;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +276,7 @@ void DeviceManager::setVidPid()
|
||||||
void DeviceManager::rebootDevice()
|
void DeviceManager::rebootDevice()
|
||||||
{
|
{
|
||||||
const wchar_t *p = L"0";
|
const wchar_t *p = L"0";
|
||||||
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg);
|
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceManager::getDevType()
|
QString DeviceManager::getDevType()
|
||||||
|
|
|
@ -65,6 +65,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
|
||||||
if (m_handle)
|
if (m_handle)
|
||||||
{
|
{
|
||||||
m_hg = new hgscanner(this, nullptr, nullptr, m_handle);
|
m_hg = new hgscanner(this, nullptr, nullptr, m_handle);
|
||||||
|
func_test_uninit(NULL);
|
||||||
|
func_test_init(NULL, m_hg);
|
||||||
}
|
}
|
||||||
ui->label_devInfo->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum + " " + tr("FirmwareNum:") + m_devFwNum);
|
ui->label_devInfo->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum + " " + tr("FirmwareNum:") + m_devFwNum);
|
||||||
|
|
||||||
|
@ -110,6 +112,8 @@ Form_mainInterface::~Form_mainInterface()
|
||||||
delete m_hg;
|
delete m_hg;
|
||||||
m_hg = nullptr;
|
m_hg = nullptr;
|
||||||
|
|
||||||
|
func_test_uninit(NULL);
|
||||||
|
|
||||||
sane_close(m_handle);
|
sane_close(m_handle);
|
||||||
m_handle = nullptr;
|
m_handle = nullptr;
|
||||||
//HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
//HGPdtToolDb_CloseDevice(m_pdtToolDbDevice);
|
||||||
|
@ -148,6 +152,81 @@ void Form_mainInterface::setDevDisconnect()
|
||||||
m_disconnect = true;
|
m_disconnect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Form_mainInterface::checkWrongCorrectItem(int correctType)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ui->tableWidget->rowCount(); i++)
|
||||||
|
{
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
|
||||||
|
if (item != nullptr)
|
||||||
|
{
|
||||||
|
QString title = item->text();
|
||||||
|
QString name = m_map_title_name.value(title).name;
|
||||||
|
|
||||||
|
if (1 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
||||||
|
}
|
||||||
|
else if (2 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
||||||
|
}
|
||||||
|
else if (3 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
||||||
|
}
|
||||||
|
else if (4 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
||||||
|
}
|
||||||
|
else if (5 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
||||||
|
}
|
||||||
|
else if (6 == correctType && HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not pass"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Form_mainInterface::resetCorrectItems()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ui->tableWidget->rowCount(); i++)
|
||||||
|
{
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
|
||||||
|
if (item != nullptr)
|
||||||
|
{
|
||||||
|
QString title = item->text();
|
||||||
|
QString name = m_map_title_name.value(title).name;
|
||||||
|
|
||||||
|
if (HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI == name ||
|
||||||
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI == name ||
|
||||||
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI == name ||
|
||||||
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI == name ||
|
||||||
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI == name ||
|
||||||
|
HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI == name)
|
||||||
|
{
|
||||||
|
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->item(i, 2)->setBackground(Qt::transparent);
|
||||||
|
ui->tableWidget->item(i, 2)->setText(tr("not test"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
(void)event;
|
(void)event;
|
||||||
|
@ -876,6 +955,11 @@ void Form_mainInterface::on_pbtn_start_clicked()
|
||||||
QString title = item->text();
|
QString title = item->text();
|
||||||
QString name = m_map_title_name.value(title).name;
|
QString name = m_map_title_name.value(title).name;
|
||||||
|
|
||||||
|
if (name == HGPDTTOOLDB_NAME_IMAGE_CORRECTION)
|
||||||
|
{
|
||||||
|
resetCorrectItems();
|
||||||
|
}
|
||||||
|
|
||||||
int dpi = 0;
|
int dpi = 0;
|
||||||
if (title == "扫描图像彩色质量确认_200dpi" || title == "扫描图像灰度质量确认_200dpi" || title == "计算畸变修正值_200dpi" || title == "设置畸变修正值_200dpi")
|
if (title == "扫描图像彩色质量确认_200dpi" || title == "扫描图像灰度质量确认_200dpi" || title == "计算畸变修正值_200dpi" || title == "设置畸变修正值_200dpi")
|
||||||
dpi = 200;
|
dpi = 200;
|
||||||
|
@ -907,11 +991,11 @@ void Form_mainInterface::on_pbtn_start_clicked()
|
||||||
|
|
||||||
if (buf != nullptr || (dpi > 0))
|
if (buf != nullptr || (dpi > 0))
|
||||||
{
|
{
|
||||||
ret = func_test_go(name.toStdWString().c_str(), (const wchar_t*)buf, m_hg);
|
ret = func_test_go(name.toStdWString().c_str(), (const wchar_t*)buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = func_test_go(name.toStdWString().c_str(), L"null", m_hg);
|
ret = func_test_go(name.toStdWString().c_str(), L"null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret > SANE_STATUS_GOOD)
|
if (ret > SANE_STATUS_GOOD)
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
SANE_Handle getDevHandle();
|
SANE_Handle getDevHandle();
|
||||||
hgscanner *getScanner();
|
hgscanner *getScanner();
|
||||||
void setDevDisconnect();
|
void setDevDisconnect();
|
||||||
|
void checkWrongCorrectItem(int correctType); //1:200dpi-color; 2:200dpi-gray;3:300dpi-color; 4:300dpi-gray;5:600dpi-color; 6:600dpi-gray;
|
||||||
|
void resetCorrectItems();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "base/HGBase.h"
|
#include "base/HGBase.h"
|
||||||
#include "huagao/brand.h"
|
#include "huagao/brand.h"
|
||||||
|
#include "huagao/hgscanner_error.h"
|
||||||
#include "HGUIGlobal.h"
|
#include "HGUIGlobal.h"
|
||||||
#include "app_cfg.h"
|
#include "app_cfg.h"
|
||||||
#include "dialog_login.h"
|
#include "dialog_login.h"
|
||||||
|
@ -526,6 +527,22 @@ void MainWindow::on_sane_create_interface(SaneParams *saneParams)
|
||||||
{
|
{
|
||||||
if (nullptr != mainInterface->getScanner() && nullptr != mainInterface->getScanner()->cb_)
|
if (nullptr != mainInterface->getScanner() && nullptr != mainInterface->getScanner()->cb_)
|
||||||
{
|
{
|
||||||
|
QString info = QString::fromStdString((char*)saneParams->data);
|
||||||
|
if (info == QString(STATU_DESC_SCANNER_ERR_IMAGE_CORRECTION_FINISHED))
|
||||||
|
{
|
||||||
|
int type = 0;
|
||||||
|
func_test_correct(true, &type);
|
||||||
|
}
|
||||||
|
else if (info == QString(STATU_DESC_SCANNER_ERR_IMAGE_CORRECTION_FAIL))
|
||||||
|
{
|
||||||
|
int type = 0;
|
||||||
|
func_test_correct(false, &type);
|
||||||
|
if (type > 0)
|
||||||
|
{
|
||||||
|
mainInterface->checkWrongCorrectItem(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
#include<string>
|
#include<string>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <map>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "huagao/hgscanner_error.h"
|
#include "huagao/hgscanner_error.h"
|
||||||
#include "sane/sane_option_definitions.h";
|
#include "sane/sane_option_definitions.h";
|
||||||
|
|
||||||
|
test *test_ = nullptr;
|
||||||
|
|
||||||
static struct Test_Map
|
static struct Test_Map
|
||||||
{
|
{
|
||||||
const wchar_t* name; // DIAL_SWITCH
|
const wchar_t* name; // DIAL_SWITCH
|
||||||
|
@ -50,6 +52,7 @@ static struct Test_Map
|
||||||
{HGPDTTOOLDB_NAME_BACKUP ,HGPDTTOOLDB_TITLE_BACKUP},
|
{HGPDTTOOLDB_NAME_BACKUP ,HGPDTTOOLDB_TITLE_BACKUP},
|
||||||
{HGPDTTOOLDB_NAME_SHUTDOWN ,HGPDTTOOLDB_TITLE_SHUTDOWN},
|
{HGPDTTOOLDB_NAME_SHUTDOWN ,HGPDTTOOLDB_TITLE_SHUTDOWN},
|
||||||
{HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE ,HGPDTTOOLDB_TITLE_SET_FIRMWARE_LANGUAGE},
|
{HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE ,HGPDTTOOLDB_TITLE_SET_FIRMWARE_LANGUAGE},
|
||||||
|
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION},
|
||||||
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_200DPI},
|
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_200DPI},
|
||||||
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_GRAY_200DPI},
|
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_GRAY_200DPI},
|
||||||
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_300DPI},
|
{HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI ,HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_300DPI},
|
||||||
|
@ -137,13 +140,12 @@ static std::wstring set_test_name_ =L"";
|
||||||
//bool is_distortion_get_image_abnormal = false;
|
//bool is_distortion_get_image_abnormal = false;
|
||||||
std::atomic<bool> is_distortion_get_image_abnormal(false);
|
std::atomic<bool> is_distortion_get_image_abnormal(false);
|
||||||
std::atomic<bool> is_distortion_get_image(false);
|
std::atomic<bool> is_distortion_get_image(false);
|
||||||
class test
|
|
||||||
{
|
int g_currentCorrectType = 0;
|
||||||
ui_helper* helper_;
|
int g_dynamicCorrectStatus = SCANNER_ERR_OK;
|
||||||
int fw_;
|
|
||||||
|
|
||||||
/*设置vid pid*/
|
/*设置vid pid*/
|
||||||
int test_set_vidpid(void* data)
|
int test::test_set_vidpid(void* data)
|
||||||
{
|
{
|
||||||
unsigned int len = sizeof(int);
|
unsigned int len = sizeof(int);
|
||||||
int set_vidpid = *((int*)data),
|
int set_vidpid = *((int*)data),
|
||||||
|
@ -161,7 +163,7 @@ class test
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*设置序列号*/
|
/*设置序列号*/
|
||||||
int test_set_serial_num(void* data)
|
int test::test_set_serial_num(void* data)
|
||||||
{
|
{
|
||||||
wchar_t* sn = (wchar_t*)data;
|
wchar_t* sn = (wchar_t*)data;
|
||||||
|
|
||||||
|
@ -187,7 +189,7 @@ class test
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 设置休眠 */
|
/* 设置休眠 */
|
||||||
int test_dormancy(void* data)
|
int test::test_dormancy(void* data)
|
||||||
{
|
{
|
||||||
const wchar_t sleep_buf[8] = { 0,5,10,20,30,60,120,240 };
|
const wchar_t sleep_buf[8] = { 0,5,10,20,30,60,120,240 };
|
||||||
int sleep_time = *((int*)data);
|
int sleep_time = *((int*)data);
|
||||||
|
@ -226,7 +228,7 @@ class test
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*获取固件版本号*/
|
/*获取固件版本号*/
|
||||||
std::string get_firmware_version()
|
std::string test::get_firmware_version()
|
||||||
{
|
{
|
||||||
std::string fw = "";
|
std::string fw = "";
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
|
@ -237,7 +239,7 @@ class test
|
||||||
return fw;
|
return fw;
|
||||||
}
|
}
|
||||||
/* 配置速度模式 */
|
/* 配置速度模式 */
|
||||||
int test_configure_speed_mode(void* data)
|
int test::test_configure_speed_mode(void* data)
|
||||||
{
|
{
|
||||||
unsigned int len = sizeof(int);
|
unsigned int len = sizeof(int);
|
||||||
int speed_mode = *((int*)data);
|
int speed_mode = *((int*)data);
|
||||||
|
@ -298,7 +300,6 @@ class test
|
||||||
int ret = helper_->io_control(IO_CTRL_CODE_SET_SPEED_MODE, &speed_mode, &len);
|
int ret = helper_->io_control(IO_CTRL_CODE_SET_SPEED_MODE, &speed_mode, &len);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
|
|
||||||
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
|
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
|
||||||
{
|
{
|
||||||
|
@ -471,7 +472,7 @@ public:
|
||||||
wcscpy(buf, L"单张测试失败, 原因--->");
|
wcscpy(buf, L"单张测试失败, 原因--->");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI) == 0
|
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI) == 0
|
||||||
|
@ -491,8 +492,18 @@ public:
|
||||||
wcscat(buf, wstr.c_str());
|
wcscat(buf, wstr.c_str());
|
||||||
//ret = h->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);//结束恢复默认
|
//ret = h->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);//结束恢复默认
|
||||||
|
|
||||||
|
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION) == 0)
|
||||||
|
{
|
||||||
|
if (g_dynamicCorrectStatus == SCANNER_ERR_IMAGE_CORRECTION_FAIL || g_currentCorrectType == 6)
|
||||||
|
{
|
||||||
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, type);
|
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SANE_EVENT_ERROR:
|
case SANE_EVENT_ERROR:
|
||||||
{
|
{
|
||||||
|
@ -526,6 +537,7 @@ public:
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_PRESSUER_TEST_GRAY_300DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_PRESSUER_TEST_GRAY_300DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_PRESSUER_TEST_RGB_600DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_PRESSUER_TEST_RGB_600DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_PRESSUER_TEST_GRAY_600DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_PRESSUER_TEST_GRAY_600DPI) == 0
|
||||||
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0
|
||||||
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI) == 0
|
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI) == 0
|
||||||
|
@ -545,16 +557,21 @@ public:
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
test(ui_helper* helper) :helper_(helper), fw_(0)
|
test::test(ui_helper* helper)
|
||||||
{
|
{
|
||||||
helper->register_sane_callback(sane_ex_callback, NULL);
|
helper_ = helper;
|
||||||
|
helper_->register_sane_callback(sane_ex_callback, NULL);
|
||||||
init_test_map_();
|
init_test_map_();
|
||||||
}
|
}
|
||||||
~test()
|
test::~test()
|
||||||
{}
|
{
|
||||||
|
g_currentCorrectType = 0;
|
||||||
|
m_waitCorrect.notify_all();
|
||||||
|
if (thread_dynamic_correct_handle.get() && thread_dynamic_correct_handle->joinable())
|
||||||
|
thread_dynamic_correct_handle->join();
|
||||||
|
}
|
||||||
|
|
||||||
std::map<std::wstring, int(test::*)(void *)> test_map_;
|
void test::init_test_map_()
|
||||||
void init_test_map_()
|
|
||||||
{
|
{
|
||||||
test_map_[WRITE_CFG_NAME] = &test::set_init_cfg;
|
test_map_[WRITE_CFG_NAME] = &test::set_init_cfg;
|
||||||
test_map_[HGPDTTOOLDB_NAME_SET_JSON_SN] = &test::test_set_json_serial_num;
|
test_map_[HGPDTTOOLDB_NAME_SET_JSON_SN] = &test::test_set_json_serial_num;
|
||||||
|
@ -606,6 +623,7 @@ public:
|
||||||
test_map_[HGPDTTOOLDB_NAME_BACKUP] = &test::test_backup;
|
test_map_[HGPDTTOOLDB_NAME_BACKUP] = &test::test_backup;
|
||||||
test_map_[HGPDTTOOLDB_NAME_SHUTDOWN] = &test::test_shutdown;
|
test_map_[HGPDTTOOLDB_NAME_SHUTDOWN] = &test::test_shutdown;
|
||||||
test_map_[HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE] = &test::test_set_firmware_language;
|
test_map_[HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE] = &test::test_set_firmware_language;
|
||||||
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION] = &test::test_image_correct_all;
|
||||||
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI] = &test::test_image_correct_rgb_200dpi;
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI] = &test::test_image_correct_rgb_200dpi;
|
||||||
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI] = &test::test_image_correct_gray_200dpi;
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI] = &test::test_image_correct_gray_200dpi;
|
||||||
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI] = &test::test_image_correct_rgb_300dpi;
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI] = &test::test_image_correct_rgb_300dpi;
|
||||||
|
@ -613,7 +631,7 @@ public:
|
||||||
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI] = &test::test_image_correct_rgb_600dpi;
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI] = &test::test_image_correct_rgb_600dpi;
|
||||||
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI] = &test::test_image_correct_gray_600dpi;
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI] = &test::test_image_correct_gray_600dpi;
|
||||||
}
|
}
|
||||||
int set_test(const wchar_t* name,const wchar_t* oper)
|
int test::set_test(const wchar_t* name, const wchar_t* oper)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (wcscmp(name, HGPDTTOOLDB_NAME_SET_JSON_SN) == 0
|
if (wcscmp(name, HGPDTTOOLDB_NAME_SET_JSON_SN) == 0
|
||||||
|
@ -668,9 +686,27 @@ public:
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
|
|
||||||
int set_init_cfg(void *data)
|
void test::thread_dynamic_correct(std::string correctData)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(m_lock);
|
||||||
|
while (g_currentCorrectType <= 6)
|
||||||
|
{
|
||||||
|
if (g_currentCorrectType > 1)
|
||||||
|
m_waitCorrect.wait(lock);
|
||||||
|
|
||||||
|
if (g_dynamicCorrectStatus == SCANNER_ERR_IMAGE_CORRECTION_FAIL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
CorrectMode correctMode = m_correctModeMap.at(g_currentCorrectType);
|
||||||
|
int dpi = correctMode.dpi;
|
||||||
|
bool isColor = correctMode.isColor;
|
||||||
|
int ret = public_test_image_correct(correctData, dpi, isColor);
|
||||||
|
g_currentCorrectType++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int test::set_init_cfg(void* data)
|
||||||
{
|
{
|
||||||
const wchar_t* p = (const wchar_t*)data;
|
const wchar_t* p = (const wchar_t*)data;
|
||||||
LPWRITECFG cfg = (LPWRITECFG)p;
|
LPWRITECFG cfg = (LPWRITECFG)p;
|
||||||
|
@ -701,7 +737,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*设置序列号*/
|
/*设置序列号*/
|
||||||
int test_set_json_serial_num(void* data)
|
int test::test_set_json_serial_num(void* data)
|
||||||
{
|
{
|
||||||
int ret = SCANNER_ERR_OK,
|
int ret = SCANNER_ERR_OK,
|
||||||
val = 0;
|
val = 0;
|
||||||
|
@ -777,7 +813,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 清理纸道功能确认 */
|
/* 清理纸道功能确认 */
|
||||||
int tset_clear_paper_path(void *data)
|
int test::tset_clear_paper_path(void* data)
|
||||||
{
|
{
|
||||||
int ret = helper_->io_control(IO_CTRL_CODE_GET_CLEAN_PAPER_ROAD, NULL, NULL);
|
int ret = helper_->io_control(IO_CTRL_CODE_GET_CLEAN_PAPER_ROAD, NULL, NULL);
|
||||||
if (ret != SCANNER_ERR_OK)
|
if (ret != SCANNER_ERR_OK)
|
||||||
|
@ -788,12 +824,12 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 按键功能检测 */
|
/* 按键功能检测 */
|
||||||
int test_key_funtion(void *data)
|
int test::test_key_funtion(void* data)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* 计数模式检测 */
|
/* 计数模式检测 */
|
||||||
int test_count_mode(void *data)
|
int test::test_count_mode(void* data)
|
||||||
{
|
{
|
||||||
SANE_Bool ismode = false;
|
SANE_Bool ismode = false;
|
||||||
unsigned int len = sizeof(SANE_Bool);
|
unsigned int len = sizeof(SANE_Bool);
|
||||||
|
@ -807,7 +843,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 歪斜检测 */
|
/* 歪斜检测 */
|
||||||
int test_skew_detection(void *data)
|
int test::test_skew_detection(void* data)
|
||||||
{
|
{
|
||||||
const wchar_t* NAME = set_test_name_.c_str();
|
const wchar_t* NAME = set_test_name_.c_str();
|
||||||
SANE_Bool type = true;
|
SANE_Bool type = true;
|
||||||
|
@ -844,12 +880,12 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 分纸电机检测 */
|
/* 分纸电机检测 */
|
||||||
int test_separater_motor(void *data)
|
int test::test_separater_motor(void* data)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* cis原图初检 */
|
/* cis原图初检 */
|
||||||
int test_cis__original_image(void *data)
|
int test::test_cis__original_image(void* data)
|
||||||
{
|
{
|
||||||
const wchar_t* NAME = set_test_name_.c_str();
|
const wchar_t* NAME = set_test_name_.c_str();
|
||||||
SANE_Bool type = true;
|
SANE_Bool type = true;
|
||||||
|
@ -869,22 +905,22 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 主机风扇功能检测 */
|
/* 主机风扇功能检测 */
|
||||||
int test_host_fan(void *data)
|
int test::test_host_fan(void* data)
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* 扫描工作状态 */
|
/* 扫描工作状态 */
|
||||||
int test_scan_work_status(void* data)
|
int test::test_scan_work_status(void* data)
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* USB-PC接口 */
|
/* USB-PC接口 */
|
||||||
int test_usb_pc_interface(void* data)
|
int test::test_usb_pc_interface(void* data)
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* 超声波模块检验 */
|
/* 超声波模块检验 */
|
||||||
int test_ultrasonic_module(void *data)
|
int test::test_ultrasonic_module(void* data)
|
||||||
{
|
{
|
||||||
const wchar_t* NAME = set_test_name_.c_str();
|
const wchar_t* NAME = set_test_name_.c_str();
|
||||||
SANE_Bool type = true;
|
SANE_Bool type = true;
|
||||||
|
@ -921,32 +957,32 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* led灯状态检查 */
|
/* led灯状态检查 */
|
||||||
int test_led_light(void *data)
|
int test::test_led_light(void* data)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* 复位检查 */
|
/* 复位检查 */
|
||||||
int test_reset(void *data)
|
int test::test_reset(void* data)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* 走纸检查 */
|
/* 走纸检查 */
|
||||||
int test_paper_feed(void *data) //使用单张扫描测试
|
int test::test_paper_feed(void* data) //使用单张扫描测试
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* 扫描传感器检查 */
|
/* 扫描传感器检查 */
|
||||||
int test_scanning_sensor(void *data)
|
int test::test_scanning_sensor(void* data)
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* 放置校正纸 */
|
/* 放置校正纸 */
|
||||||
int test_place_correction_paper(void *data)
|
int test::test_place_correction_paper(void* data)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* 自动平场校正 */
|
/* 自动平场校正 */
|
||||||
int test_auto_flat_field(void *data)
|
int test::test_auto_flat_field(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
return SCANNER_ERR_DATA_DAMAGED;
|
return SCANNER_ERR_DATA_DAMAGED;
|
||||||
|
@ -972,7 +1008,7 @@ public:
|
||||||
return helper_->io_control(IO_CTRL_CODE_SET_AUTO_FALT, &dpi_type, &len);;
|
return helper_->io_control(IO_CTRL_CODE_SET_AUTO_FALT, &dpi_type, &len);;
|
||||||
}
|
}
|
||||||
/* 重启设备 */
|
/* 重启设备 */
|
||||||
int test_reboot_device(void *data)
|
int test::test_reboot_device(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -988,7 +1024,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 扫描图像彩色质量确认 */
|
/* 扫描图像彩色质量确认 */
|
||||||
int test_image_color_quality(void *data)
|
int test::test_image_color_quality(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1026,7 +1062,7 @@ 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_image_gray_quality(void* data)
|
int test::test_image_gray_quality(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1063,7 +1099,7 @@ 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_get_auto_distortion(void *data)
|
int test::test_get_auto_distortion(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1139,7 +1175,7 @@ public:
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int test_set_auto_distortion(void* data)
|
int test::test_set_auto_distortion(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1208,7 +1244,7 @@ public:
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int test_confirm_auto_distortion(void *data)
|
int test::test_confirm_auto_distortion(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1243,18 +1279,18 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 分纸强度检测 */
|
/* 分纸强度检测 */
|
||||||
int test_paper_separation_strength(void *data)
|
int test::test_paper_separation_strength(void* data)
|
||||||
{
|
{
|
||||||
//parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_TIPS_VAL, NAME, (wchar_t*)&info_);
|
//parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_TIPS_VAL, NAME, (wchar_t*)&info_);
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* 机械走纸倾斜检测 */
|
/* 机械走纸倾斜检测 */
|
||||||
int test_mech_paper_feeding_inclination(void *data)
|
int test::test_mech_paper_feeding_inclination(void* data)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
/* 清除滚轴计数 */
|
/* 清除滚轴计数 */
|
||||||
int test_clear_roller_count(void *data)
|
int test::test_clear_roller_count(void* data)
|
||||||
{
|
{
|
||||||
SANE_Int roller_num = -1;
|
SANE_Int roller_num = -1;
|
||||||
const wchar_t* info = NULL;
|
const wchar_t* info = NULL;
|
||||||
|
@ -1278,7 +1314,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 清除历史计数 */
|
/* 清除历史计数 */
|
||||||
int test_clear_history_count(void* data)
|
int test::test_clear_history_count(void* data)
|
||||||
{
|
{
|
||||||
SANE_Int num = -1;
|
SANE_Int num = -1;
|
||||||
const wchar_t* info = NULL;
|
const wchar_t* info = NULL;
|
||||||
|
@ -1306,12 +1342,12 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 单张测试 */
|
/* 单张测试 */
|
||||||
int test_single_page_test(void* data)
|
int test::test_single_page_test(void* data)
|
||||||
{
|
{
|
||||||
return helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*压力测试彩色_200dpi*/
|
/*压力测试彩色_200dpi*/
|
||||||
int test_pressuer_test_rgb_200dpi(void* data)
|
int test::test_pressuer_test_rgb_200dpi(void* data)
|
||||||
{
|
{
|
||||||
const char* color = OPTION_VALUE_YSMS_24WCS;
|
const char* color = OPTION_VALUE_YSMS_24WCS;
|
||||||
int dpi = 200;
|
int dpi = 200;
|
||||||
|
@ -1321,7 +1357,7 @@ public:
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*压力测试灰色_200dpi*/
|
/*压力测试灰色_200dpi*/
|
||||||
int test_pressuer_test_gray_200dpi(void* data)
|
int test::test_pressuer_test_gray_200dpi(void* data)
|
||||||
{
|
{
|
||||||
const char* color = OPTION_VALUE_YSMS_256JHD;
|
const char* color = OPTION_VALUE_YSMS_256JHD;
|
||||||
int dpi = 200;
|
int dpi = 200;
|
||||||
|
@ -1331,7 +1367,7 @@ public:
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*压力测试彩色_300dpi*/
|
/*压力测试彩色_300dpi*/
|
||||||
int test_pressuer_test_rgb_300dpi(void* data)
|
int test::test_pressuer_test_rgb_300dpi(void* data)
|
||||||
{
|
{
|
||||||
const char* color = OPTION_VALUE_YSMS_24WCS;
|
const char* color = OPTION_VALUE_YSMS_24WCS;
|
||||||
int dpi = 300;
|
int dpi = 300;
|
||||||
|
@ -1341,7 +1377,7 @@ public:
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*压力测试灰色_300dpi*/
|
/*压力测试灰色_300dpi*/
|
||||||
int test_pressuer_test_gray_300dpi(void* data)
|
int test::test_pressuer_test_gray_300dpi(void* data)
|
||||||
{
|
{
|
||||||
const char* color = OPTION_VALUE_YSMS_256JHD;
|
const char* color = OPTION_VALUE_YSMS_256JHD;
|
||||||
int dpi = 300;
|
int dpi = 300;
|
||||||
|
@ -1351,7 +1387,7 @@ public:
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*压力测试彩色_600dpi*/
|
/*压力测试彩色_600dpi*/
|
||||||
int test_pressuer_test_rgb_600dpi(void* data)
|
int test::test_pressuer_test_rgb_600dpi(void* data)
|
||||||
{
|
{
|
||||||
const char* color = OPTION_VALUE_YSMS_24WCS;
|
const char* color = OPTION_VALUE_YSMS_24WCS;
|
||||||
int dpi = 600;
|
int dpi = 600;
|
||||||
|
@ -1361,7 +1397,7 @@ public:
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*压力测试灰色_600dpi*/
|
/*压力测试灰色_600dpi*/
|
||||||
int test_pressuer_test_gray_600dpi(void* data)
|
int test::test_pressuer_test_gray_600dpi(void* data)
|
||||||
{
|
{
|
||||||
const char* color = OPTION_VALUE_YSMS_256JHD;
|
const char* color = OPTION_VALUE_YSMS_256JHD;
|
||||||
int dpi = 600;
|
int dpi = 600;
|
||||||
|
@ -1371,7 +1407,7 @@ 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_get_device_config(void* data)
|
int test::test_get_device_config(void* data)
|
||||||
{
|
{
|
||||||
unsigned int len = sizeof(int);
|
unsigned int len = sizeof(int);
|
||||||
unsigned int getlen = 0;
|
unsigned int getlen = 0;
|
||||||
|
@ -1447,7 +1483,8 @@ public:
|
||||||
|
|
||||||
const wchar_t G139[6] = { 60,70,80,90,110 };
|
const wchar_t G139[6] = { 60,70,80,90,110 };
|
||||||
const wchar_t G239[6] = { 90,100,110,120,130 };
|
const wchar_t G239[6] = { 90,100,110,120,130 };
|
||||||
const wchar_t G300[6] = { 40,50,60,70 };
|
const wchar_t G300[6] = { 40,50,60,70,80,90 };
|
||||||
|
const wchar_t G306[6] = { 30,40,50,60,70 };
|
||||||
const wchar_t G400[6] = { 40,50,60,70,80 };
|
const wchar_t G400[6] = { 40,50,60,70,80 };
|
||||||
SANE_Int num = 0;
|
SANE_Int num = 0;
|
||||||
unsigned int lensp = sizeof(SANE_Int);
|
unsigned int lensp = sizeof(SANE_Int);
|
||||||
|
@ -1496,7 +1533,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*获取设备内存和硬盘容量大小*/
|
/*获取设备内存和硬盘容量大小*/
|
||||||
int test_get_device_cpu_disk(void* data)
|
int test::test_get_device_cpu_disk(void* data)
|
||||||
{
|
{
|
||||||
int cpu = 0;
|
int cpu = 0;
|
||||||
unsigned len = 0;
|
unsigned len = 0;
|
||||||
|
@ -1530,7 +1567,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 备份设备配置 */
|
/* 备份设备配置 */
|
||||||
int test_backup(void *data)
|
int test::test_backup(void* data)
|
||||||
{
|
{
|
||||||
int val = 0;
|
int val = 0;
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
|
@ -1547,7 +1584,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 关机 */
|
/* 关机 */
|
||||||
int test_shutdown(void *data)
|
int test::test_shutdown(void* data)
|
||||||
{
|
{
|
||||||
int val = 0;
|
int val = 0;
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
|
@ -1568,7 +1605,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* 设置固件语言模式 */
|
/* 设置固件语言模式 */
|
||||||
int test_set_firmware_language(void* data)
|
int test::test_set_firmware_language(void* data)
|
||||||
{
|
{
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
void* get_data = nullptr;
|
void* get_data = nullptr;
|
||||||
|
@ -1608,7 +1645,7 @@ public:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*设置设备型号*/
|
/*设置设备型号*/
|
||||||
int test_set_devs_model(void* data)
|
int test::test_set_devs_model(void* data)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1637,7 +1674,36 @@ public:
|
||||||
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_MANUAL_CONFIRMATION, (void*)L"设置设备类型成功", true);
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_MANUAL_CONFIRMATION, (void*)L"设置设备类型成功", true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int public_test_image_correct(void* data, int dpi, bool isColor)
|
|
||||||
|
int test::public_test_image_correct(std::string correctData, int dpi, bool isColor)
|
||||||
|
{
|
||||||
|
if (correctData.empty())
|
||||||
|
{
|
||||||
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"校正失败", false);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int l = correctData.size();
|
||||||
|
int ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, (void*)&dpi, &l);
|
||||||
|
const char* color = isColor ? OPTION_VALUE_YSMS_24WCS : OPTION_VALUE_YSMS_256JHD;
|
||||||
|
unsigned int colorlen = strlen(color);
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_COLOR, (void*)color, &colorlen);
|
||||||
|
|
||||||
|
SANE_Bool isOriImg = true;
|
||||||
|
ret = ret = helper_->io_control(IO_CTRL_CODE_ORIGINAL_IMAGE, (void*)&isOriImg, &l);
|
||||||
|
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_CORRECT_IMAGE, &correctData[0], &l);
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
|
||||||
|
|
||||||
|
if (ret != SCANNER_ERR_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
//helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"校正完成", true);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test::public_test_image_correct(void* data, int dpi, bool isColor)
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -1669,7 +1735,7 @@ public:
|
||||||
ret = ret = helper_->io_control(IO_CTRL_CODE_ORIGINAL_IMAGE, (void*)&isOriImg, &l);
|
ret = ret = helper_->io_control(IO_CTRL_CODE_ORIGINAL_IMAGE, (void*)&isOriImg, &l);
|
||||||
|
|
||||||
ret = helper_->io_control(IO_CTRL_CODE_SET_CORRECT_IMAGE, &str[0], &l);
|
ret = helper_->io_control(IO_CTRL_CODE_SET_CORRECT_IMAGE, &str[0], &l);
|
||||||
ret = helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
ret = helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
|
||||||
|
|
||||||
if (ret != SCANNER_ERR_OK)
|
if (ret != SCANNER_ERR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1677,54 +1743,70 @@ public:
|
||||||
//helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"校正完成", true);
|
//helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"校正完成", true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int test_image_correct_rgb_200dpi(void* data)
|
|
||||||
|
int test::test_image_correct_all(void* data)
|
||||||
|
{
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
return SCANNER_ERR_NO_DATA;
|
||||||
|
}
|
||||||
|
wchar_t* sc = (wchar_t*)data;
|
||||||
|
std::string str;
|
||||||
|
size_t len = 0;
|
||||||
|
int ret = wchar_to_char(str, sc, &len);
|
||||||
|
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
{
|
||||||
|
str.resize(len);
|
||||||
|
ret = wchar_to_char(str, sc, &len);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_currentCorrectType = 1;
|
||||||
|
thread_dynamic_correct_handle.reset(new std::thread(&test::thread_dynamic_correct, this, str));
|
||||||
|
|
||||||
|
return SCANNER_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test::test_image_correct_rgb_200dpi(void* data)
|
||||||
{
|
{
|
||||||
return public_test_image_correct(data, 200, true);
|
return public_test_image_correct(data, 200, true);
|
||||||
}
|
}
|
||||||
int test_image_correct_gray_200dpi(void* data)
|
|
||||||
|
int test::test_image_correct_gray_200dpi(void* data)
|
||||||
{
|
{
|
||||||
return public_test_image_correct(data, 200, false);
|
return public_test_image_correct(data, 200, false);
|
||||||
}
|
}
|
||||||
int test_image_correct_rgb_300dpi(void* data)
|
int test::test_image_correct_rgb_300dpi(void* data)
|
||||||
{
|
{
|
||||||
return public_test_image_correct(data, 300, true);
|
return public_test_image_correct(data, 300, true);
|
||||||
}
|
}
|
||||||
int test_image_correct_gray_300dpi(void* data)
|
int test::test_image_correct_gray_300dpi(void* data)
|
||||||
{
|
{
|
||||||
return public_test_image_correct(data, 300, false);
|
return public_test_image_correct(data, 300, false);
|
||||||
}
|
}
|
||||||
int test_image_correct_rgb_600dpi(void* data)
|
int test::test_image_correct_rgb_600dpi(void* data)
|
||||||
{
|
{
|
||||||
return public_test_image_correct(data, 600, true);
|
return public_test_image_correct(data, 600, true);
|
||||||
}
|
}
|
||||||
int test_image_correct_gray_600dpi(void* data)
|
int test::test_image_correct_gray_600dpi(void* data)
|
||||||
{
|
{
|
||||||
return public_test_image_correct(data, 600, false);
|
return public_test_image_correct(data, 600, false);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
DECL_API(int) func_test_init(void* init, ui_helper* helper)
|
||||||
|
|
||||||
|
|
||||||
//test
|
|
||||||
static std::string jsontext1("{\"1\":{\"NAME\":\"test-8\",\"ver\":1}}");
|
|
||||||
bool have_img_ = false;
|
|
||||||
|
|
||||||
DECL_API(int) func_test_init(void* init)
|
|
||||||
{
|
{
|
||||||
|
if (test_ == nullptr)
|
||||||
|
{
|
||||||
|
test_ = new test(helper);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DECL_API(int) func_test_get_list(wchar_t* buf, size_t* len)
|
DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper)
|
||||||
{
|
{
|
||||||
return str_to_wchar(jsontext1, buf, len);
|
if (!NAME || !oper || !test_)
|
||||||
}
|
|
||||||
DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper, ui_helper* helper)
|
|
||||||
{
|
|
||||||
if (!NAME || !oper || !helper)
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//helper->add_ref(void *data);
|
|
||||||
|
|
||||||
is_distortion_get_image = false;
|
is_distortion_get_image = false;
|
||||||
is_distortion_get_image_abnormal = false;
|
is_distortion_get_image_abnormal = false;
|
||||||
|
@ -1732,12 +1814,29 @@ DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper, ui_helper*
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
SANE_Bool type = false;
|
SANE_Bool type = false;
|
||||||
unsigned int len = sizeof(SANE_Bool);
|
unsigned int len = sizeof(SANE_Bool);
|
||||||
test ts(helper);
|
|
||||||
|
|
||||||
//ret = helper->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);//结束恢复默认
|
//ret = helper->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);//结束恢复默认
|
||||||
return ts.set_test(NAME, oper);
|
return test_->set_test(NAME, oper);
|
||||||
}
|
}
|
||||||
DECL_API(int) func_test_uninit(void* uninit)
|
DECL_API(int) func_test_uninit(void* uninit)
|
||||||
{
|
{
|
||||||
|
if (test_ != nullptr)
|
||||||
|
{
|
||||||
|
delete test_;
|
||||||
|
test_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DECL_API(int) func_test_correct(bool isSuccess, int *currentIndex)
|
||||||
|
{
|
||||||
|
if (!isSuccess)
|
||||||
|
{
|
||||||
|
g_dynamicCorrectStatus = SCANNER_ERR_IMAGE_CORRECTION_FAIL;
|
||||||
|
*currentIndex = g_currentCorrectType - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
test_->m_waitCorrect.notify_all();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
#include "sane/sane_ex.h"
|
#include "sane/sane_ex.h"
|
||||||
#include "ui_helper.h"
|
#include "ui_helper.h"
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <map>
|
||||||
|
#include <thread>
|
||||||
|
#include <mutex>
|
||||||
|
#include <condition_variable>
|
||||||
|
|
||||||
//////////////////////////////////////TITLE//////////////////////////////////////
|
//////////////////////////////////////TITLE//////////////////////////////////////
|
||||||
|
|
||||||
|
@ -98,6 +102,8 @@
|
||||||
#define HGPDTTOOLDB_TITLE_SHUTDOWN L"关机"
|
#define HGPDTTOOLDB_TITLE_SHUTDOWN L"关机"
|
||||||
/*设置固件语言模式*/
|
/*设置固件语言模式*/
|
||||||
#define HGPDTTOOLDB_TITLE_SET_FIRMWARE_LANGUAGE L"设置固件语言模式"
|
#define HGPDTTOOLDB_TITLE_SET_FIRMWARE_LANGUAGE L"设置固件语言模式"
|
||||||
|
/*图像扫描校正*/
|
||||||
|
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION L"图像扫描校正"
|
||||||
/*彩色图像扫描校正+200dpi*/
|
/*彩色图像扫描校正+200dpi*/
|
||||||
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_200DPI L"彩色图像扫描校正+200dpi"
|
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_200DPI L"彩色图像扫描校正+200dpi"
|
||||||
/*灰度图像扫描校正+200dpi*/
|
/*灰度图像扫描校正+200dpi*/
|
||||||
|
@ -110,7 +116,9 @@
|
||||||
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_600DPI L"彩色图像扫描校正+600dpi"
|
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_RGB_600DPI L"彩色图像扫描校正+600dpi"
|
||||||
/*灰度图像扫描校正+600dpi*/
|
/*灰度图像扫描校正+600dpi*/
|
||||||
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_GRAY_600DPI L"灰度图像扫描校正+600dpi"
|
#define HGPDTTOOLDB_TITLE_IMAGE_CORRECTION_GRAY_600DPI L"灰度图像扫描校正+600dpi"
|
||||||
|
|
||||||
//////////////////////////////////////NAME//////////////////////////////////////
|
//////////////////////////////////////NAME//////////////////////////////////////
|
||||||
|
|
||||||
#define WRITE_CFG_NAME L"write-cfg"
|
#define WRITE_CFG_NAME L"write-cfg"
|
||||||
/* 设置json序列号 */
|
/* 设置json序列号 */
|
||||||
#define HGPDTTOOLDB_NAME_SET_JSON_SN L"SET_JSON_SN"
|
#define HGPDTTOOLDB_NAME_SET_JSON_SN L"SET_JSON_SN"
|
||||||
|
@ -216,6 +224,8 @@
|
||||||
#define HGPDTTOOLDB_NAME_SHUTDOWN L"SHUTDOWN"
|
#define HGPDTTOOLDB_NAME_SHUTDOWN L"SHUTDOWN"
|
||||||
/*设置固件语言模式*/
|
/*设置固件语言模式*/
|
||||||
#define HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE L"SET_FIRMWARE_LANGUAGE"
|
#define HGPDTTOOLDB_NAME_SET_FIRMWARE_LANGUAGE L"SET_FIRMWARE_LANGUAGE"
|
||||||
|
/*图像扫描校正*/
|
||||||
|
#define HGPDTTOOLDB_NAME_IMAGE_CORRECTION L"IMAGE_CORRECTION"
|
||||||
/*彩色图像扫描校正+200dpi*/
|
/*彩色图像扫描校正+200dpi*/
|
||||||
#define HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI L"IMAGE_CORRECTION_RGB_200DPI"
|
#define HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI L"IMAGE_CORRECTION_RGB_200DPI"
|
||||||
/*灰度图像扫描校正+200dpi*/
|
/*灰度图像扫描校正+200dpi*/
|
||||||
|
@ -237,20 +247,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Function: initialize module
|
// Function: initialize module
|
||||||
DECL_API(int) func_test_init(void*);
|
// helper - parameter and testing process callback
|
||||||
|
DECL_API(int) func_test_init(void* init, ui_helper* helper);
|
||||||
// Function: to get testing function list supported by this module/DLL
|
|
||||||
//
|
|
||||||
// Parameter: buf - to receive the list JSON
|
|
||||||
//
|
|
||||||
// len - [in] space of 'buf' in words, [out] words copied in buf, or less buffer size in words if return ERROR_INSUFFICIENT_BUFFER
|
|
||||||
//
|
|
||||||
// Return: ERROR_SUCCESS - JSON configuration has copied into buf
|
|
||||||
// ERROR_INSUFFICIENT_BUFFER - buffer is too small, and the minium size in words is stored in 'len'
|
|
||||||
// ERROR_INVALID_PARAMETER - NULL for parameter 'len' is not acceptable
|
|
||||||
DECL_API(int) func_test_get_list(wchar_t* buf // to receive the JSON text
|
|
||||||
, size_t* len); // [in] space of 'buf' in words, [out] words copied in buf, or less buffer size in words if return ERROR_INSUFFICIENT_BUFFER
|
|
||||||
|
|
||||||
|
|
||||||
enum write_cat
|
enum write_cat
|
||||||
{
|
{
|
||||||
|
@ -272,212 +270,161 @@ typedef struct _write_cfg
|
||||||
//
|
//
|
||||||
// oper - test operation, "start", "pause", "resume", "stop", ...
|
// oper - test operation, "start", "pause", "resume", "stop", ...
|
||||||
//
|
//
|
||||||
// helper - parameter and testing process callback
|
|
||||||
//
|
//
|
||||||
// Return: error code
|
// Return: error code
|
||||||
DECL_API(int) func_test_go(const wchar_t* name // test name
|
DECL_API(int) func_test_go(const wchar_t* name // test name
|
||||||
, const wchar_t* oper // test oper - "start", "pause", "resume", "stop", ...
|
, const wchar_t* oper);
|
||||||
, ui_helper* helper);
|
|
||||||
|
|
||||||
// Function: uninitialize module
|
// Function: uninitialize module
|
||||||
DECL_API(int) func_test_uninit(void*);
|
DECL_API(int) func_test_uninit(void*);
|
||||||
|
|
||||||
|
// Function: do dynamic image correction
|
||||||
|
//
|
||||||
|
// Parameter: currentIndex - Get current correct type; 1:200dpi-color; 2:200dpi-gray;3:300dpi-color; 4:300dpi-gray;5:600dpi-color; 6:600dpi-gray;
|
||||||
|
//
|
||||||
|
// isSuccess - Explain whether the correction was successful this time.
|
||||||
|
//
|
||||||
|
// Return: error code
|
||||||
|
DECL_API(int) func_test_correct(bool isSuccess, int* currentIndex);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/*/ testing-DLL load code ...
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <Windows.h>
|
|
||||||
|
|
||||||
class json : public ref
|
class test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
json();
|
test(ui_helper* helper);
|
||||||
|
~test();
|
||||||
|
|
||||||
protected:
|
std::map<std::wstring, int(test::*)(void*)> test_map_;
|
||||||
~json();
|
std::condition_variable m_waitCorrect;
|
||||||
|
std::mutex m_lock;
|
||||||
|
ui_helper* helper_;
|
||||||
|
int fw_;
|
||||||
|
std::mutex mutex_;
|
||||||
|
std::condition_variable cv_;
|
||||||
|
|
||||||
|
void init_test_map_();
|
||||||
|
int set_test(const wchar_t* name, const wchar_t* oper);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<std::thread> thread_dynamic_correct_handle;
|
||||||
|
void thread_dynamic_correct(std::string correctData);
|
||||||
|
|
||||||
|
struct CorrectMode
|
||||||
|
{
|
||||||
|
int dpi;
|
||||||
|
bool isColor;
|
||||||
|
|
||||||
public:
|
|
||||||
bool attach(const wchar_t* text);
|
|
||||||
bool get_value(const wchar_t* key, int& val);
|
|
||||||
bool get_value(const wchar_t* key, std::wstring& val);
|
|
||||||
bool get_value(const wchar_t* key, json*& val);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class test_factory
|
std::map<int, CorrectMode> m_correctModeMap
|
||||||
{
|
{
|
||||||
typedef struct _test_func
|
{1, CorrectMode{200, true}},
|
||||||
{
|
{2, CorrectMode{200, false}},
|
||||||
std::wstring name;
|
{3, CorrectMode{300, true}},
|
||||||
int ver;
|
{4, CorrectMode{300, false}},
|
||||||
int(__stdcall* test_api)(const wchar_t*, const wchar_t*, ui_helper*);
|
{5, CorrectMode{600, true}},
|
||||||
|
{6, CorrectMode{600, false}}
|
||||||
struct _test_func()
|
|
||||||
{
|
|
||||||
name = L"";
|
|
||||||
ver = 0;
|
|
||||||
test_api = NULL;
|
|
||||||
}
|
|
||||||
bool operator==(const wchar_t* n)
|
|
||||||
{
|
|
||||||
return name == n;
|
|
||||||
}
|
|
||||||
}TESTFUNC, *LPTESTFUNC;
|
|
||||||
std::vector<TESTFUNC> test_;
|
|
||||||
|
|
||||||
void add_api(const wchar_t* name, int ver, int(__stdcall* test_api)(const wchar_t*, const wchar_t*, ui_helper*))
|
|
||||||
{
|
|
||||||
std::vector<TESTFUNC>::iterator it = std::find(test_.begin(), test_.end(), name);
|
|
||||||
|
|
||||||
if (it == test_.end())
|
|
||||||
{
|
|
||||||
TESTFUNC tf;
|
|
||||||
|
|
||||||
tf.name = name;
|
|
||||||
tf.ver = ver;
|
|
||||||
tf.test_api = test_api;
|
|
||||||
test_.push_back(tf);
|
|
||||||
}
|
|
||||||
else if (ver > it->ver)
|
|
||||||
{
|
|
||||||
it->test_api = test_api;
|
|
||||||
it->ver = ver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void load_test_dll(const wchar_t* path_dll)
|
|
||||||
{
|
|
||||||
HMODULE mod = LoadLibraryW(path_dll);
|
|
||||||
int(__stdcall * init)(void*) = NULL;
|
|
||||||
int(__stdcall * get)(void*, size_t*) = NULL;
|
|
||||||
int(__stdcall * go)(const wchar_t*, const wchar_t*, ui_helper*) = NULL;
|
|
||||||
FARPROC* api = (FARPROC*)&init;
|
|
||||||
wchar_t* buf = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
json* root = NULL, * child = NULL;
|
|
||||||
|
|
||||||
if (!mod)
|
|
||||||
return;
|
|
||||||
|
|
||||||
*api = GetProcAddress(mod, "func_test_init");
|
|
||||||
if (!api)
|
|
||||||
{
|
|
||||||
FreeLibrary(mod);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
init(NULL);
|
|
||||||
|
|
||||||
api = (FARPROC*)&get;
|
|
||||||
*api = GetProcAddress(mod, "func_test_get_list");
|
|
||||||
if(!api)
|
|
||||||
{
|
|
||||||
FreeLibrary(mod);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
api = (FARPROC*)&go;
|
|
||||||
*api = GetProcAddress(mod, "func_test_go");
|
|
||||||
if (!api)
|
|
||||||
{
|
|
||||||
FreeLibrary(mod);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(get(buf, &len) != ERROR_INSUFFICIENT_BUFFER)
|
|
||||||
{
|
|
||||||
FreeLibrary(mod);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = new wchar_t[len + 8];
|
|
||||||
memset(buf, 0, (len + 8) * 2);
|
|
||||||
if (get(buf, &len))
|
|
||||||
{
|
|
||||||
delete[] buf;
|
|
||||||
FreeLibrary(mod);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse json ...
|
|
||||||
len = 0;
|
|
||||||
root = new json();
|
|
||||||
if (root->attach(buf))
|
|
||||||
{
|
|
||||||
for (int i = 1; 1; ++i)
|
|
||||||
{
|
|
||||||
swprintf_s(buf, 20, L"%d", i);
|
|
||||||
if (!root->get_value(buf, child) || !child)
|
|
||||||
break;
|
|
||||||
|
|
||||||
std::wstring name(L"");
|
|
||||||
int ver = 0;
|
|
||||||
if (child->get_value(L"name", name) && child->get_value(L"ver", ver))
|
|
||||||
{
|
|
||||||
add_api(name.c_str(), ver, go);
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
child->release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
root->release();
|
|
||||||
delete[] buf;
|
|
||||||
if (len == 0)
|
|
||||||
FreeLibrary(mod);
|
|
||||||
}
|
|
||||||
void init(void)
|
|
||||||
{
|
|
||||||
wchar_t path[MAX_PATH] = { 0 };
|
|
||||||
std::wstring dir(L"");
|
|
||||||
size_t pos = 0;
|
|
||||||
HANDLE hf = INVALID_HANDLE_VALUE;
|
|
||||||
WIN32_FIND_DATAW fd = { 0 };
|
|
||||||
|
|
||||||
GetModuleFileNameW(NULL, path, _countof(path) - 1);
|
|
||||||
dir = pos;
|
|
||||||
pos = dir.rfind(L'\\');
|
|
||||||
if (pos++ == std::wstring::npos)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dir.erase(pos);
|
|
||||||
dir += L"dlls\\";
|
|
||||||
hf = FindFirstFileW((dir + L"*.dll").c_str(), &fd);
|
|
||||||
if (hf != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
load_test_dll((dir + fd.cFileName).c_str());
|
|
||||||
} while (FindNextFileW(hf, &fd));
|
|
||||||
|
|
||||||
FindClose(hf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
test_factory()
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
~test_factory()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool is_test_available(const wchar_t* name) // check if the test item with name 'name' is supported
|
|
||||||
{
|
|
||||||
std::vector<TESTFUNC>::iterator it = std::find(test_.begin(), test_.end(), name);
|
|
||||||
|
|
||||||
return it != test_.end();
|
|
||||||
}
|
|
||||||
int test(const wchar_t* name, ui_helper* ui, const wchar_t* oper = L"start")
|
|
||||||
{
|
|
||||||
std::vector<TESTFUNC>::iterator it = std::find(test_.begin(), test_.end(), name);
|
|
||||||
|
|
||||||
if (it == test_.end())
|
|
||||||
return ERROR_NOT_SUPPORTED;
|
|
||||||
|
|
||||||
return it->test_api(name, oper, ui);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
/////////////////////////*////////////////////////////////////////////////////////////////////////
|
|
||||||
|
private:
|
||||||
|
/*设置vid pid*/
|
||||||
|
int test_set_vidpid(void* data);
|
||||||
|
/*设置序列号*/
|
||||||
|
int test_set_serial_num(void* data);
|
||||||
|
/* 设置休眠 */
|
||||||
|
int test_dormancy(void* data);
|
||||||
|
/*获取固件版本号*/
|
||||||
|
std::string get_firmware_version();
|
||||||
|
/* 配置速度模式 */
|
||||||
|
int test_configure_speed_mode(void* data);
|
||||||
|
int set_init_cfg(void* data);
|
||||||
|
/*设置序列号*/
|
||||||
|
int test_set_json_serial_num(void* data);
|
||||||
|
/* 清理纸道功能确认 */
|
||||||
|
int tset_clear_paper_path(void* data);
|
||||||
|
/* 按键功能检测 */
|
||||||
|
int test_key_funtion(void* data);
|
||||||
|
/* 计数模式检测 */
|
||||||
|
int test_count_mode(void* data);
|
||||||
|
/* 歪斜检测 */
|
||||||
|
int test_skew_detection(void* data);
|
||||||
|
/* 分纸电机检测 */
|
||||||
|
int test_separater_motor(void* data);
|
||||||
|
/* cis原图初检 */
|
||||||
|
int test_cis__original_image(void* data);
|
||||||
|
/* 主机风扇功能检测 */
|
||||||
|
int test_host_fan(void* data);
|
||||||
|
/* 扫描工作状态 */
|
||||||
|
int test_scan_work_status(void* data);
|
||||||
|
/* USB-PC接口 */
|
||||||
|
int test_usb_pc_interface(void* data);
|
||||||
|
/* 超声波模块检验 */
|
||||||
|
int test_ultrasonic_module(void* data);
|
||||||
|
/* led灯状态检查 */
|
||||||
|
int test_led_light(void* data);
|
||||||
|
/* 复位检查 */
|
||||||
|
int test_reset(void* data);
|
||||||
|
/* 走纸检查 */
|
||||||
|
int test_paper_feed(void* data);
|
||||||
|
/* 扫描传感器检查 */
|
||||||
|
int test_scanning_sensor(void* data);
|
||||||
|
/* 放置校正纸 */
|
||||||
|
int test_place_correction_paper(void* data);
|
||||||
|
/* 自动平场校正 */
|
||||||
|
int test_auto_flat_field(void* data);
|
||||||
|
/* 重启设备 */
|
||||||
|
int test_reboot_device(void* data);
|
||||||
|
/* 扫描图像彩色质量确认 */
|
||||||
|
int test_image_color_quality(void* data);
|
||||||
|
/* 扫描图像灰度质量确认 */
|
||||||
|
int test_image_gray_quality(void* data);
|
||||||
|
/* 获取自动计算畸变值 */
|
||||||
|
int test_get_auto_distortion(void* data);
|
||||||
|
int test_set_auto_distortion(void* data);
|
||||||
|
int test_confirm_auto_distortion(void* data);
|
||||||
|
/* 分纸强度检测 */
|
||||||
|
int test_paper_separation_strength(void* data);
|
||||||
|
/* 机械走纸倾斜检测 */
|
||||||
|
int test_mech_paper_feeding_inclination(void* data);
|
||||||
|
/* 清除滚轴计数 */
|
||||||
|
int test_clear_roller_count(void* data);
|
||||||
|
/* 清除历史计数 */
|
||||||
|
int test_clear_history_count(void* data);
|
||||||
|
/* 单张测试 */
|
||||||
|
int test_single_page_test(void* data);
|
||||||
|
/*压力测试彩色_200dpi*/
|
||||||
|
int test_pressuer_test_rgb_200dpi(void* data);
|
||||||
|
/*压力测试灰色_200dpi*/
|
||||||
|
int test_pressuer_test_gray_200dpi(void* data);
|
||||||
|
/*压力测试彩色_300dpi*/
|
||||||
|
int test_pressuer_test_rgb_300dpi(void* data);
|
||||||
|
/*压力测试灰色_300dpi*/
|
||||||
|
int test_pressuer_test_gray_300dpi(void* data);
|
||||||
|
/*压力测试彩色_600dpi*/
|
||||||
|
int test_pressuer_test_rgb_600dpi(void* data);
|
||||||
|
/*压力测试灰色_600dpi*/
|
||||||
|
int test_pressuer_test_gray_600dpi(void* data);
|
||||||
|
/*获取设备配置*/
|
||||||
|
int test_get_device_config(void* data);
|
||||||
|
/*获取设备内存和硬盘容量大小*/
|
||||||
|
int test_get_device_cpu_disk(void* data);
|
||||||
|
/* 备份设备配置 */
|
||||||
|
int test_backup(void* data);
|
||||||
|
/* 关机 */
|
||||||
|
int test_shutdown(void* data);
|
||||||
|
/* 设置固件语言模式 */
|
||||||
|
int test_set_firmware_language(void* data);
|
||||||
|
/*设置设备型号*/
|
||||||
|
int test_set_devs_model(void* data);
|
||||||
|
/*动态图像校正*/
|
||||||
|
int public_test_image_correct(std::string correctData, int dpi, bool isColor);
|
||||||
|
int public_test_image_correct(void* data, int dpi, bool isColor);
|
||||||
|
int test_image_correct_all(void* data);
|
||||||
|
int test_image_correct_rgb_200dpi(void* data);
|
||||||
|
int test_image_correct_gray_200dpi(void* data);
|
||||||
|
int test_image_correct_rgb_300dpi(void* data);
|
||||||
|
int test_image_correct_gray_300dpi(void* data);
|
||||||
|
int test_image_correct_rgb_600dpi(void* data);
|
||||||
|
int test_image_correct_gray_600dpi(void* data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue