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. QSerialPort how set read and other timeouts
Forum Updated to NodeBB v4.3 + New Features

QSerialPort how set read and other timeouts

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 3.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.
  • C Offline
    C Offline
    Corban_Dallas
    wrote on last edited by
    #1

    Hello everyone.

    Is it possible to set timeouts for QSerialPort like ReadIntervalTimeout, ReadTotalTimeoutConstant or ReadTotalTimeoutMultiplier?

    1 Reply Last reply
    1
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome
      Both yes and no.
      There are 2 ways to use QSerialPort
      Synchronous and asynchronous ( block / non block)
      For Synchronous operation
      you use functions like
      http://doc.qt.io/qt-5/qiodevice.html#waitForReadyRead
      http://doc.qt.io/qt-5/qiodevice.html#waitForBytesWritten
      Which does have msecs of how long to wait.

      For asynchronous operation you use signals and such timeout are not available.

      So no, there is no way to set ReadTotalTimeoutMultiplier (afaik)
      as its a pure windows thing and Qt is cross platform.

      1 Reply Last reply
      3
      • C Offline
        C Offline
        Corban_Dallas
        wrote on last edited by
        #3

        Thanks for the answer. In oreder to work under any platform im rewriting the old win-application by using qt. In this old application time intervals was set manually. In my new application i tryed to use these funcs (watiForReadyRead, waitForBytesWritten) but after some time the device stops answering for no reason, so i tryed to repeat exactly the windows implementation, but looks like it would not be easy.

        mrjjM 1 Reply Last reply
        1
        • C Corban_Dallas

          Thanks for the answer. In oreder to work under any platform im rewriting the old win-application by using qt. In this old application time intervals was set manually. In my new application i tryed to use these funcs (watiForReadyRead, waitForBytesWritten) but after some time the device stops answering for no reason, so i tryed to repeat exactly the windows implementation, but looks like it would not be easy.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Corban_Dallas
          Well its hard to guess at , but even with slightly different
          timings, the board should not stop responding.

          But if you cant debug the board and see why it stops being happy then it will be up hill.

          You most likely already tried this but no harm mentioning it.
          I would use a serial sniffer and have a look at a normal talk
          with the board using the old program and then compare to new talk using Qt version.

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

            You can use QSerialPort::handle() and do what do you want on your own risk.

            1 Reply Last reply
            2

            • Login

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