Add GUI wait dms init.
This commit is contained in:
@@ -127,6 +127,7 @@ void DeviceManager::initDevice()
|
||||
mGetCEStatusAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_CE_STATUS, this, "responseGetCEStatus(const QString&)", this);
|
||||
mSetSimulatorModeAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_SIMULATOR, this, "responseSetSimulatorMode(const QString&)", this);
|
||||
mSetHeartBeatAction = new DmsSyncAction(USRV_INFOCFG, ACT_IFCFG_HBCFG, this, "responseSetHeartBeat(const QString&)", this);
|
||||
mCheckInitStatusAction = new DmsSyncAction(USRV_INFOCFG, ACT_IFCFG_INIT_STATUS, this, "responseCheckInitStatus(const QString&)", this);
|
||||
|
||||
//Async action
|
||||
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
||||
@@ -177,6 +178,11 @@ void DeviceManager::initDevice()
|
||||
mSetHeartBeatAction->setSendData("{ \"code\":0, \"info\":\"0\"}");
|
||||
mSetHeartBeatAction->execute();
|
||||
|
||||
mCheckInitStatusTimer = startTimer(500);
|
||||
}
|
||||
|
||||
void DeviceManager::initGUI()
|
||||
{
|
||||
if(getDeviceStatus() != DeviceStatus::Rready)
|
||||
{
|
||||
mStopScanAction->execute();
|
||||
@@ -204,8 +210,6 @@ void DeviceManager::initDevice()
|
||||
SQLHelper::exec(QString("DELETE FROM Patient WHERE AddDate <= %1").arg(date.toString("yyyy-MM-dd")));
|
||||
|
||||
//mGetSoftwareVersionAction->execute();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::processInitializeProgress(const QString& aProgress)
|
||||
@@ -480,6 +484,35 @@ void DeviceManager::startPreview()
|
||||
TRIGGER_EVENT(ResponsePreview, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void DeviceManager::checkInitStatus()
|
||||
{
|
||||
DmsSyncActionResult result = mCheckInitStatusAction->execute();
|
||||
if(!result.mIsSucessful)
|
||||
{
|
||||
if(mCheckInitStatusTimer != -1)
|
||||
{
|
||||
killTimer(mCheckInitStatusTimer);
|
||||
mCheckInitStatusTimer = -1;
|
||||
}
|
||||
QString msg = tr("Initialize Failed.");
|
||||
THROW_ERROR(msg);
|
||||
initGUI();
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||
if(jsonObj["code"].toInt() == 1)
|
||||
{
|
||||
if(mCheckInitStatusTimer != -1)
|
||||
{
|
||||
killTimer(mCheckInitStatusTimer);
|
||||
mCheckInitStatusTimer = -1;
|
||||
}
|
||||
initGUI();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::timerEvent(QTimerEvent* event)
|
||||
{
|
||||
if (event->timerId() == mTemperatureTimer)
|
||||
@@ -494,6 +527,11 @@ void DeviceManager::timerEvent(QTimerEvent* event)
|
||||
return QObject::timerEvent(event);
|
||||
}
|
||||
|
||||
if(event->timerId() == mCheckInitStatusTimer)
|
||||
{
|
||||
checkInitStatus();
|
||||
return QObject::timerEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::emitErrorCallback(const char *msg)
|
||||
@@ -600,6 +638,9 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
case ACT_IFCFG_HBCFG :
|
||||
emit responseSetHeartBeat(aContents);
|
||||
break;
|
||||
case ACT_IFCFG_INIT_STATUS :
|
||||
emit responseCheckInitStatus(aContents);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_CONTROL:
|
||||
|
||||
Reference in New Issue
Block a user