Unsolved Can't connect to bluetooth device after using QBluetoothServer.
-
Hello.
I have a problem with Qt bluetooth. In my app I create a QBluetoothServer and call it's listen method to receive upcoming connections from paired devices. But I have some devices that I need to establish connection from the app using QBluetoothSocket and it's connectToService() method. Both methods works but ONLY if I don't use it in the same application. I notice when I create a server and later try to connect with QBluetoothSocket it connects and disconnects after a while. When I comment out the line where I call
server->listen(QBluetoothUuid::SerialPort);
then the QBluetoothSocket method works normally , I can connect with connectToService(). I need to use both approaches because my app is supposed to receive data from medical devices that tries to connect automatically when they takes measurements (blood pressure, scale) and I have devices that doesn't do that - the user have to manually select the device from the list and click connect.
I tried to close the server before establishing the connection but it didn't solve the problem. I assume that the running server blocks the QBluetoothSocket from establishing a connection and it's close method is not enough to unlock it. Can I do something to make it work?Thanks.