android


BLE notification subscription gets 133


1 Android phone (N5X 6.0.1) is running a BLE server, another one (N5X O) is subscribing.
Notification for a characteristic can be enabled however, on the write descriptor part, I'm consistently getting a 133.
Server.java
bluetoothGattServer = bluetoothManager.openGattServer(this, serverCallback);
BluetoothGattService service = new BluetoothGattService(Constants.SERVICE,
BluetoothGattService.SERVICE_TYPE_PRIMARY);
characteristic =
new BluetoothGattCharacteristic(Constants.CHARACTERISTIC,
BluetoothGattCharacteristic.PROPERTY_NOTIFY,
BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_WRITE);
// public static UUID DESCRIPTOR = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
characteristic.addDescriptor(new BluetoothGattDescriptor(Constants.DESCRIPTOR,
BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE));
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
service.addCharacteristic(characteristic);
bluetoothGattServer.addService(service);
All the other UUIDs have been created from here.
Client.java
device.establishConnection(false)
.flatMap(bleConnection -> bleConnection.setupNotification(Constants.CHARACTERISTIC))
.flatMap(onNotificationReceived -> onNotificationReceived)
.subscribe(data -> {
Log.d(TAG, "data: " + data);
}, throwable -> {
Log.d(TAG, "data error " + throwable);
});
logcat
05-15 15:26:50.097 D/BluetoothGatt: setCharacteristicNotification() - uuid: 8d7dda32-3759-11e7-a919-92ebcb67fe33 enable: true
05-15 15:26:50.105 D/RxBle#Radio: QUEUED RxBleRadioOperationDescriptorWrite(60042487)
05-15 15:26:50.110 D/RxBle#Radio: FINISHED RxBleRadioOperationServicesDiscover(231218312)
05-15 15:26:50.112 D/RxBle#Radio: STARTED RxBleRadioOperationDescriptorWrite(60042487)
05-15 15:27:20.119 D/RxBle#Radio: FINISHED RxBleRadioOperationDescriptorWrite(60042487)
05-15 15:27:20.121 D/BluetoothGatt: setCharacteristicNotification() - uuid: 8d7dda32-3759-11e7-a919-92ebcb67fe33 enable: false
05-15 15:27:20.126 D/RxBle#BluetoothGatt: onDescriptorWrite descriptor=00002902-0000-1000-8000-00805f9b34fb status=133
05-15 15:27:20.129 D/BLE: data error BleGattDescriptorException{macAddress=42:EE:5A:C6:C1:F0, status=133 (0x85 -> https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.1.0_r1/stack/include/gatt_api.h), bleGattOperationType=BleGattOperation{description='DESCRIPTOR_WRITE'}}
Note: if I'm using the native Android API, I'm able to subscribe and receive notifications without having to write into the descriptor.
Bluetooth Core Specification says that if a characteristic supports notifications it should contain a Client Characteristic Config descriptor and start notifying only when CCC descriptor will be written with a proper value.
It seems that in your configuration there is a problem which manifests as status = 133. It seems that you may have made a mistake when setting properties on the characteristic. I assume that you want to have a characteristic that you can read, write and set notifications - in this situation it would look like:
characteristic =
new BluetoothGattCharacteristic(Constants.CHARACTERISTIC,
BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PROPERTY_WRITE, BluetoothGattCharacteristic.PROPERTY_NOTIFY,
BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_WRITE);
Potential workaround
Some chinese manufacturers are not conforming to the Bluetooth Core Specification and they do not have CCC descriptor. If you are able to get the notifications without setting CCC then you could use a compatibility mode RxBleConnection.setupNotifications(characteristic, NotificationSetupMode.COMPAT) although it is discouraged and a proper fix to the configuration should be aplied.

Related Links

Strategy for displaying a progress indicator while loading data into an SQLite database?
how to use SymbolicC++ in Android NDK?
Image in the background of drawn canvas
Ontouch() isn't work with custom view?
Why a set android Image disappears?
Android - How to add Google Map Marker Label?
Is there only one shared preferences object per application?
MPO Images from HTC Evo 3D
How to add focus function in MediaRecorder?
403 Access Not Configured Google Api youtube
search if is a pdf reader app installed - Android
How to downsample images correctly?
is there a way to store the whole text of an Android activity screen in a string or HTML format?
injecting objects that rely on each other - roboguice
Android app using Monodroid unable to get external program to correctly open file
Android app using google maps not working on phone

Categories

HOME
asp.net-web-api
eclipse
deep-learning
google-spreadsheet
jax-rs
twig
3d
toolbox
components
mstest
error-handling
grafana
r-googlesheets
pdfbox
static-site
scripting
3d-reconstruction
pearson-correlation
missing-data
boto3
vimdiff
siddhi
filechannel
dynatrace
selectize.js
android-intent
aws-sdk
video-editing
jquery-callback
draft-js-plugins
jasmine-node
oculus
progress-bar
linked-data
quantlib
userdefaults
send
clickjacking
android-gridview
processwire
hivemq
magento-1.9.2.4
parse-tree
sessionstorage
ods
metaprogramming
mcustomscrollbar
glm-math
logback-groovy
apollostack
vaadin-charts
oim
dbcontext
convex-optimization
google-cse
remedy
appdomain
yii2-user
git-flow
arules
flyout
vibrate
vcloud-director-rest-api
smartfoxserver
autosar
builtins
envi
swizzling
false-sharing
file-move
vigenere
ess
android-launcher
doctype
rpart
jsvc
gamekit
mruby
jbake
human-computer-interface
angular-carousel
ray
dct
clickbank
qscrollarea
ecslidingviewcontroller
embedded-fonts
kendo-dataviz
observium
mvc-editor-templates
workitem
nebula
kaleidoscope
time.h
redis-py
sentestingkit
veracity
koken
tournament
clrstoredprocedure
objective-j
maven-1
easyb
addchild
zend-rest
filesystemobject
interop-domino
scrubyt
unmanagedresources

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App