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. Is there any signal for port disconnect in qextserialport
Forum Updated to NodeBB v4.3 + New Features

Is there any signal for port disconnect in qextserialport

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 5.2k 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.
  • S Offline
    S Offline
    SagarChopade
    wrote on last edited by
    #1

    Hi
    I am using USB to serial port device which can be physically disconnected
    when i open the port using qextserialport library and then disconnect the port physically, running exe hangs.
    so is there any signal for port disconnect in qextserialport

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

      QextSerialPort has a similar signals into QextSerialEnumerator class:

      • deviceDiscovered()
      • deviceRemoved()

      But I am not sure that they are implemented for all platforms.

      Though, you can use other module "QtSerialPort":https://qt-project.org/doc/qt-5.1/qtserialport/qtserialport-module.html which has "QSerialPort::error()":https://qt-project.org/doc/qt-5.1/qtserialport/qserialport.html#error-prop signal with "ResourceError":https://qt-project.org/doc/qt-5.1/qtserialport/qserialport.html#SerialPortError-enum code. This signal will be emitted if to pull out already open device from system (e.g. pull USB cable).

      The module "QtSerialPort":https://qt-project.org/doc/qt-5.1/qtserialport/qtserialport-module.html was introduced into Qt5.1 (by default), also you can build this module yourself for Qt4.8.x, see "Wiki":http://qt-project.org/wiki/QtSerialPort.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SagarChopade
        wrote on last edited by
        #3

        thanks for reply
        i have tried deviceDiscovered() & deviceRemoved() but nothing worked
        i will try Qtserialport module.

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

          bq. i will try Qtserialport module.

          Yes, then please let know about results. If something doesn't work - that we will try to fix it quickly. :)

          UPD: You can check it in "Simply Terminal" example (which is delivered with QtSerialPport). Just try to open device and pull an USB cable, then Terminal should display the messagebox with "ResourceError" error.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SagarChopade
            wrote on last edited by
            #5

            Thanks kuzulls
            QtSerialPort works, it provides signals for all serial port errors so i can able to detect the USB port disconnect event.
            but for this i have ported my code to QT5 then it worked
            Thanks again...

            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