Optimal parsing
This commit is contained in:
parent
ed810d23e6
commit
c2ed9f3ba3
@ -58,7 +58,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
sdBytes = 0;
|
||||
userCommand = "";
|
||||
currentLine = 0;
|
||||
readyRecieve = 0;
|
||||
readyRecieve = 1;
|
||||
lastRecieved = 0;
|
||||
|
||||
serialupdate();
|
||||
@ -555,6 +555,8 @@ void MainWindow::readSerial()
|
||||
}
|
||||
*/
|
||||
emit recievedData(data);
|
||||
if(data.startsWith("ok")) readyRecieve++;
|
||||
else if(data.startsWith("wa")) readyRecieve=1;
|
||||
printMsg(QString(data)); //echo
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@ void Parser::parse(QByteArray data)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(data.startsWith("ok"))
|
||||
{
|
||||
QStringList tmp = QString(data).split(' ');
|
||||
@ -63,6 +64,7 @@ void Parser::parse(QByteArray data)
|
||||
emit recievedOkNum(tmp.at(1).toInt());
|
||||
else emit recievedOkNum(0);
|
||||
}
|
||||
*/
|
||||
else if(data.startsWith("T:"))
|
||||
{
|
||||
TemperatureReadings r;
|
||||
@ -76,7 +78,7 @@ void Parser::parse(QByteArray data)
|
||||
|
||||
emit recievedTemperature(r);
|
||||
}
|
||||
else if(data.startsWith("wait")) emit recievedOkWait();
|
||||
//else if(data.startsWith("wait")) emit recievedOkWait();
|
||||
else if(data.startsWith("rs") || data.startsWith("Resend"))
|
||||
emit recievedResend(data.split(' ').at(0).toInt());
|
||||
else if(data.startsWith("!!")) emit recievedError();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user