设置序列号时,点击确定,再根据json设置一次休眠时间
This commit is contained in:
parent
0ff0e7c9b0
commit
7f1899e741
|
@ -76,56 +76,63 @@ void Dialog_InputSerialNum::Invalid(const QString &devName)
|
|||
}
|
||||
}
|
||||
|
||||
void Dialog_InputSerialNum::setSpeedAndSleep()
|
||||
void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep)
|
||||
{
|
||||
if (m_hg != nullptr)
|
||||
if (m_hg == nullptr)
|
||||
{
|
||||
HGChar cfgPath[512] = {0};
|
||||
HGBase_GetConfigPath(cfgPath, 512);
|
||||
HGBase_CreateDir(cfgPath);
|
||||
strcat(cfgPath, m_devType.toStdString().c_str());
|
||||
strcat(cfgPath, ".json");
|
||||
return;
|
||||
}
|
||||
|
||||
HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
||||
HGChar cfgPath[512] = {0};
|
||||
HGBase_GetConfigPath(cfgPath, 512);
|
||||
HGBase_CreateDir(cfgPath);
|
||||
strcat(cfgPath, m_devType.toStdString().c_str());
|
||||
strcat(cfgPath, ".json");
|
||||
|
||||
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
||||
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
||||
LPWRITECFG lp = new WRITECFG;
|
||||
HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
||||
|
||||
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);
|
||||
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
||||
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
||||
LPWRITECFG lp = new WRITECFG;
|
||||
|
||||
if (updateSleep)
|
||||
{
|
||||
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);
|
||||
|
||||
QString device_model = jsonGlobal.device_model;
|
||||
if (!device_model.isEmpty())
|
||||
{
|
||||
std::wstring devModel = device_model.toStdWString();
|
||||
lp->cat = WRITE_CAT_DEVS_MODEL;
|
||||
lp->val = (void*)devModel.c_str();
|
||||
m_mainWnd->addTestingRef();
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
||||
}
|
||||
|
||||
delete lp;
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
QString device_model = jsonGlobal.device_model;
|
||||
if (!device_model.isEmpty())
|
||||
{
|
||||
std::wstring devModel = device_model.toStdWString();
|
||||
lp->cat = WRITE_CAT_DEVS_MODEL;
|
||||
lp->val = (void*)devModel.c_str();
|
||||
m_mainWnd->addTestingRef();
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
||||
}
|
||||
|
||||
delete lp;
|
||||
}
|
||||
|
||||
void Dialog_InputSerialNum::on_testResult()
|
||||
|
@ -163,6 +170,8 @@ void Dialog_InputSerialNum::on_pbtn_ok_clicked()
|
|||
QMessageBox::information(this, tr("tips"), tr("The device is testing"));
|
||||
return;
|
||||
}
|
||||
|
||||
setSpeedAndSleep(true);
|
||||
accept();
|
||||
}
|
||||
|
||||
|
@ -185,5 +194,5 @@ void Dialog_InputSerialNum::on_pbtn_setSn_clicked()
|
|||
QMessageBox::information(this, tr("tips"), tr("set sn succeed"));
|
||||
}
|
||||
|
||||
setSpeedAndSleep();
|
||||
setSpeedAndSleep(false);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
QString GetSn();
|
||||
QString GetDevType();
|
||||
void Invalid(const QString &devName);
|
||||
void setSpeedAndSleep();
|
||||
void setSpeedAndSleep(bool updateSleep);
|
||||
|
||||
signals:
|
||||
void testResult();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include"test_base.h"
|
||||
#include"test_base.h"
|
||||
#include<string>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
|
Loading…
Reference in New Issue