Qt Bluetooth Heartrate-server example error
-
Hello, I'm trying to use the example code "heartrate server".
When I try to lunch it, I get this error:qt.bluetooth.bluez: received advertising error
I already checked both on google and here on the forum but I didn't find a solution.
I'm using Qt Creator 4.14.0 with Qt 5.15.2 on a virtual machine with Ubuntu 20.04.2 LTS. I already used the bluetooth with other codes and examples without any problem.
Thanks for all the help. -
Hi,
Did you follow this note from the documentation:
Note: On Linux, advertising requires privileged access, so you need to run the example as root, for instance via sudo.
?
-
Thank you @SGaist.
I'm trying to do it now but after following this guide, I simply get the error in an external terminal window -
What are you doing exactly ?
-
Under Options>Tools>Environment>System>Terminal I have as default value "/usr/bin/x-terminal-emulator -e".
I changed it into "/usr/bin/x-terminal-emulator -e sudo". Then in my project window I checked the option "run in terminal".
On my laptop it didn't work as I mentioned above, on my other pc (desktop with same OS and Qt creator/Qt version) it worked. -
Did you check the differences between the two like Bluetooth hardware, drivers version, library version etc ?
Are you also able to sudo on both machines ?
-
They have the same libraries version but different hardware (on the PC I'm using a dongle, on laptop I'm using the internal chip).
-
Did you check whether it's working with the dongle on your laptop ?
-
Yes I checked and I have the same issue. The strange thing is that once I run the program in an external terminal, it doesn't ask me for the password on the laptop, while on my PC it asks for it
-
What do you mean by it does not ask you for password ?
-
On the Pc, when I run the program a new terminal opens asking me for my admin password and then the program starts.
On the laptop, the new terminal opens without asking me for the admin password and starts directly the program which returns me the advertising error -
Then you should yourself test it from a terminal that you have the control on.
-
I have changed the permissions for BLE advertising and I'm able to both use bluetoothctl and hcitools without root permissions. But still with qt creator I get the error "advertising error" if I don't use an external terminal, but using it I'm not able to perform debugging (it starts and immediatly say "debugging has finished")