Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android BLE services not discovered

Android BLE services not discovered

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 1.3k Views
  • 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
    MartinD
    wrote on last edited by
    #1

    Hi,
    I have Lenovo tab E8 tablet with Android 7.0 and I connect to a BLE device from my Qt 5.11.2 app. After succesfull connection I discover services. However, everytime only Generic access service is discovered (my BLE device contains 5 services).

    D BluetoothGatt: connect() - device: CC:C6:2F:F7:55:3D, auto: false
    D BluetoothGatt: registerApp()
    D BluetoothGatt: registerApp() - UUID=d483db22-5289-457f-8c9b-6e6d82f13428
    D BluetoothGatt: onClientRegistered() - status=0 clientIf=6
    W QtBluetoothGatt: Using Android v23 BluetoothDevice.connectGatt()
    D BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=CC:C6:2F:F7:55:3D
    D BluetoothDevice: getBondState: state = 12
    D BluetoothGatt: discoverServices() - device: CC:C6:2F:F7:55:3D
    D BluetoothGatt: onSearchComplete() = Device=CC:C6:2F:F7:55:3D Status=0 // here only Generic Access service is discovered
    D BluetoothGatt: configureMTU() - device: CC:C6:2F:F7:55:3D mtu: 512
    W QtBluetoothGatt: MTU change initiated
    D BluetoothGatt: onConfigureMTU() - Device=CC:C6:2F:F7:55:3D mtu=247 status=0
    W QtBluetoothGatt: MTU changed to 247
    

    I also tried 3rd party app - Nordic's nRF Connect for Android - it also discoveres only Generic Access service. I'm not sure, but I think the problem is related to the MTU change...

    I tried also on some other Android devices and also on different platforms and communication with my BLE device works there.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MartinD
      wrote on last edited by
      #2

      I discovered that the issue is related to the fact that I request pairing from my Qt app by calling https://doc.qt.io/qt-5/qbluetoothlocaldevice.html#requestPairing (local->requestPairing(_controller->remoteAddress(), QBluetoothLocalDevice::Paired)). After that, I can never discover services of my BLE.

      However, If I bond my BLE device using tablet's Bluetooth settings page or using 3rd app (nRF Connect for Android), that I can connect and discover all services of my BLE device.

      Anyone can help how to perform pairing with BLE device in Qt app?

      J.HilkJ 1 Reply Last reply
      0
      • M MartinD

        I discovered that the issue is related to the fact that I request pairing from my Qt app by calling https://doc.qt.io/qt-5/qbluetoothlocaldevice.html#requestPairing (local->requestPairing(_controller->remoteAddress(), QBluetoothLocalDevice::Paired)). After that, I can never discover services of my BLE.

        However, If I bond my BLE device using tablet's Bluetooth settings page or using 3rd app (nRF Connect for Android), that I can connect and discover all services of my BLE device.

        Anyone can help how to perform pairing with BLE device in Qt app?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        hi @MartinD
        have you checked the documentation?

        it has a qml and cpp based BluetoothLE scanner/desicovery example

        https://doc.qt.io/qt-5/qtbluetooth-scanner-example.html#
        https://doc.qt.io/qt-5/qtbluetooth-btscanner-example.html#

        https://doc.qt.io/qt-5/bluetooth-examples.html

        they are ready to compile, and you should be able to find them in QtCreator(if you use it)

        Should get you pretty far


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        M 1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          hi @MartinD
          have you checked the documentation?

          it has a qml and cpp based BluetoothLE scanner/desicovery example

          https://doc.qt.io/qt-5/qtbluetooth-scanner-example.html#
          https://doc.qt.io/qt-5/qtbluetooth-btscanner-example.html#

          https://doc.qt.io/qt-5/bluetooth-examples.html

          they are ready to compile, and you should be able to find them in QtCreator(if you use it)

          Should get you pretty far

          M Offline
          M Offline
          MartinD
          wrote on last edited by
          #4

          @J-Hilk Hi, but is there any example how to pair/bond BLE device in Qt?

          I have no problems with scanner or discovery on any of my Android devices.

          J.HilkJ 1 Reply Last reply
          0
          • M MartinD

            @J-Hilk Hi, but is there any example how to pair/bond BLE device in Qt?

            I have no problems with scanner or discovery on any of my Android devices.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @MartinD define pairing

            If you mean,

            discover your device as available
            connect to it and identify the services

            than yes, those 2 examples will exactly do that


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            M 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @MartinD define pairing

              If you mean,

              discover your device as available
              connect to it and identify the services

              than yes, those 2 examples will exactly do that

              M Offline
              M Offline
              MartinD
              wrote on last edited by
              #6

              @J-Hilk Pairing and bonding is well defined in Bluetooth standard. Bonding means securing connection and storing the keys used to secure the connection permanently on both sides so they can be reused later.

              1 Reply Last reply
              1

              • Login

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