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

Android BLE: A read/notify characteristic's CCC descriptor is sometimes not discovered

    XMLWordPrintable

Details

    • Android
    • 7390de230e3c86049824bef756e4af623a547d61 (qt/qtconnectivity/5.13) 5f6187cb9e17b55cd2a68ac3094ae6a1879b50a2 (qt/qtconnectivity/5.12)

    Description

      In a Qt App running on android There is a case where a read/notify characteristic's QBluetoothUuid::ClientCharacteristicConfiguration descriptor is invalid.

      This happens whenever the following error appears:

      W QtBluetoothGatt: onDescriptorcRead during discovery error: 11

      I created a patch, which adds the descriptor even if the reading fails in the file QtBluetoothLE.java

      There was a similar bug related to characteristic was raised earlier: QTBUG-58056

      Now the same happens for descriptor.

      Fix applied as below after the line Log.w(TAG, "onDescriptorcRead during discovery error: " + status);

      if (status == BluetoothGatt.GATT_SUCCESS) {
          //TODO avoid sending service and characteristic uuid -> handles should be sufficient
          leDescriptorRead(qtObject, descriptor.getCharacteristic().getService().getUuid().toString(),
                           descriptor.getCharacteristic().getUuid().toString(), foundHandle + 1,
                           descriptor.getUuid().toString(), descriptor.getValue());
      } else {
          if (isServiceDiscoveryRun) {
              //ignore
              Log.w(TAG, "onDescriptorcRead during discovery error: " + status);
              
              leDescriptorRead(qtObject, descriptor.getCharacteristic().getService().getUuid().toString(),
                                descriptor.getCharacteristic().getUuid().toString(), foundHandle + 1,
                                descriptor.getUuid().toString(), descriptor.getValue());
          } else {
              // This must be in sync with QLowEnergyService::DescriptorReadError
              final int descriptorReadError = 6;
              leServiceError(qtObject, foundHandle + 1, descriptorReadError);
          }
      }
      

      Attachments

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

        Activity

          People

            ablasche Alex Blasche
            adaitabehera adaita kumar behera
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes