Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Qt Bluetooth Heartrate-server example error

    General and Desktop
    2
    13
    274
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      AndreaFurlani last edited by AndreaFurlani

      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.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by SGaist

        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.
        

        ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • A
          AndreaFurlani last edited by

          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

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            What are you doing exactly ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • A
              AndreaFurlani last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • A
                  AndreaFurlani last edited by

                  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).

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    Did you check whether it's working with the dongle on your laptop ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply Reply Quote 0
                    • A
                      AndreaFurlani last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • SGaist
                        SGaist Lifetime Qt Champion last edited by

                        What do you mean by it does not ask you for password ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply Reply Quote 0
                        • A
                          AndreaFurlani last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • SGaist
                            SGaist Lifetime Qt Champion last edited by

                            Then you should yourself test it from a terminal that you have the control on.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply Reply Quote 0
                            • A
                              AndreaFurlani last edited by AndreaFurlani

                              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")

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post