Results 1 to 5 of 5

Thread: serial port communications- functions

  1. #1
    Join Date
    Dec 2011
    Location
    Bangalore,India
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14

    Default serial port communications- functions

    Hi,
    i am reading data's from serial port using readyread function,using QSerialDevice and if serial port doesn't sends any data, is there any function to handle it? And if the data's are sent continuously and in-between if it is disconnected how to handle it. kindly do suggest me with some solutions.

    Thanks in advance

  2. #2
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 43 Times in 42 Posts

    Default Re: serial port communications- functions

    1. Instead of old QSerialDevice use the QtSerialPort

    2.

    if serial port doesn't sends any data, is there any function to handle it?
    Sorry? What do you mean?

    3.
    And if the data's are sent continuously and in-between if it is disconnected how to handle it.
    What is mean by disconnected?

  3. #3
    Join Date
    Dec 2011
    Location
    Bangalore,India
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14

    Default Re: serial port communications- functions

    Thankyou kuzulis. I am using Qt5.1.0 which has a inbuilt class QserialDevice.

    I am having a battery enabled device which sends data in form a packet, through serial port.. if the battery gets drained i would not receive any data . how can it be notified and which function i can use?

    using readyread() function i am reading all the data's form the port. and the packet information from the device doesn't send any data for notification of low battery.

    Thanks..

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: serial port communications- functions

    if the battery gets drained i would not receive any data . how can it be notified and which function i can use?
    There is no magic therOtherEndHasGoneQuiet() signal. You can start or restart a long timer every time data is received. If the timer expires then the other end has stopped sending.
    and the packet information from the device doesn't send any data for notification of low battery.
    Then I guess you get no warning that transmission is going to cease. This has nothing to do with Qt though.

  5. #5
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 43 Times in 42 Posts

    Default Re: serial port communications- functions

    Yes, as say ChrisW67.

    Also can be use the additional RTS and so on pinout signals in case your battery can provide it. Then in your application you can periodically read the state of this pinout and know if the battery will be empty (e.g. this pinout can be reset to low). In any case see the datasheet of your battery.

Similar Threads

  1. qt serial port
    By saman_artorious in forum Newbie
    Replies: 9
    Last Post: 24th April 2013, 17:19
  2. Serial Port communication
    By mgurbuz in forum Qt Programming
    Replies: 12
    Last Post: 22nd January 2011, 03:38
  3. serial port issues
    By jhowland in forum Qt Programming
    Replies: 7
    Last Post: 12th January 2009, 14:38
  4. Serial Port
    By b1 in forum Qt Programming
    Replies: 2
    Last Post: 18th January 2007, 03:05
  5. serial port and USB communication
    By shamik in forum Qt Programming
    Replies: 5
    Last Post: 4th December 2006, 11:40

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.