屏蔽烧录模式的sane接口调用

This commit is contained in:
yangjiaxuan 2023-01-10 09:38:03 +08:00
parent 51ee1076aa
commit 01c71678d7
5 changed files with 92 additions and 109 deletions

View File

@ -614,17 +614,17 @@
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="95"/>
<location filename="form_burnmode.cpp" line="89"/>
<source>ID</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="95"/>
<location filename="form_burnmode.cpp" line="89"/>
<source>selected</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="95"/>
<location filename="form_burnmode.cpp" line="89"/>
<source>device</source>
<translation></translation>
</message>
@ -633,14 +633,14 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="153"/>
<location filename="form_burnmode.cpp" line="339"/>
<location filename="form_burnmode.cpp" line="147"/>
<location filename="form_burnmode.cpp" line="324"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="form_burnmode.cpp" line="153"/>
<location filename="form_burnmode.cpp" line="339"/>
<location filename="form_burnmode.cpp" line="147"/>
<location filename="form_burnmode.cpp" line="324"/>
<source>Please check a devices at least</source>
<translation></translation>
</message>
@ -741,28 +741,28 @@
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="55"/>
<location filename="form_maininterface.cpp" line="57"/>
<source>Device has connected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="59"/>
<location filename="form_maininterface.cpp" line="61"/>
<source>Device hasnot connected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="60"/>
<location filename="form_maininterface.cpp" line="62"/>
<source>Device type:</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="60"/>
<location filename="form_maininterface.cpp" line="62"/>
<source> SerialNum:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="61"/>
<location filename="form_maininterface.cpp" line="146"/>
<location filename="form_maininterface.cpp" line="63"/>
<location filename="form_maininterface.cpp" line="149"/>
<source> connect status:</source>
<translation> </translation>
</message>
@ -775,23 +775,22 @@
<translation type="vanished"> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="85"/>
<location filename="form_maininterface.cpp" line="87"/>
<source>load last image which uploaded last time</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="145"/>
<location filename="form_maininterface.cpp" line="148"/>
<source>Device has disconnected</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="162"/>
<location filename="form_maininterface.cpp" line="613"/>
<location filename="form_maininterface.cpp" line="165"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="196"/>
<location filename="form_maininterface.cpp" line="209"/>
<source>destortion value: </source>
<translation> </translation>
</message>
@ -804,74 +803,74 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="66"/>
<location filename="form_maininterface.cpp" line="68"/>
<source> speed mode:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="71"/>
<location filename="form_maininterface.cpp" line="73"/>
<source> sleep time:</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="329"/>
<location filename="form_maininterface.cpp" line="343"/>
<source>ID</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="329"/>
<location filename="form_maininterface.cpp" line="343"/>
<source>Test items</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="329"/>
<location filename="form_maininterface.cpp" line="343"/>
<source>status</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="411"/>
<location filename="form_maininterface.cpp" line="425"/>
<source>not test</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="411"/>
<location filename="form_maininterface.cpp" line="425"/>
<source>not pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="411"/>
<location filename="form_maininterface.cpp" line="425"/>
<source>not support</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="411"/>
<location filename="form_maininterface.cpp" line="425"/>
<source>pass</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="466"/>
<location filename="form_maininterface.cpp" line="208"/>
<location filename="form_maininterface.cpp" line="490"/>
<source>image pixel: </source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="495"/>
<location filename="form_maininterface.cpp" line="519"/>
<source> minute</source>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="511"/>
<location filename="form_maininterface.cpp" line="535"/>
<source> VID:</source>
<translation> VID</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="511"/>
<location filename="form_maininterface.cpp" line="535"/>
<source> PID:</source>
<translation> PID</translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="613"/>
<source>no image</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
</context>
<context>
@ -960,7 +959,6 @@
</message>
<message>
<location filename="mainwindow.cpp" line="309"/>
<location filename="mainwindow.cpp" line="419"/>
<location filename="mainwindow.cpp" line="441"/>
<location filename="mainwindow.cpp" line="455"/>
<location filename="mainwindow.cpp" line="511"/>
@ -1000,11 +998,16 @@
<source>Is testing, do not close!</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="419"/>
<source>warning</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="420"/>
<source>Confirm whether the device is reset</source>
<oldsource>Are you sure to connect the new device</oldsource>
<translation></translation>
<translation></translation>
</message>
<message>
<source>yes</source>

View File

