[Interest] Parsing data from serialport
Martin Marmsoler
martin.marmsoler at gmail.com
Tue Apr 2 21:57:45 CEST 2019
> To be able to roll back, in case your reading from the device didn't
result in
what you wanted or you got an error. See QDataStream.
Ah ok I understand.
So this minimal example
QSerialPort sPort;
sPort.open(QIODevice::ReadOnly);
if(sPort.waitForReadyRead(2000)){
while (!device.atEnd()) {
if (device.canReadLine()) {
newData.push_back(device.readLine());
linesToRead++;
} else {
return;
}
}
...
}
works fine, if I go trough it step by step (maybe, because enouth data
come in). But if I'm to fast it does not work.
If I'm using the signal readyRead I will have the same problem,
because new data come everytime. So I check that in the
readyRead function if a complete line come in, and if no complete line
I return without doing something otherwise I do
something with the data? Is this the right way?
Martin
Thiago Macieira <thiago.macieira at intel.com> schrieb am Di., 2. Apr. 2019,
18:02:
> On Tuesday, 2 April 2019 07:04:03 PDT Martin Marmsoler wrote:
> > Thank you Thiago for your response. But what is transactionstart for?
>
> To be able to roll back, in case your reading from the device didn't
> result in
> what you wanted or you got an error. See QDataStream.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel System Software Products
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190402/30ed01b0/attachment.html>
More information about the Interest
mailing list