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 strange behaviour
Forum Updated to NodeBB v4.3 + New Features

QSerialPort strange behaviour

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 278 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.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by
    #1

    My code uses QSerialPort to talk to a serial device (/dev/rfcomm1) - which in fact a bluetooth using SPP protocol.

    Sometimes my program runs fine, but sometimes I can't get the serial device to respond. I try to open/close/open/close to see if I can get my device to respond but it does not.

    However, if I stop my program and restart it then my connection will work. Why would this be? What's the difference between open/close/open and a restart then open? Anything I can do programmatically to simulate a power off to make my device respond?

    J.HilkJ 1 Reply Last reply
    0
    • ocgltdO ocgltd

      My code uses QSerialPort to talk to a serial device (/dev/rfcomm1) - which in fact a bluetooth using SPP protocol.

      Sometimes my program runs fine, but sometimes I can't get the serial device to respond. I try to open/close/open/close to see if I can get my device to respond but it does not.

      However, if I stop my program and restart it then my connection will work. Why would this be? What's the difference between open/close/open and a restart then open? Anything I can do programmatically to simulate a power off to make my device respond?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @ocgltd very hard to tell, without seeing your actual code.

      Potential issue I see is that you have two instances of your serialport. The old one is still open, but not connected to your slots anymore and you try to open/close the old one and nothing happens


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      ocgltdO 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @ocgltd very hard to tell, without seeing your actual code.

        Potential issue I see is that you have two instances of your serialport. The old one is still open, but not connected to your slots anymore and you try to open/close the old one and nothing happens

        ocgltdO Offline
        ocgltdO Offline
        ocgltd
        wrote on last edited by
        #3

        @J-Hilk I'm sure there is only one instance of QSerialPort. As well, I can successfully open the device (/dev/rfcomm1) so that suggests the port is not in use (or open by another copy) since attempting to open an already open port would fail - i assume.

        Something else must be going on

        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