Add InitializeWidget before login.
This commit is contained in:
@@ -83,10 +83,10 @@ QString getFullScanJson(QObject* obj)
|
||||
|
||||
void DeviceManager::initDevice()
|
||||
{
|
||||
dmsmq_init();
|
||||
mIsInitializing = true;
|
||||
dmsmq_init();
|
||||
if(JsonObject::Instance()->isDmsSimulator())
|
||||
{
|
||||
qDebug()<< JsonObject::Instance()->isDmsSimulator();
|
||||
//set simulator
|
||||
QString simulatorCode = "{ \"code\":0, \"info\":\"1\"}";
|
||||
QByteArray byteArray = simulatorCode.toUtf8();
|
||||
@@ -132,7 +132,10 @@ void DeviceManager::initDevice()
|
||||
mPreviewScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_PREVIEW, this, "responsePreviewScan(const QString&)", this);
|
||||
mTransferAction = new DmsSyncAction(USRV_XFR, ACT_XFR_START, this, "responseTransfer(const QString&)", this);
|
||||
mGetTransferProgressAction = new DmsSyncAction(USRV_XFR, ACT_XFR_PROGRESS_PASSIVE, this, "responseGetTransferProgress(const QString&)", this);
|
||||
|
||||
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);
|
||||
|
||||
//Async action
|
||||
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
||||
mGetSoftwareVersionAction = new DmsAsyncAction(USRV_INFOCFG, ACT_IFCFG_VERINFO, this,"responseGetSoftwareVersion(const QString&)", this);
|
||||
@@ -166,10 +169,55 @@ void DeviceManager::initDevice()
|
||||
{
|
||||
mStopScanAction->execute();
|
||||
}
|
||||
startTransfer();
|
||||
if(!getCEStatus())
|
||||
{
|
||||
if(startCEScan())
|
||||
{
|
||||
mScanProgressTimer = startTimer(500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
emit initializeProgress("33");
|
||||
QThread::msleep(500);
|
||||
emit initializeProgress("66");
|
||||
QThread::msleep(500);
|
||||
emit initializeProgress("100");
|
||||
emit initializeFinished();
|
||||
}
|
||||
|
||||
startTransfer();
|
||||
initEmptyScanMeasurementID();
|
||||
//mGetSoftwareVersionAction->execute();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::processInitializeProgress(const QString& aProgress)
|
||||
{
|
||||
if(!mIsInitializing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QJsonObject jsonObj = toJsonObject(aProgress);
|
||||
int code = jsonObj["code"].toInt();
|
||||
QString msg = jsonObj["info"].toString();
|
||||
switch (code)
|
||||
{
|
||||
case 1:
|
||||
emit initializeProgress(msg);
|
||||
break;
|
||||
case 2:
|
||||
prepareFinishInitialize();
|
||||
emit initializeFinished();
|
||||
break;
|
||||
case -1:
|
||||
prepareFinishInitialize();
|
||||
THROW_ERROR(msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceManager::hasValidEmptyScan()
|
||||
@@ -209,7 +257,7 @@ void DeviceManager::startScan(const QString& json, bool empty)
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::processScanProcess(const QString& aProgress)
|
||||
void DeviceManager::processScanProgress(const QString& aProgress)
|
||||
{
|
||||
if(mIsScanning == false)
|
||||
{
|
||||
@@ -274,6 +322,8 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
||||
insertScanRecord();
|
||||
}
|
||||
|
||||
startTransfer();
|
||||
|
||||
if(isCompleteNotify)
|
||||
{
|
||||
QString msg = QString("Scan completed!");
|
||||
@@ -283,8 +333,16 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
||||
{
|
||||
TRIGGER_EVENT(InvokeOperationEnd, nullptr, var);
|
||||
}
|
||||
}
|
||||
|
||||
startTransfer();
|
||||
void DeviceManager::prepareFinishInitialize()
|
||||
{
|
||||
mIsInitializing = false;
|
||||
if(mScanProgressTimer != -1)
|
||||
{
|
||||
killTimer(mScanProgressTimer);
|
||||
mScanProgressTimer = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::stopFullScan()
|
||||
@@ -449,15 +507,28 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
break;
|
||||
case ACT_SCAN_PROGRESS_PASSIVE :
|
||||
emit responseGetScanProgress(aContents);
|
||||
processScanProcess(aContents);
|
||||
break;
|
||||
if(mIsInitializing)
|
||||
{
|
||||
processInitializeProgress(aContents);
|
||||
}
|
||||
else
|
||||
{
|
||||
processScanProgress(aContents);
|
||||
}
|
||||
break;
|
||||
case ACT_SCAN_PRESIG:
|
||||
processPreviewData(aContents);
|
||||
break;
|
||||
case ACT_SCAN_STOP :
|
||||
emit responseStopScan(aContents);
|
||||
break;
|
||||
default:
|
||||
case ACT_SCAN_CE :
|
||||
emit responseCEScan(aContents);
|
||||
break;
|
||||
case ACT_SCAN_CE_STATUS :
|
||||
emit responseGetCEStatus(aContents);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -494,6 +565,14 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_CONTROL:
|
||||
switch(aActionID)
|
||||
{
|
||||
case ACT_CTL_PUMP:
|
||||
emit responsePumpControl(aContents);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -582,6 +661,26 @@ bool DeviceManager::startFullScan(const QString& aPatientInfo)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceManager::startCEScan()
|
||||
{
|
||||
DmsSyncActionResult result = mCEScanAction->execute();
|
||||
if(!result.mIsSucessful)
|
||||
{
|
||||
QString message = QString("Dms connection error. Reason:%1").arg(result.mData);
|
||||
THROW_ERROR(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||
if(jsonObj.contains("code") && jsonObj["code"].toInt() != 0)
|
||||
{
|
||||
QString msg = jsonObj["info"].toString();
|
||||
THROW_ERROR(msg);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeviceManager::getDeviceTemperature()
|
||||
{
|
||||
mGetDeviceTemperatureAction->execute();
|
||||
@@ -896,3 +995,19 @@ int DeviceManager::getTransferProgress()
|
||||
return mTransferProgress;
|
||||
}
|
||||
|
||||
bool DeviceManager::getCEStatus()
|
||||
{
|
||||
auto result = mGetCEStatusAction->execute();
|
||||
if(result.mIsSucessful)
|
||||
{
|
||||
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||
if(jsonObj["code"].toInt() == 0 )
|
||||
{
|
||||
if(jsonObj["info"].toString().toInt() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -101,11 +101,15 @@ private:
|
||||
void stopPreviewScan();
|
||||
void getDeviceTemperature();
|
||||
void getScanProcess();
|
||||
bool getCEStatus();
|
||||
bool startCEScan();
|
||||
void startTransfer();
|
||||
void initEmptyScanMeasurementID();
|
||||
|
||||
void processScanProcess(const QString& aProgress);
|
||||
void processScanProgress(const QString& aProgress);
|
||||
void processInitializeProgress(const QString& aProgress);
|
||||
void prepareFinishScan(bool isNormalFinish, const QString& aReason = "");
|
||||
void prepareFinishInitialize();
|
||||
void processAlarm(const QString& aAlarm);
|
||||
void processPreviewData(const QString& aPreviewData);
|
||||
void processGetSoftwareVersion(const QString& aSoftwareVersion);
|
||||
@@ -119,6 +123,7 @@ private:
|
||||
private slots:
|
||||
//DMS
|
||||
void processReceiveDMSInfoResult(int aServerID, int aActionID, const QString& aContents);
|
||||
|
||||
//Recon
|
||||
void processReconCreateEmptyScan(bool aResult, const QString& aScanID, const QString& aMessage);
|
||||
void processReconCreateScan(bool aResult, const QString& aScanID, const QString& aMessage);
|
||||
@@ -131,12 +136,15 @@ signals:
|
||||
void responseGetDeviceStatus(const QString& aDeviceStatus);
|
||||
void responseGetDeviceTemperature(const QString& aDeviceTemperature);
|
||||
void responseFullScan(const QString& aResponse);
|
||||
void responseCEScan(const QString& aResponse);
|
||||
void responseGetScanProgress(const QString& aProgrese);
|
||||
void responseStopScan(const QString& aResponse);
|
||||
void responsePreviewScan(const QString& aResponse);
|
||||
void responseGetSoftwareVersion(const QString& aSoftwareVersion);
|
||||
void responseTransfer(const QString& aResponse);
|
||||
void responseGetTransferProgress(const QString& aProgress);
|
||||
void responseGetCEStatus(const QString& aProgress);
|
||||
void responsePumpControl(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);
|
||||
@@ -144,6 +152,7 @@ signals:
|
||||
void updateReconStateFinished();
|
||||
//GUI
|
||||
void initializeFinished();
|
||||
void initializeProgress(const QString& aProgress);
|
||||
void transferStatusUpdated();
|
||||
|
||||
|
||||
@@ -156,6 +165,7 @@ private:
|
||||
bool mIsScanning = false;
|
||||
bool mIsTransfering = false;
|
||||
bool mIsPreviewing = false;
|
||||
bool mIsInitializing = false;
|
||||
|
||||
QString mCurrentScanMeasurementID = "";
|
||||
QString mCurrentEmptyMeasurementID = "";
|
||||
@@ -176,6 +186,8 @@ private:
|
||||
DmsSyncAction* mStopScanAction = nullptr;
|
||||
DmsSyncAction* mTransferAction = nullptr;
|
||||
DmsSyncAction* mGetTransferProgressAction = nullptr;
|
||||
DmsSyncAction* mGetCEStatusAction = nullptr;
|
||||
DmsSyncAction* mPumpControlAction = nullptr;
|
||||
|
||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user