Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Feature request - QtSerialPort waitForReadyRead
Forum Updated to NodeBB v4.3 + New Features

Feature request - QtSerialPort waitForReadyRead

Scheduled Pinned Locked Moved 3rd Party Software
5 Posts 3 Posters 2.3k 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.
  • J Offline
    J Offline
    jlind74
    wrote on last edited by
    #1

    Hello!

    I got a feature request for a second parameter for the waitForReadyRead() function.

    Today the only parameter is the time-out. My suggestion would be to add a second parameter that takes the number of chars to wait for, setting that parameter to ‘1’ would give the same behaviour that it has right now. This would be similar to the read command in Posix.

    Kind regards
    /Johan

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

      I do not think it's appropriate. The methods like WaitForXXX derived from QIODevice.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leon.anavi
        wrote on last edited by
        #3

        I am afraid that this is not the best place for reporting bugs and propose features. Please follow the instruction for the "QtSerialPort wiki page":http://qt-project.org/wiki/QtSerialPort and submit your proposition to "JIRA":https://bugreports.qt-project.org:

        bq. Use "bugreports.qt-project.org":https://bugreports.qt-project.org, Project “Qt Playground Projects”, Component “qtserialport”.

        http://anavi.org/

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jlind74
          wrote on last edited by
          #4

          Thanks for the info, both of you.
          Sorry for posting in the wrong place.
          (did not realize that this bug-tracker was also for these add-ons)

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

            UPD:

            You can implement it yourself, like:

            @static int timeout(int msecs, int elapsed)
            {
            if (msecs == -1)
            return msecs;
            msecs -= elapsed;
            return qMax(msecs, 0);
            }

            bool MyCoolPort::waitForReadyRead(int msecs, int count)
            {
            QElapsedTimer stopWatch;
            stopWatch.start();

            do {
                waitForReadyRead(timeout(msecs, stopWatch.elapsed()));
                if (bytesAvailable() >= count)
                    return true;
            } while (msecs == -1 || timeout(msecs, stopWatch.elapsed()) > 0);
            return false;
            

            }@

            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