Stop the running command after disconnected

This commit is contained in:
wh201906
2020-08-11 11:51:27 +08:00
parent a3e6aa787b
commit a7985c5c89
3 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -23,11 +23,14 @@ void Util::processOutput(QString output)
void Util::execCMD(QString cmd)
{
qDebug() << cmd;
emit write(cmd + "\r\n");
if(isRunning)
emit write(cmd + "\r\n");
}
QString Util::execCMDWithOutput(QString cmd, unsigned long waitTime)
{
if(!isRunning)
return "";
QTime currTime = QTime::currentTime();
QTime targetTime = QTime::currentTime().addMSecs(waitTime);
isRequiringOutput = true;
@@ -61,3 +64,8 @@ void Util::setClientType(Util::ClientType clientType)
{
this->clientType = clientType;
}
void Util::setRunningState(bool st)
{
this->isRunning = st;
}
+2
View File
@@ -31,9 +31,11 @@ public:
public slots:
void processOutput(QString output);
void setClientType(Util::ClientType clientType);
void setRunningState(bool st);
private:
bool isRequiringOutput;
bool isRunning;
QString* requiredOutput;
QTime timeStamp;
ClientType clientType;