合并六项动态图像校正为一项
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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_;
|
||||||
|
|
||||||
public:
|
void init_test_map_();
|
||||||
bool attach(const wchar_t* text);
|
int set_test(const wchar_t* name, const wchar_t* oper);
|
||||||
bool get_value(const wchar_t* key, int& val);
|
|
||||||
bool get_value(const wchar_t* key, std::wstring& val);
|
private:
|
||||||
bool get_value(const wchar_t* key, json*& val);
|
std::unique_ptr<std::thread> thread_dynamic_correct_handle;
|
||||||
|
void thread_dynamic_correct(std::string correctData);
|
||||||
|
|
||||||
|
struct CorrectMode
|
||||||
|
{
|
||||||
|
int dpi;
|
||||||
|
bool isColor;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
std::map<int, CorrectMode> m_correctModeMap
|
||||||
|
{
|
||||||
|
{1, CorrectMode{200, true}},
|
||||||
|
{2, CorrectMode{200, false}},
|
||||||
|
{3, CorrectMode{300, true}},
|
||||||
|
{4, CorrectMode{300, false}},
|
||||||
|
{5, CorrectMode{600, true}},
|
||||||
|
{6, CorrectMode{600, false}}
|
||||||
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
class test_factory
|
|
||||||
{
|
|
||||||
typedef struct _test_func
|
|
||||||
{
|
|
||||||
std::wstring name;
|
|
||||||
int ver;
|
|
||||||
int(__stdcall* test_api)(const wchar_t*, const wchar_t*, ui_helper*);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/////////////////////////*////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
Loading…
Reference in New Issue