Results 1 to 5 of 5

Thread: Can I use QtSerialPort to detect if a serial device is connected/disconnected?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Can I use QtSerialPort to detect if a serial device is connected/disconnected?

    Hey!
    I'm writing code for a button that communicates through a serial port. I have used QtSerialPort which have been great. Now I want to see if I can make my program automatically detect if my device is connected/disconnected? I hope to use QtSerialPort but otherwise I open to other solutions.
    Thanks!

  2. #2
    Join Date
    Jan 2008
    Posts
    72
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Can I use QtSerialPort to detect if a serial device is connected/disconnected?

    I don't think so Qt provide support for device interaction. To interact with device use OS native api.

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

    Default Re: Can I use QtSerialPort to detect if a serial device is connected/disconnected?

    For the serial port in general not possible to determine whether connected to it a device.

    Only if the device is special and uses additional lines such as RTS, DTR and so forth, that is, puts these lines in "High",
    then we can define the connected device by reading the state of these lines dtr(), rts().

    Also, you can determine whether the device is connected - to periodically send requests to it, and if it does not respond - it is not connected.

Similar Threads

  1. Adding QtSerialPort as a library -
    By HSPalm in forum Newbie
    Replies: 14
    Last Post: 26th June 2014, 16:16
  2. Replies: 6
    Last Post: 24th February 2012, 11:17
  3. cannot build qtserialport
    By banlinhtienphong in forum Qt Programming
    Replies: 1
    Last Post: 16th December 2011, 05:56
  4. database disconnected !
    By tinysoft in forum Newbie
    Replies: 1
    Last Post: 4th May 2011, 00:46
  5. QTcpSocket - How do I know when it is disconnected ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2006, 21:05

Tags for this Thread

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.