@ -45,12 +45,6 @@ void Form_BurnMode::addDevice(DeviceManager *devManager)
item->setData(Qt::UserRole, var);
updatetablewidget();
// for(int i = 0; i < ui->tableWidget->rowCount(); i++)
// {
// QTableWidgetItem *item = ui->tableWidget->item(i, 3);
// if (item != nullptr)
// item->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
// }
m_curIndex++;
}
@ -209,16 +203,12 @@ void Form_BurnMode::on_pbtn_burn_clicked()
// }
//}
DeviceManager::DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode,
SANE_Handle handle, const QString & devName, const QString & sn, const QString &devType)
DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString & devName)
{
m_mainwnd = mainwnd;
m_pdtToolDbuserMgr = pdtToolDbuserMgr;
m_burnMode = burnMode;
m_handle = handle;
m_devName = devName;
m_sn = sn;
m_devType = devType;
m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle);
}
@ -236,11 +226,6 @@ QString DeviceManager::getDevName()
return m_devName;
}
QString DeviceManager::getSn()
{
return m_sn;
}
void DeviceManager::setBurnMode()
{
const wchar_t *p = L"1";
@ -249,65 +234,65 @@ void DeviceManager::setBurnMode()
}
void DeviceManager::setSn(QString sn)
{
LPWRITECFG p = new WRITECFG;
//void DeviceManager::setSn(QString sn)
//{
// LPWRITECFG p = new WRITECFG;
std::wstring sn2 = sn.toStdWString();
p->cat = WRITE_CAT_SERIALNUM;
p->val = (void*)sn2.c_str();
m_mainwnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
// std::wstring sn2 = sn.toStdWString();
// p->cat = WRITE_CAT_SERIALNUM;
// p->val = (void*)sn2.c_str();
// m_mainwnd->addTestingRef();
// func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
setGlobalCfg();
// setGlobalCfg();
delete p;
}
// delete p;
//}
QString DeviceManager::getUpdatedSn()
{
return m_mainwnd->getDevSn(m_handle);
}
//QString DeviceManager::getUpdatedSn()
//{
// return m_mainwnd->getDevSn(m_handle);
//}
void DeviceManager::setGlobalCfg()
{
HGChar cfgPath[512] = {0};
HGBase_GetConfigPath(cfgPath, 512);
HGBase_CreateDir(cfgPath);
strcat(cfgPath, m_devType.toStdString().c_str());
strcat(cfgPath, ".json");
//void DeviceManager::setGlobalCfg()
//{
// HGChar cfgPath[512] = {0};
// HGBase_GetConfigPath(cfgPath, 512);
// HGBase_CreateDir(cfgPath);
// strcat(cfgPath, m_devType.toStdString().c_str());
// strcat(cfgPath, ".json");
HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
// HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
// AnalysisJson analysisJson(QString::fromStdString(cfgPath));
assert(nullptr != m_hg);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;
// assert(nullptr != m_hg);
// AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
// LPWRITECFG lp = new WRITECFG;
VIDPID vidpid;
vidpid.VID = jsonGlobal.vid_to;
vidpid.PID = jsonGlobal.pid_to;
int vidpidValue = vidpid.Value;
lp->cat = WRITE_CAT_VID_PID;
lp->val = (void*)&vidpidValue;
m_mainwnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
// VIDPID vidpid;
// vidpid.VID = jsonGlobal.vid_to;
// vidpid.PID = jsonGlobal.pid_to;
// int vidpidValue = vidpid.Value;
// lp->cat = WRITE_CAT_VID_PID;
// lp->val = (void*)&vidpidValue;
// m_mainwnd->addTestingRef();
// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
int speedMode = jsonGlobal.speed_mode ;
lp->cat = WRITE_CAT_SPEED;
lp->val = (void*)&speedMode;
m_mainwnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
// int speedMode = jsonGlobal.speed_mode ;
// lp->cat = WRITE_CAT_SPEED;
// lp->val = (void*)&speedMode;
// m_mainwnd->addTestingRef();
// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
int sleepTime = jsonGlobal.sleep_time;
lp->cat = WRITE_CAT_SLEEP;
lp->val = (void*)&sleepTime;
m_mainwnd->addTestingRef();
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
// int sleepTime = jsonGlobal.sleep_time;
// lp->cat = WRITE_CAT_SLEEP;
// lp->val = (void*)&sleepTime;
// m_mainwnd->addTestingRef();
// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
delete lp;
}
// delete lp;
//}
void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
{

View File

@ -14,17 +14,15 @@ class Form_BurnMode;
class DeviceManager
{
public:
DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode,
SANE_Handle handle, const QString &devName, const QString &sn, const QString &devType);
DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString &devName);
~DeviceManager();
QString getDevName();
QString getSn();
void setBurnMode();
void setSn(QString sn);
QString getUpdatedSn();
// void setSn(QString sn);
// QString getUpdatedSn();
SANE_Handle m_handle;
void setGlobalCfg();
// void setGlobalCfg();
private:
union VIDPID
@ -39,11 +37,8 @@ private:
private:
class MainWindow *m_mainwnd;
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
class Form_BurnMode *m_burnMode;
QString m_devName;
QString m_sn;
QString m_devType;
hgscanner *m_hg;
};

View File

@ -410,13 +410,13 @@ void MainWindow::on_sane_dev_arrive(QString devName)
sane_open(devName.toStdString().c_str(), &devHandle);
if (nullptr != devHandle)
{
DeviceManager *devManager = new DeviceManager(this, m_pdtToolDbuserMgr, m_formBurnMode, devHandle, devName, getDevSn(devHandle), getDevType(devHandle));
DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, devName);
m_formBurnMode->addDevice(devManager);
}
}
else
{
QMessageBox msg(QMessageBox::Question, tr("tips"),
QMessageBox msg(QMessageBox::Warning, tr("warning"),
tr("Confirm whether the device is reset"),
QMessageBox::Yes | QMessageBox::No, this);
msg.setButtonText(QMessageBox::Yes, tr("confirm"));