From 1ccd2e95e485de3f904af7f048b615f824adcc39 Mon Sep 17 00:00:00 2001 From: sunwen Date: Thu, 7 Sep 2023 16:04:17 +0800 Subject: [PATCH] Add stop transfer automatically. --- src/device/DeviceManager.cpp | 5 +++++ src/device/DeviceManager.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/device/DeviceManager.cpp b/src/device/DeviceManager.cpp index 5bfe6a5..26f2776 100644 --- a/src/device/DeviceManager.cpp +++ b/src/device/DeviceManager.cpp @@ -125,6 +125,7 @@ void DeviceManager::initDevice() 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); mGetDeviceTemperatureAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_TEMP, this, "responseGetDeviceTemperature(const QString&)", this); + mStopTransferAction = new DmsAsyncAction(USRV_XFR, ACT_XFR_STOP, this, "responseStopTransfer(const QString&)", this); connect(mGetScanProgressAction, &DmsAsyncAction::timeout, this, &DeviceManager::scanTimeout); @@ -565,6 +566,9 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co case ACT_XFR_START : emit responseTransfer(aContents); break; + case ACT_XFR_STOP : + emit responseStopTransfer(aContents); + break; case ACT_XFR_PROGRESS_PASSIVE : emit responseGetTransferProgress(aContents); break; @@ -802,6 +806,7 @@ void DeviceManager::startTransfer() int code = jsonObj["code"].toInt(); if(code != 0) { + mStopTransferAction->execute(); QString msg = jsonObj["info"].toString(); THROW_ERROR(msg); return; diff --git a/src/device/DeviceManager.h b/src/device/DeviceManager.h index c2ba3a7..3066923 100644 --- a/src/device/DeviceManager.h +++ b/src/device/DeviceManager.h @@ -149,6 +149,7 @@ signals: void responsePumpControl(const QString& aResponse); void responseSetSimulatorMode(const QString& aResponse); void responseSetHeartBeat(const QString& aResponese); + void responseStopTransfer(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); @@ -200,6 +201,7 @@ private: DmsAsyncAction* mGetDeviceTemperatureAction = nullptr; DmsAsyncAction* mGetScanProgressAction = nullptr; DmsAsyncAction* mGetSoftwareVersionAction = nullptr; + DmsAsyncAction* mStopTransferAction = nullptr; };