feat: Add some error code.
This commit is contained in:
@@ -146,25 +146,25 @@ void DeviceManager::initDevice()
|
||||
mDrainageControlAction->setTimeoutInterval(WATERPROCESS_TIMEOUT);
|
||||
connect(mDrainageControlAction, &DmsAsyncAction::timeout, [this]()
|
||||
{
|
||||
this->processDrainageResult("{\"code\":-1}");
|
||||
this->processDrainageResult("{\"code\":-1,\"info\":\"454\"}");
|
||||
});
|
||||
mWaterfloodAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_WINJECT, this, "responseWaterflood(const QString&)", this);
|
||||
mWaterfloodAction->setTimeoutInterval(WATERPROCESS_TIMEOUT);
|
||||
connect(mWaterfloodAction, &DmsAsyncAction::timeout, [this]()
|
||||
{
|
||||
this->processWaterfloodResult("{\"code\":-1}");
|
||||
this->processWaterfloodResult("{\"code\":-1,\"info\":\"454\"}");
|
||||
});
|
||||
mWaterCleanAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_WCLEAN, this, "responseWaterclean(const QString&)", this);
|
||||
mWaterCleanAction->setTimeoutInterval(WATERPROCESS_TIMEOUT);
|
||||
connect(mWaterCleanAction, &DmsAsyncAction::timeout, [this]()
|
||||
{
|
||||
this->processWaterCleanResult("{\"code\":-1}");
|
||||
this->processWaterCleanResult("{\"code\":-1,\"info\":\"454\"}");
|
||||
});
|
||||
mWaterProcessExitAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_WEXIT, this, "responseWaterProcessExit(const QString&)", this);
|
||||
mWaterProcessExitAction->setTimeoutInterval(WATERPROCESS_TIMEOUT);
|
||||
connect(mWaterProcessExitAction, &DmsAsyncAction::timeout, [this]()
|
||||
{
|
||||
this->processWaterProcessExitResult("{\"code\":-1}");
|
||||
this->processWaterProcessExitResult("{\"code\":-1,\"info\":\"454\"}");
|
||||
});
|
||||
mGetAutoLocatePositionAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_MOTION_POSITION, this, "responseGetAutoLocatePosition(const QString&)", this);
|
||||
mGetSoftwareVersionAction = new DmsAsyncAction(USRV_INFOCFG, ACT_IFCFG_VERINFO, this,"responseGetSoftwareVersion(const QString&)", this);
|
||||
@@ -238,11 +238,11 @@ void DeviceManager::initDevice()
|
||||
mCheckInitStatusTimer = startTimer(500);
|
||||
}
|
||||
|
||||
void DeviceManager::initGUI(bool aIsInitSucceed)
|
||||
void DeviceManager::initGUI(bool aIsInitSucceed, int aCode)
|
||||
{
|
||||
if(!AppGlobalValues::DBconnected().toBool())
|
||||
{
|
||||
emitErrorCallback(tr("Fail to connect to DB!Reboot device to try!"));
|
||||
emitErrorCallback(tr("Fail to connect to DB!Reboot device to try!") + tr("\nError: ") + QString::number(455));
|
||||
emit initializeFinished();
|
||||
return;
|
||||
}
|
||||
@@ -275,7 +275,7 @@ void DeviceManager::initGUI(bool aIsInitSucceed)
|
||||
else
|
||||
{
|
||||
UsctStateManager::getInstance()->setState(DmsState, false);
|
||||
QString msg = tr("Initialize Failed.");
|
||||
QString msg = tr("Initialize Failed.") + tr("\nError: ") + QString::number(aCode);
|
||||
THROW_ERROR(msg);
|
||||
emit initializeProgress("33");
|
||||
QThread::msleep(500);
|
||||
@@ -605,7 +605,7 @@ void DeviceManager::checkInitStatus()
|
||||
killTimer(mCheckInitStatusTimer);
|
||||
mCheckInitStatusTimer = -1;
|
||||
}
|
||||
initGUI(false);
|
||||
initGUI(false, 454);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ void DeviceManager::checkInitStatus()
|
||||
killTimer(mCheckInitStatusTimer);
|
||||
mCheckInitStatusTimer = -1;
|
||||
}
|
||||
initGUI(true);
|
||||
initGUI(true, 0);
|
||||
}
|
||||
else if(jsonObj["code"].toInt() == 2)
|
||||
{
|
||||
@@ -626,7 +626,7 @@ void DeviceManager::checkInitStatus()
|
||||
killTimer(mCheckInitStatusTimer);
|
||||
mCheckInitStatusTimer = -1;
|
||||
}
|
||||
initGUI(false);
|
||||
initGUI(false, jsonObj["info"].toInt());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ void DeviceManager::processDrainageResult(const QString& aResponse)
|
||||
}
|
||||
|
||||
emit startDrainageControlResult(false);
|
||||
QString msg = tr("Open drain vavle failed.");
|
||||
QString msg = tr("Open drain vavle failed.") + tr("\nError: ") + jsonObj["info"].toString();
|
||||
THROW_ERROR(msg);
|
||||
}
|
||||
|
||||
@@ -1241,7 +1241,7 @@ void DeviceManager::processWaterfloodResult(const QString &aResponse)
|
||||
}
|
||||
|
||||
emit startWaterfloodResult(false);
|
||||
QString msg = tr("Water injection failed.");
|
||||
QString msg = tr("Water injection failed.")+ tr("\nError: ") + jsonObj["info"].toString();;
|
||||
THROW_ERROR(msg);
|
||||
}
|
||||
|
||||
@@ -1265,7 +1265,7 @@ void DeviceManager::processWaterCleanResult(const QString &aResponse)
|
||||
}
|
||||
|
||||
emit startWaterCleanResult(false);
|
||||
QString msg = tr("Cleaning startup failed.");
|
||||
QString msg = tr("Cleaning startup failed.") + tr("\nError: ") + jsonObj["info"].toString();
|
||||
THROW_ERROR(msg);
|
||||
}
|
||||
|
||||
@@ -1294,10 +1294,10 @@ void DeviceManager::processWaterProcessFinishedResult(const QString &aResponse)
|
||||
QJsonObject jsonObj = toJsonObject(aResponse);
|
||||
if(jsonObj["code"].toInt() == 0 )
|
||||
{
|
||||
emit waterProcessFinishedResult(true);
|
||||
emit waterProcessFinishedResult(true, jsonObj["info"].toString());
|
||||
return;
|
||||
}
|
||||
emit waterProcessFinishedResult(false);
|
||||
emit waterProcessFinishedResult(false, jsonObj["info"].toString());
|
||||
}
|
||||
|
||||
void DeviceManager::updateReconConnectionState(bool aIsConnected)
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
void checkInitStatus();
|
||||
bool startAutoLocate();
|
||||
void stopAutoLocate();
|
||||
void initGUI(bool aIsInitSucceed);
|
||||
void initGUI(bool aIsInitSucceed, int aCode);
|
||||
void checkDataQuality();
|
||||
|
||||
void processScanProgress(const QString& aProgress);
|
||||
@@ -189,7 +189,7 @@ signals:
|
||||
void startWaterfloodResult(bool aIsSucessful);
|
||||
void startWaterCleanResult(bool aIsSucessful);
|
||||
void exitWaterProcessResult(bool aIsSucessful);
|
||||
void waterProcessFinishedResult(bool aIsSucessful);
|
||||
void waterProcessFinishedResult(bool aIsSucessful, const QString& aInfoCode);
|
||||
void startAutoLocateResult(bool aIsSucessful);
|
||||
void updateAutoLocatePosition(int aX, int aY, int aZ);
|
||||
void autolocatePositionEffective();
|
||||
|
||||
Reference in New Issue
Block a user