Update to dms control phase1.
This commit is contained in:
@@ -7,9 +7,15 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include "DeviceDefs.h"
|
||||
|
||||
class DeviceManager : public QObject {
|
||||
Q_OBJECT
|
||||
class DmsSyncAction;
|
||||
class DmsAsyncAction;
|
||||
|
||||
class DeviceManager : public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static DeviceManager *Default() {
|
||||
@@ -19,7 +25,16 @@ public:
|
||||
|
||||
DeviceManager() = default;
|
||||
|
||||
~DeviceManager() override = default;
|
||||
~DeviceManager() override
|
||||
{
|
||||
// mCmdSendThread->quit();
|
||||
// mCmdSendThread->wait();
|
||||
// mCmdSendThread->deleteLater();
|
||||
|
||||
mDmsInfoReceiveThread->quit();
|
||||
mDmsInfoReceiveThread->wait();
|
||||
mDmsInfoReceiveThread->deleteLater();
|
||||
}
|
||||
|
||||
DeviceManager(const DeviceManager &) = delete;
|
||||
|
||||
@@ -41,24 +56,19 @@ public:
|
||||
* Get Firm ware version
|
||||
* @return Firm ware version
|
||||
*/
|
||||
static QString getSoftwareVersion();
|
||||
QString getSoftwareVersion();
|
||||
|
||||
/**
|
||||
* Get Scan data output path
|
||||
* @return Scan data output path
|
||||
*/
|
||||
static QString getScanOutputPath();
|
||||
// void setErrorOccurred(bool v) {
|
||||
// mErrorOccurred = v;
|
||||
// }
|
||||
|
||||
void setErrorOccurred(bool v) {
|
||||
mErrorOccurred = v;
|
||||
}
|
||||
|
||||
bool getErrorOccurred() {
|
||||
return mErrorOccurred;
|
||||
}
|
||||
// bool getErrorOccurred() {
|
||||
// return mErrorOccurred;
|
||||
// }
|
||||
|
||||
void emitErrorCallback(const char *msg);
|
||||
void emitInfoCallback(const char* aMessage,const unsigned int aInfoType);
|
||||
void emitInfoCallback(const QString& aMessage,const unsigned int aInfoType);
|
||||
bool hasValidEmptyScan();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -74,50 +84,90 @@ private:
|
||||
* @param json The patient information json string
|
||||
* @param empty Empty scan flag
|
||||
*/
|
||||
void startScan(const char *json, bool empty = false);
|
||||
|
||||
/**
|
||||
* Post Scan start command to Shimlib
|
||||
*/
|
||||
void postScanCommand();
|
||||
|
||||
/**
|
||||
* Post Continue Scan command to Shimlib
|
||||
* @param useTimer start a new timer flag
|
||||
*/
|
||||
void postContinueCommand(bool useTimer = false);
|
||||
|
||||
/**
|
||||
* Prepare for finishing the Scan
|
||||
*/
|
||||
void prepareFinishScan();
|
||||
|
||||
/**
|
||||
* exit the current Scan process timer
|
||||
*/
|
||||
void exitScanTimer();
|
||||
|
||||
/**
|
||||
* Process scan progress change
|
||||
* @param Scan progress
|
||||
*/
|
||||
void scanProcess(int aProgress);
|
||||
|
||||
void initPreviewThread();
|
||||
|
||||
void stopScan();
|
||||
|
||||
void startScan(const QString& json, bool empty = false);
|
||||
void startPreview();
|
||||
void shutdown();
|
||||
void createScanReconRecord(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID);
|
||||
|
||||
int mScanPhase = 1;
|
||||
volatile int mTimerID = -1;
|
||||
int mDeviceInfTimerID = -1;
|
||||
int mLastStatus = -1;
|
||||
bool mPreviewing = false;
|
||||
volatile bool mEndLoop = false;
|
||||
volatile bool mErrorOccurred = false;
|
||||
QThread *mPreviewDataCaller = nullptr;
|
||||
//-----------------new
|
||||
DeviceStatus getDeviceStatus();
|
||||
bool startFullScan(const QString& aPatientInfo);
|
||||
void stopFullScan();
|
||||
void stopPreviewScan();
|
||||
void getDeviceTemperature();
|
||||
void getScanProcess();
|
||||
void startTransfer();
|
||||
void initEmptyScanMeasurementID();
|
||||
void updateReconState();
|
||||
|
||||
void processScanProcess(const QString& aProgress);
|
||||
void prepareFinishScan(bool isNormalFinish, const QString& aReason = "");
|
||||
void processAlarm(const QString& aAlarm);
|
||||
void processPreviewData(const QString& aPreviewData);
|
||||
void processGetSoftwareVersion(const QString& aSoftwareVersion);
|
||||
void processDeviceTemperature(const QString& aResponseTemperature);
|
||||
void processTransferProgress(const QString& aProgress);
|
||||
|
||||
void insertEmptyScanRecord();
|
||||
void insertScanRecord();
|
||||
|
||||
|
||||
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);
|
||||
void processReconQueryScanState(const QMap<QString, int> aResult);
|
||||
//GUI
|
||||
void scanTimeout();
|
||||
|
||||
signals:
|
||||
//DMS
|
||||
void responseGetDeviceStatus(const QString& aDeviceStatus);
|
||||
void responseGetDeviceTemperature(const QString& aDeviceTemperature);
|
||||
void responseFullScan(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);
|
||||
//Recon
|
||||
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
||||
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
||||
void queryScanStatusToRecon(const QStringList& aScanIDs);
|
||||
|
||||
|
||||
private:
|
||||
int mTemperatureTimer = -1;
|
||||
int mScanProgressTimer = -1;
|
||||
bool mIsEmptyScan = false;
|
||||
bool mIsTransferEmptyScan = false;
|
||||
bool mIsScanning = false;
|
||||
bool mIsTransfering = false;
|
||||
bool mIsPreviewing = false;
|
||||
|
||||
QString mCurrentScanMeasurementID = "";
|
||||
QString mCurrentEmptyMeasurementID = "";
|
||||
QString mCurrentPatientName = "";
|
||||
QString mCurrentPatientID = "";
|
||||
QString mCurrentLaterality = "";
|
||||
QString mCurrentOperatorName = "";
|
||||
QString mCurrentTransferMeasurementID = "";
|
||||
QString mCurrentTransferPatientID = "";
|
||||
QString mSoftwareVersion = "";
|
||||
QThread* mDmsInfoReceiveThread = nullptr;
|
||||
QThread* mReconHttpThread = nullptr;
|
||||
DmsSyncAction* mGetDeviceStatusAction = nullptr;
|
||||
DmsSyncAction* mFullScanAction = nullptr;
|
||||
DmsSyncAction* mPreviewScanAction = nullptr;
|
||||
DmsSyncAction* mCEScanAction = nullptr;
|
||||
DmsSyncAction* mStopScanAction = nullptr;
|
||||
DmsSyncAction* mTransferAction = nullptr;
|
||||
|
||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||
DmsAsyncAction* mGetSoftwareVersionAction = nullptr;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user