Fix initialize timeout bug.
This commit is contained in:
@@ -84,27 +84,6 @@ QString getFullScanJson(QObject* obj)
|
||||
void DeviceManager::initDevice()
|
||||
{
|
||||
dmsmq_init();
|
||||
if(JsonObject::Instance()->isDmsSimulator())
|
||||
{
|
||||
//set simulator
|
||||
QString simulatorCode = "{ \"code\":0, \"info\":\"1\"}";
|
||||
QByteArray byteArray = simulatorCode.toUtf8();
|
||||
uint8_t* data = reinterpret_cast<uint8_t*>(byteArray.data());
|
||||
dmsmq_send(USRV_SCAN, ACT_SCAN_SIMULATOR,data, simulatorCode.size());
|
||||
}
|
||||
//set heart beat=0
|
||||
QString heartBeatCode = "{ \"code\":0, \"info\":\"0\"}";
|
||||
QByteArray byteArray = heartBeatCode.toUtf8();
|
||||
uint8_t* data = reinterpret_cast<uint8_t*>(byteArray.data());
|
||||
dmsmq_send(USRV_INFOCFG, ACT_IFCFG_HBCFG,data, heartBeatCode.size());
|
||||
//set log level
|
||||
QString logLevelCode = "{ \"code\":0, \"info\":\"3\"}";
|
||||
byteArray = logLevelCode.toUtf8();
|
||||
data = reinterpret_cast<uint8_t*>(byteArray.data());
|
||||
dmsmq_send(USRV_LOGALARM, ACT_LOGALM_CFG,data, heartBeatCode.size());
|
||||
|
||||
|
||||
mTemperatureTimer = startTimer(GET_TEMPERATURE_TIME);
|
||||
|
||||
// empty scan
|
||||
connect(EventCenter::Default(), &EventCenter::RequestEmptyScan, [=](QObject* sender, QObject* detail)
|
||||
@@ -139,6 +118,8 @@ void DeviceManager::initDevice()
|
||||
mCEScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_CE, this, "responseCEScan(const QString&)", this);
|
||||
mGetCEStatusAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_CE_STATUS, this, "responseGetCEStatus(const QString&)", this);
|
||||
mPumpControlAction = new DmsSyncAction(USRV_CONTROL, ACT_CTL_PUMP, this, "responsePumpControl(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);
|
||||
|
||||
//Async action
|
||||
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
||||
@@ -169,6 +150,16 @@ void DeviceManager::initDevice()
|
||||
mReconHttpThread->start();
|
||||
|
||||
//init dms status--------------------make a function future
|
||||
if(JsonObject::Instance()->isDmsSimulator())
|
||||
{
|
||||
//set simulator
|
||||
mSetSimulatorModeAction->setSendData("{ \"code\":0, \"info\":\"1\"}");
|
||||
mSetSimulatorModeAction->execute();
|
||||
}
|
||||
|
||||
mSetHeartBeatAction->setSendData("{ \"code\":0, \"info\":\"0\"}");
|
||||
mSetHeartBeatAction->execute();
|
||||
|
||||
if(getDeviceStatus() != DeviceStatus::Rready)
|
||||
{
|
||||
mStopScanAction->execute();
|
||||
@@ -193,6 +184,7 @@ void DeviceManager::initDevice()
|
||||
|
||||
startTransfer();
|
||||
initEmptyScanMeasurementID();
|
||||
mTemperatureTimer = startTimer(GET_TEMPERATURE_TIME);
|
||||
//mGetSoftwareVersionAction->execute();
|
||||
|
||||
|
||||
@@ -547,6 +539,9 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
case ACT_SCAN_CE_STATUS :
|
||||
emit responseGetCEStatus(aContents);
|
||||
break;
|
||||
case ACT_SCAN_SIMULATOR:
|
||||
emit responseSetSimulatorMode(aContents);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -582,6 +577,9 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
emit responseGetSoftwareVersion(aContents);
|
||||
processGetSoftwareVersion(aContents);
|
||||
break;
|
||||
case ACT_IFCFG_HBCFG :
|
||||
emit responseSetHeartBeat(aContents);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_CONTROL:
|
||||
|
||||
Reference in New Issue
Block a user