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

Retrofit call within Stream
Downloaded image not visible on selected android modals?
Android Custom Keyboard for pin code Activity
Kotlin data classes and nullable types
Adobe Flash Professional CS5.5(AS3) with Distriqt Compass always says “The native extension context could not created”
Firebase: Pull random data from Firebase to RecyclerView (android)
Tablelayout and tablerow not setting up properly
No cached version listing for com.parse.tools:gradle:1.+ available for offline mode
Set the minimum timeout for input voice with recognizer speech
New Android Studio don't let me build project with API 23
Communicate with Android bluetooth device via NodeJS and Termux
Not getting Request From Ion (Uploading Image From Android to Spring Server)
Marshmellow GPS coordinates onChangeLocation not calling
How to get track the streaming error JwPlayer Android
android - static shortcut: Possibility of parsing data and start Main Activity from specific code?
getting “rror.Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. >”

Categories

HOME
service-worker
eslint
ng-idle
jmx
rsa
solaris
bitbucket-api
limit
maxscript
modal-dialog
little-proxy
github-enterprise
siddhi
mod-security
cmdb
automatic-ref-counting
nancy
plink
android-intent
parameter-passing
event-sourcing
alpacajs
jersey-1.0
foreign-keys
database-connection
springfox
named-entity-recognition
inno-download-plugin
qliksense
resourcebundle
expressionengine3
custom-post-type
jquery-multiselect
bulletphysics
mql
nsurl
scrollview
zend-debugger
contacts
classcastexception
getpixel
least-squares
latitude-longitude
sim-toolkit
google-knowledge-graph
git-rewrite-history
jpad
release
z-notation
connection-pool
mongoose-schema
ogc
portforwarding
parser-generator
microsoft-metro
lpsolve
clang++
nanoc
jquery-ui-draggable
twilio-click-to-call
android-testing
ngmaterial
sandcastle
change-tracking
builtins
xcode-server
delta
udpclient
qiime
cfchart
html-to-pdf
fuzzywuzzy
toran-proxy
java-money
lazybones
rate-limiting
zen-cart
toolkit
eoferror
airbrake
diff3
user-permissions
shopizer
exceldatareader
post-commit-hook
metatrader5
cocos3d
create.js
mobility
angular-carousel
rcaller
ios8-extension
gae-quotas
square-bracket
hibernate-entitymanager
artemis
ebay-lms
pclzip
pagedown
web-notifications
joomla3.1
os.system
lambdaj
stress
relative
webdev.webserver
uipagecontrol
uideviceorientation
easyb
folding
opml
xpsdocument
technical-debt
java1.4
soappy
online-storage

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App