Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Bluetooth keeps on "Connecting state"
Forum Updated to NodeBB v4.3 + New Features

Qt Bluetooth keeps on "Connecting state"

Scheduled Pinned Locked Moved Unsolved General and Desktop
bluetootharduinoubuntu
6 Posts 2 Posters 1.2k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Manu_NaFu
    wrote on 11 Nov 2021, 09:35 last edited by Manu_NaFu 11 Nov 2021, 11:47
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 11 Nov 2021, 15:49 last edited by
      #2

      Hi
      Did you try any of the samples and see if they see it ?
      https://doc.qt.io/qt-5/qtbluetooth-btscanner-example.html

      M 1 Reply Last reply 11 Nov 2021, 15:58
      0
      • M mrjj
        11 Nov 2021, 15:49

        Hi
        Did you try any of the samples and see if they see it ?
        https://doc.qt.io/qt-5/qtbluetooth-btscanner-example.html

        M Offline
        M Offline
        Manu_NaFu
        wrote on 11 Nov 2021, 15:58 last edited by
        #3

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

        M 1 Reply Last reply 11 Nov 2021, 16:02
        0
        • M Manu_NaFu
          11 Nov 2021, 15:58

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

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 11 Nov 2021, 16:02 last edited by
          #4

          @Manu_NaFu

          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/

          M 2 Replies Last reply 11 Nov 2021, 17:07
          1
          • M mrjj
            11 Nov 2021, 16:02

            @Manu_NaFu

            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/

            M Offline
            M Offline
            Manu_NaFu
            wrote on 11 Nov 2021, 17:07 last edited by
            #5

            @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: no

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

            1 Reply Last reply
            0
            • M mrjj
              11 Nov 2021, 16:02

              @Manu_NaFu

              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/

              M Offline
              M Offline
              Manu_NaFu
              wrote on 13 Nov 2021, 17:43 last edited by
              #6

              @mrjj Hi Again,

              I just noticed that despite not being able to pair, I can connect to the bluetooth module using connect (in bluetoothctl).

              Could it be that Qt internally always tries to pair before connect, and that's why it cannot connect?

              1 Reply Last reply
              0

              4/6

              11 Nov 2021, 16:02

              • Login

              • Login or register to search.
              4 out of 6
              • First post
                4/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved