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:
|
||||
|
||||
@@ -106,6 +106,8 @@ private:
|
||||
void startTransfer();
|
||||
void initEmptyScanMeasurementID();
|
||||
void controlDrainage(const QString& aCode);
|
||||
void checkInitStatus();
|
||||
void initGUI();
|
||||
|
||||
void processScanProgress(const QString& aProgress);
|
||||
void processInitializeProgress(const QString& aProgress);
|
||||
@@ -154,6 +156,7 @@ signals:
|
||||
void responseSetHeartBeat(const QString& aResponese);
|
||||
void responseStopTransfer(const QString& aResponse);
|
||||
void responseShutDown(const QString& aResponse);
|
||||
void responseCheckInitStatus(const QString& aResponse);
|
||||
//Recon
|
||||
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
||||
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
||||
@@ -172,6 +175,7 @@ signals:
|
||||
private:
|
||||
int mTemperatureTimer = -1;
|
||||
int mScanProgressTimer = -1;
|
||||
int mCheckInitStatusTimer = -1;
|
||||
int mTransferProgress = 0;
|
||||
bool mIsEmptyScan = false;
|
||||
bool mIsTransferEmptyScan = false;
|
||||
@@ -202,6 +206,7 @@ private:
|
||||
DmsSyncAction* mGetCEStatusAction = nullptr;
|
||||
DmsSyncAction* mSetSimulatorModeAction = nullptr;
|
||||
DmsSyncAction* mSetHeartBeatAction = nullptr;
|
||||
DmsSyncAction* mCheckInitStatusAction = nullptr;
|
||||
|
||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||
|
||||
@@ -92,6 +92,8 @@ void InfoReceiveWorker::responsed(int aServerID, int aActionID)
|
||||
case ACT_IFCFG_HBCFG :
|
||||
DeviceManager::Default()->mSetHeartBeatAction->responsed();
|
||||
break;
|
||||
case ACT_IFCFG_INIT_STATUS :
|
||||
DeviceManager::Default()->mCheckInitStatusAction->responsed();
|
||||
}
|
||||
break;
|
||||
case USRV_CONTROL:
|
||||
|
||||
@@ -13,6 +13,7 @@ enum{
|
||||
USRV_LOGALARM, //日志和报警服务
|
||||
USRV_HEARTBEAT, //心跳服务
|
||||
USRV_NET, //网络服务,设备端专用
|
||||
USRV_DIAGNOSIS, //诊断服务
|
||||
};
|
||||
|
||||
//扫查服务动作
|
||||
@@ -34,6 +35,7 @@ enum{
|
||||
ACT_SCAN_PRESIG, //预扫数据产生完成信号
|
||||
ACT_SCAN_PRERESP, //上位机处理完数据后的响应
|
||||
ACT_SCAN_CE_STATUS, //是否已经完成当天的扫查
|
||||
ACT_SCAN_DIAGNOSIS, //诊断扫查
|
||||
};
|
||||
|
||||
//数据传输服务
|
||||
@@ -57,6 +59,7 @@ enum{
|
||||
ACT_IFCFG_SYSCFG, //GUI发给设备为请求数据,设备上报数据内容
|
||||
ACT_IFCFG_HBCFG, //设置心跳频率
|
||||
ACT_IFCFG_DEFAULT, //将配置恢复到默认值(再次加载配置文件到结构体)
|
||||
ACT_IFCFG_INIT_STATUS, //查询设备是否完成初始化
|
||||
};
|
||||
|
||||
//杂类控制和调试服务
|
||||
@@ -82,6 +85,7 @@ enum{
|
||||
ACT_CTL_FEB_RESET,
|
||||
ACT_CTL_PUMP, //水泵启停
|
||||
ACT_CTL_PWRDOWN, //下电开关
|
||||
ACT_CTL_DRIVER, //驱动控制(加载卸载驱动)
|
||||
};
|
||||
|
||||
//设备升级
|
||||
@@ -119,5 +123,18 @@ enum{
|
||||
ACT_NET_DEFAULT, //重置网络
|
||||
};
|
||||
|
||||
//调试诊断服务
|
||||
enum{
|
||||
ACT_DIG_NONE = 0,
|
||||
ACT_DIG_SYNC, //同步状态(板卡以及其他)
|
||||
ACT_DIG_STOP, //停止当前诊断操作
|
||||
ACT_DIG_ADCCHECK, //ADC自测
|
||||
ACT_DIG_LOOPBACK, //网线回环自测
|
||||
ACT_DIG_SIGSHOT, //指定个TAS发射,某些TAS接收
|
||||
ACT_DIG_SCANPARM, //带参数的扫查(各类参数排列组合,缺失TAS,减少MUX等操作)
|
||||
ACT_DIG_PROGRESS, //进度上报
|
||||
ACT_DIG_WARNING, //报警状态上报
|
||||
ACT_DIG_MISCT, //杂类测试。
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#define MAX_MQBLK_NO 5
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum{
|
||||
MQERR_DISCONNECT = -1,
|
||||
MQERR_FULL = -2,
|
||||
@@ -32,4 +34,4 @@ int dmsmq_recv( int *srvid, int *actid, uint8_t *data );
|
||||
// 返回值 0 成功,< 0 异常信息
|
||||
int dmsmq_send( int srvid, int actid, uint8_t *data, int len );
|
||||
int dmsmq_sendx( int srvid, int actid, uint8_t *data, int len );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user