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:
|
||||
|
||||
@@ -145,7 +145,9 @@ signals:
|
||||
void responseTransfer(const QString& aResponse);
|
||||
void responseGetTransferProgress(const QString& aProgress);
|
||||
void responseGetCEStatus(const QString& aProgress);
|
||||
void responsePumpControl(const QString aResponse);
|
||||
void responsePumpControl(const QString& aResponse);
|
||||
void responseSetSimulatorMode(const QString& aResponse);
|
||||
void responseSetHeartBeat(const QString& aResponese);
|
||||
//Recon
|
||||
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
||||
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
||||
@@ -191,6 +193,8 @@ private:
|
||||
DmsSyncAction* mGetTransferProgressAction = nullptr;
|
||||
DmsSyncAction* mGetCEStatusAction = nullptr;
|
||||
DmsSyncAction* mPumpControlAction = nullptr;
|
||||
DmsSyncAction* mSetSimulatorModeAction = nullptr;
|
||||
DmsSyncAction* mSetHeartBeatAction = nullptr;
|
||||
|
||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||
|
||||
@@ -20,13 +20,6 @@ void InfoReceiveWorker::startListen()
|
||||
if(count >= 0)
|
||||
{
|
||||
uint8_t* copyData = data;
|
||||
if(serverID == USRV_LOGALARM && actionID == ACT_LOGALM_RPT)
|
||||
{
|
||||
data[count] = '\0';
|
||||
QString myQString = QString::fromUtf8(reinterpret_cast<const char*>(copyData + 3));
|
||||
emit infoReceived(serverID, actionID, myQString);
|
||||
continue;
|
||||
}
|
||||
data[count] = '\0';
|
||||
QString myQString = QString::fromUtf8(reinterpret_cast<const char*>(copyData));
|
||||
emit infoReceived(serverID, actionID, myQString);
|
||||
|
||||
Reference in New Issue
Block a user