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"

Qt Bluetooth keeps on "Connecting state"

Scheduled Pinned Locked Moved Unsolved General and Desktop
bluetootharduinoubuntu
6 Posts 2 Posters 1.9k 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 last edited by Manu_NaFu
    #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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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
      0
      • mrjjM mrjj

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

        mrjjM 1 Reply Last reply
        0
        • M Manu_NaFu

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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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
          1
          • mrjjM mrjj

            @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 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
            • mrjjM mrjj

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

              • Login

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