On Thu, Apr 4, 2019 at 6:42 PM Jérôme Godbout <godbo...@amotus.ca> wrote:
> You jus did the same loop into your slot, the function I did made can be > called as slot to the connect you just told, I agree the > serial_port->waitForReadyRead(5); is not necessary, just often the > transmission have partial or bunch of data by small burst (USB VCOM) and > was handy for me, but it is not ncessary in any way. > A similar loop yes, however your loop goes until there's something to read on the port, mine is run a few times only when the port already has some information pending in its buffer. The QSerialPort class already knows if data has arrived and buffers it*, so what would be the point to loop over the port when there's no data? When you talk with someone do you ask every 5ms if [s]he has something to say to you? I really doubt it. You'd normally just wait for something to be said to decide if and how to respond to it. > Side note: ReadLines made it less general purpose, you will need a > protocol that use endline to signal end of message which is not always the > case. > Involving realistic protocol handling is another kettle of fish. It would require much more thought and effort and is beyond the scope of what was asked initially. * Unless it's in unbuffered mode, as Thiago already noted. >
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest