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, readyRead emitted multiple times
Qt 6.11 is out! See what's new in the release blog

QtSerialPort, readyRead emitted multiple times

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 436 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.
  • G Offline
    G Offline
    Gaetano03
    wrote on last edited by
    #1

    Hello,

    I have been reading people dealing with this issue, but still trying to get my head around it.

    I am running the Qt example for reader async (no more than that, except for that I am not stopping it once the read is done as this is what I want in my final app). Despite I expect one message to be read from serial port, I get the same message printed out multiple times.

    How can you deal with the problem of emitting readyread more than once?

    THanks in advance for your help

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Are you sure the sender doesn't send data continuously?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gaetano03
        wrote on last edited by
        #3

        I am using Hercules to double check, and on it I am just receiving a single message as I would expect

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          Have a look at void ChatClient::onReadyRead() of this wiki page. It uses QTcpSocket but the explanation is valid for QSerialPort too

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0
          • Kent-DorfmanK Offline
            Kent-DorfmanK Offline
            Kent-Dorfman
            wrote on last edited by
            #5

            readyread can trigger on any number of received characters, including (especially) an incomplete message. you are reading a stream. Just because you send a discrete message doesnt mean its received and parsed as a discrete message.

            The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

            1 Reply Last reply
            3

            • Login

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