Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QtSerialPort -> Terminal Example -> Only reads 8-bytes at a time
I am very new to C++ and Qt framework and I have two questions. I have been programming under CentOS using Qt 4 framework.
- When using the "Terminal Example":http://doc-snapshot.qt-project.org/qt5-stable/qtserialport/terminal.html I have noticed that it seems to only be reading in a maximum 8 bytes of data at a time. _Is there a way I can increase this? _ I have checked the "QSerialPort Class":http://doc-snapshot.qt-project.org/qt5-stable/qtserialport/qserialport.html#setReadBufferSize and the only item that seems to stand out is:
qint64 QSerialPort::readBufferSize() const
Which seems to be set to the default value of 0, meaning no size limit.
- I would like some input from experienced programmers on whether or not longterm its worth to switch to Qt5 from Qt4?
- The class reads automatically all available data when triggered Rx event, which are at present in the FIFO buffer of the driver and caches them at itself inside in RingBuffer. Value of 8 bytes not the constant. It depends on the driver of port, the current speed, CPU loading, etc. Simply, between two read() operations in driver FIFO is accumulated in time ~8-10 byte.
It shan't disturb you.
Thank you for your reply. The reason I was asking is because I was using this example to receive packets that could vary in the number of bytes. I ended up receiving a maximum of 8 bytes while the packet could be 16 bytes or more. My approach now will be to reconstruct the packets based on the packet framing.
The issue doesn't occure when using "QextSerialPort":http://code.google.com/p/qextserialport/ to access the same serial port on the same platform.
Would you have any feedback on why this difference exists? It seems like a difference in implementation rather than a FIFO limit on the serial port.