Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96743

BTLE on Android: Characteristic supposed to support both Notification and Indication supports neither

    XMLWordPrintable

    Details

    • Platform/s:
      Android
    • Commits:
      760ab15e96df250cbab1a767bb3d87957ba4e157 (qt/qtconnectivity/dev) a50f0e5c5a3291e617b4c4a205e99cd5d302405d (qt/qtconnectivity/6.2)
    • Story Points:
      21
    • Sprint:
      Team 1 Foundation_Sprint 46, Team 1 Foundation_Sprint 47

      Description

      Testing with

      https://codereview.qt-project.org/c/qt/qtconnectivity/+/347342/22

      with bluetoothtestdevice on Android (Google Pixel 4a) and tst_qlowenergycontroller_device on the Linux host, the following behavior can be observed:

      Running the test "testNotificationAndIndication", first everything works fine for the characteristic supporting only notification. Then everything works fire for the characteristic supporting only indication. Then it tries to enable notification on the characteristic which supports both notification and indication. This however does not lead to notifications. It waits for a notification, but none arrives. It then fails with the error message

      FAIL!  : tst_qlowenergycontroller_device::testNotificationAndIndication() '(characteristic.value() != oldvalue)' returned FALSE. ()
         Loc: [/home/andreasbuhr/development/qtdev/qtconnectivity/tests/manual/qlowenergycontroller/tst_qlowenergycontroller_device.cpp(532)]
      

      The error seems to be on the host side. The following code should enable the notification:

              QByteArray newValue = QByteArray::fromHex("0100");
              service->writeDescriptor(cccd, newValue);
              QTRY_VERIFY(cccdWritten);
      

      Clearly, the value "0100" should be written. But it does not happen. Wireshark tells us that that a Write Request with content 0x0300 is sent.

      This value 0x0300 is also seen in the logcat:

      09-21 16:43:05.478 10546 10574 D qt.bluetooth.android: : Server descriptor change notification "0300"
      09-21 16:43:05.479 10546 10574 D qt.bluetooth.android: : serverDescriptorChanged: Matching descriptor "{00002902-0000-1000-8000-00805f9b34fb}" in char "{d92435d4-6c2e-43f8-a6be-bbb66b5a3e28}" of service "{bb137ac5-5716-4b80-873b-e2d11d29efe2}"
      

      Now maybe the Android Gatt server is confused by the value "0300" which would activate both notification and indication. Maybe it decides to do neither in this case, which would be a sane decision.

      Main question: Why does the code mentioned above, writing the value "0100" lead to the value "0300" on the wire?

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              vuokko Juha Vuolle
              Reporter:
              andreasbuhr Andreas Buhr
              PM Owner:
              Vladimir Minenko Vladimir Minenko
              RnD Owner:
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes