Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtSerialPort -> Terminal Example -> Only reads 8-bytes at a time
Forum Updated to NodeBB v4.3 + New Features

QtSerialPort -> Terminal Example -> Only reads 8-bytes at a time

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vito3223
    wrote on last edited by
    #1

    Hello,

    I am very new to C++ and Qt framework and I have two questions. I have been programming under CentOS using Qt 4 framework.

    1. 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.

    1. I would like some input from experienced programmers on whether or not longterm its worth to switch to Qt5 from Qt4?

    Thanks!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by
      #2

      Hi.

      1. 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.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vito3223
        wrote on last edited by
        #3

        Hi kuzulis,

        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.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vito3223
          wrote on last edited by
          #4

          Hi kuzulis,

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved