Qt6 QBluetoothSocket readyRead() signal but nothing to read in the socket
-
I have used QBluetoothSocket in Qt 5.15.2 without issue. After setting up the QBluetoothSocket, I rely on the socket's readyRead() signal to tell me when to read from the socket with readAll(). No issues; able to reliably read from the socket every time.
Now I am transitioning from Qt 5.15.2 to Qt 6.5.3.
I set up the QBluetoothSocket in Qt 6.5.3 as I have done so in Qt 5.15.2.
The readyRead() signal method to trigger the socket's readAll() fuction strategy works fine for a while in Qt 6.5.3. But after a while of working, the readyRead() signal comes in and I try to read from the socket but there is no data in the socket. (Confirmed with canReadLine() returning false & bytesAvailable() returning 0)
Could this be a QBluetoothSocket bug in Qt 6.5.3 or am I missing something? I believe I have tried Qt 6.6 but still the same issue.
-
Hi and welcome to devnet,
You should provide some more details about your setup:
- OS you are running on
- Bluetooth device you are connecting to
You might want to take a look at the bug report system as well.
-
@SGaist Thank for the reply! Apologies in not specifying my build system:
The Build Environment is as follows:
Windows 11 Pro (Also the run environment)
The App is built with Qt 6.5.3 (obtained from Qt Maintenance tool; which Qt has compiled with MSVC 2019)
We are compiling with the App with MSVC 2022 compiler.The Bluetooth device we are connecting to is a custom device. It uses Serial Port Profile.
The socket we open on the app side is opened with RfcommProtocol.We transmit about 11 bytes of data every 10ms from the Device to the app.
-
@SGaist Good News!
So QBluetoothSocket still doesn't work. But QSerialPort does!
QSerialPort has been able to read my Bluetooth port successfully every time after a readyRead()!So a temporary workaround for people until Qt figures out what is wrong with QBluetoothSocket.
-
@sidthatsme Nice to read !
Rather than just waiting for a fix, you should check if there's a bug report already available about your issue and if not, open one.
-
@SGaist Thanks for the advice!
A bug report has been added: https://bugreports.qt.io/browse/QTBUG-123390
Appreciate the help!