QSerialPort: add write buffer size limit
Serial Port is slow, so it is possible that with a high data rate the
write buffer will grow faster than the data will actually be sent.
By default the buffer is unlimited, which can cause the application to
run out of memory.
This commit adds the possibility to limit the size of the write buffer.
If the buffer is close to its maximum capacity, the attempt to write
more data will return the amount of bytes that could actually be added
to the buffer (can even be 0, if the buffer was full), indicating that
the user has to repeat the attempt to write the rest of the data after
the bytesWritten() signal is received or the waitForBytesWritten()
function returned true.
[ChangeLog][QSerialPort] Added writeBufferSize()/setWriteBufferSize()
to limit the size of the write buffer.
Task-number: QTBUG-135905
Change-Id: If2d70116633d5c46985ddf5678ffc06f5ed4a4ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>