feat: Add error message when emergency button pushed.
This commit is contained in:
@@ -146,6 +146,7 @@ void DeviceManager::initDevice()
|
||||
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);
|
||||
mGetSoftwareVersionAction->setTimeoutInterval(GETDMSVERSION_TIMEOUT);
|
||||
mEmergencyResetAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_EMG_RESET, this,"responseEmergencyButtonReset(const QString&)", this);
|
||||
connect(mGetSoftwareVersionAction, &DmsAsyncAction::timeout, [this]()
|
||||
{
|
||||
emit getDmsVersionResponsed("DMS Version Fetch Error");
|
||||
@@ -764,6 +765,9 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
emit responseGetAutoLocatePosition(aContents);
|
||||
processAutoLocatePosition(aContents);
|
||||
break;
|
||||
case ACT_CTL_EMG_RESET:
|
||||
processEmergencyButtonReset(aContents);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -779,6 +783,19 @@ void DeviceManager::processAlarm(const QString& aAlarm)
|
||||
qDebug()<<"processAlarm : "<<alarmCode;
|
||||
if(alarmCode >= 400 && alarmCode < 500)
|
||||
{
|
||||
switch (alarmCode)
|
||||
{
|
||||
case 492://left emergency button pushed
|
||||
prepareFinishScan(false,"");
|
||||
emit emergencyButtonPushed(true, false);
|
||||
return;
|
||||
case 494://right emergency button pushed
|
||||
prepareFinishScan(false,"");
|
||||
emit emergencyButtonPushed(false, false);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(mIsScanning)
|
||||
{
|
||||
prepareFinishScan(false, alarm);
|
||||
@@ -912,7 +929,7 @@ void DeviceManager::getScanProcess()
|
||||
|
||||
void DeviceManager::shutdownDms()
|
||||
{
|
||||
if(mIsTransfering)
|
||||
if(mIsTransfering)
|
||||
{
|
||||
QString msg = tr("Data is currently being transmitted, please shut down later.");
|
||||
THROW_ERROR(msg);
|
||||
@@ -1438,3 +1455,31 @@ void DeviceManager::prepareCheckReconConnection()
|
||||
}
|
||||
emit checkReconConnection();
|
||||
}
|
||||
|
||||
void DeviceManager::processEmergencyButtonReset(const QString& aResponse)
|
||||
{
|
||||
QJsonObject jsonObj = toJsonObject(aResponse);
|
||||
int code = jsonObj["code"].toInt();
|
||||
if(code == -1)
|
||||
{
|
||||
QString errorMessage = tr("Device reset failed, please contact maintenance person");
|
||||
THROW_ERROR(errorMessage);
|
||||
}
|
||||
|
||||
if(jsonObj["info"].toString() == "left" )
|
||||
{
|
||||
emit emergencyButtonPushed(true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(jsonObj["info"].toString() == "right" )
|
||||
{
|
||||
emit emergencyButtonPushed(false, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::prepareEmergencyReset()
|
||||
{
|
||||
mEmergencyResetAction->execute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user