QSerialPort strange behaviour
-
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?
-
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?
@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
-
@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
@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