Qt Bluetooth keeps on "Connecting state"
-
Hello,
I bought a HM-10 bluetooth module and would like to connect it with an arduino uno board to my pc. I tried connecting it to my phone with an app called "serial bluetooth terminal" and it works, but when I try to connect to my ubuntu pc, it hangs in the "ConnectingState" and never connects.
I don't really know what uuid to use, I just found this one on the internet but is not working for me:
static const QString serviceUuid(QStringLiteral("00001101-0000-1000-8000-00805F9B34FB")); socket->connectToService(QBluetoothAddress(string), QBluetoothUuid(serviceUuid), QIODevice::ReadWrite);
If you need more code I can post anything.
Many thanks in advance.
-
Hi
Did you try any of the samples and see if they see it ?
https://doc.qt.io/qt-5/qtbluetooth-btscanner-example.html -
@mrjj Hi, thanks for your response. I can see a lot of examples but none for bluetooth.
The thing is that I can see the bluetooth but when I click to connect, it keeps on "connecting state". I'm trying to use the low energy API now as the module HM-10 is low energy as well, and see if that works.
-
Hi
- I can see a lot of examples but none for Bluetooth.
you mean in creator ?
On Linux, it uses BlueZ as a backend.
you could also try the command line utility
bluetoothctl
and see if that can pair to it.https://ubuntu.com/core/docs/bluez/reference/commands
https://www.makeuseof.com/manage-bluetooth-linux-with-bluetoothctl/ - I can see a lot of examples but none for Bluetooth.
-
@mrjj Thanks a lot, this information is useful indeed.
I have followed the steps but I'm still missing something, when I try to pair, I get:
[CHG] Device <mac addres> Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device <mac addres> Connected: noDo you have any clue why this happens? I used trust <mac addres> and pair <mac addres>
I know this is not related to Qt anymore, but if you have any clue that would be much appreciated.
Thanks again for your support.
-