Results 1 to 11 of 11

Thread: Sequential work with the port

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sequential work with the port

    because if my request does not reach board for some reason, she will not answer me, no matter how much time I wait. For this reason, I make repeated requests after the timeout.
    or you can set a timeout as well.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. #2
    Join Date
    Apr 2017
    Posts
    30
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Sequential work with the port

    Quote Originally Posted by high_flyer View Post
    or you can set a timeout as well.
    So, how can I do this?..

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sequential work with the port

    So, how can I do this?..
    there are several ways...
    Probably the least "intrusive" would be to have a timer run and you can check the elapsed time in your while() loop where you are checking the available bytes from the serial device.
    Once the timeout is reached you simply return from your custom waitForReadRead() with false.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Apr 2017
    Posts
    30
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Sequential work with the port

    Quote Originally Posted by high_flyer View Post
    there are several ways...
    Probably the least "intrusive" would be to have a timer run and you can check the elapsed time in your while() loop where you are checking the available bytes from the serial device.
    Once the timeout is reached you simply return from your custom waitForReadRead() with false.
    Thank for you answer. But I already tried to do this way, the port "was silent".
    http://www.qtcentre.org/threads/6904...574#post301574

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sequential work with the port

    Thank for you answer. But I already tried to do this way, the port "was silent".
    Do you mean by that the the port didn't answer within the time you specified?
    If yes, then try prolonging the timeout.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  6. #6
    Join Date
    Apr 2017
    Posts
    30
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Sequential work with the port

    Quote Originally Posted by high_flyer View Post
    Do you mean by that the the port didn't answer within the time you specified?
    If yes, then try prolonging the timeout.
    I tried to increase. Ping using the function waitForReadRead() was 2-5 milliseconds. With the use of a timer, the board absolutely did not answer anything for 333 milliseconds and more. I concluded that data reception is somehow blocked.

Similar Threads

  1. Instructions are NOT sequential in qt/qml?!?
    By JaySDC in forum Qt Quick
    Replies: 9
    Last Post: 24th October 2015, 17:41
  2. serial port command doesn't work
    By hovuquocan1997 in forum Qt Programming
    Replies: 4
    Last Post: 20th July 2015, 16:10
  3. Replies: 2
    Last Post: 26th July 2014, 16:36
  4. Sequential animations on each listitem
    By rama.kesi in forum Qt Quick
    Replies: 3
    Last Post: 12th October 2012, 03:36
  5. Sequential animations on each listitem
    By rama.kesi in forum Qt Quick
    Replies: 0
    Last Post: 8th October 2012, 05:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.