5
votes

A question on enabling characteristics using the new android BLE 4.3:

I am not getting any notification from the BLE device though I enable notification on characteristics one by one asynchronously using a queue.

I also write the descriptor with UUID "00002902-0000-1000-8000-00805f9b34fb" with ENABLE_NOTIFICATION_VALUE.

I have followed the recommendation from Google sdk doc and as well suggestions from various forums.

By the way I get status = 128 on "onDescriptorWrite". Any idea as what this status means?

I went thru google code and did not see any info on this. Even the source code does not throw any light as how this status is being set.

Let me know if any of you have experienced this when you enabled notifications for the body media device. Also at times I get status 133 on descriptor write. I use latest Nexus 7 for my tests.

4
Don't think it's going to solve your problem, but 128 is GATT_NO_RESOURCES. android.googlesource.com/platform/external/bluetooth/bluedroid/…reTs
In my experience the status code is not reliable unless the status is stated in the developer site.reTs

4 Answers

3
votes

I had the same problem, and solved it by disabling and reenabling the bluetooth interface.

The Android BLE stack seems to be still immature and suffers from instability problems.

2
votes

This error could be related to max threshold imposed by Android OS.

#define BTA_GATTC_NOTIF_REG_MAX     15

 - for 4.3 max number of notification/indication is 4 
 - for 4.4 max number of notification/indication is 7
 - for 5.0 max number of notification/indication is 15

https://groups.google.com/forum/#!topic/android-platform/FNHO5KB4sKI

https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.0.2_r1/bta/gatt/bta_gattc_int.h

0
votes

A very late answer, but this might prove valuable to anyone encountering status 128 (GATT_NO_RESOURCES) on a gatt.writedescriptor() call.

In my case status 128 showed up when trying to write a descriptor with a value of ENABLE_NOTIFICATION_VALUE for a characteristic that required a subscription for an indication via ENABLE_INDICATION_VALUE instead.

So instead of

BluetoothGattDescriptor descriptor = bluetoothGattCharacteristic.getDescriptor(DESCRIPTOR_UUID);
descriptor.setValue(ENABLE_NOTIFICATION_VALUE);
mGatt.writeDescriptor(descriptor);

going for

BluetoothGattDescriptor descriptor = bluetoothGattCharacteristic.getDescriptor(DESCRIPTOR_UUID);
descriptor.setValue(ENABLE_INDICATION_VALUE);
mGatt.writeDescriptor(descriptor);

Fixed the problem. I assume the other way around will produce the same error status 128.

-1
votes

I received this error when performing writeCharacteristic with the WriteNoResponse property. When I specify the WriteWithoutResponse argument for writeCharacteristic, the problem disappears.