[Development] [QIODevice]How to correctly treat/understand of the documentation?

Thiago Macieira thiago.macieira at intel.com
Mon Apr 28 18:20:02 CEST 2014


Em seg 28 abr 2014, às 11:16:27, Oswald Buddenhagen escreveu:
> On Sun, Apr 27, 2014 at 01:34:52PM -0700, Thiago Macieira wrote:
> 
> yeah, but serial ports can be operated without flow control. if the
> kernel does not buffer indefinitely (which seems plausible, as otherwise
> one could DoS it), data could be discarded indeed.

Right. But it's the application's responsibility to read everything in a 
timely manner, regardless of whether buffering is enabled or not. If it's not 
enabled, there could be data loss or blockage of the other side due to flow 
control. If it is enabled, you need to read to avoid blowing up the buffers.

> > By the way, what is that tx-empty event? Note that sockets and pipes don't
> > have that, so please don't make QSerialPort use that by default. You can
> > add an extra signal to QSerialPort to indicate this, but bytesWritten()
> > must mean the same as QTcpSocket and QProcess.
> 
> a separate signal would be redundant, as checking byteToWrite() == 0 in
> the slot called from bytesWritten() is sufficient.

I don't think that's what Denis wanted. He wants to know when the kernel buffer 
is empty, not just Qt's. That is, when the data was sent over the serial line, 
without verification that the other side actually received it (with a long 
cable, it could take several microseconds or even milliseconds for the other 
side to receive).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list