蓝牙Gatt writeCharacteristic返回false [英] bluetoothGatt writeCharacteristic returns false

查看:1594
本文介绍了蓝牙Gatt writeCharacteristic返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了具有WRITE_TYPE_NO_RESPONSE特性的外设。
在另一个应用程序上,我写了特征,但是偶尔会遇到棒棒糖5.1.1的三星银河系i9250:
有时函数BluetoothGatt.writeCharacteristic返回false,并且写入未完成。 / p>

可能是什么?可能是cyanogenmod的错吗?我可以用什么方式解决这个问题?



在外围设备上:

 新的BluetoothGattCharacteristic(
UUID .fromString(characteristic),
BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE,
BluetoothGattCharacteristic.PERMISSION_WRITE);

编辑:仅在Android> = 5.0.2



kitkat和android 5.0.1上从未发生过这种事吗?

解决方案

我通过在连续的BluetoothGatt读/写调用之间留出一秒的间隔来解决了这个问题。


I created a peripheral with a WRITE_TYPE_NO_RESPONSE characteristic. With another application, I wrote on characteristic, but I have an occasional problem with samsung galaxy nexus i9250 with lollipop 5.1.1: sometimes the function BluetoothGatt.writeCharacteristic returns false and the write is not done.

What could it be ? Can it be cyanogenmod's fault ? And in what way can I patch this problem ?

On peripherall :

new BluetoothGattCharacteristic(
                UUID.fromString(characteristic),
                BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE ,
                BluetoothGattCharacteristic.PERMISSION_WRITE);

EDIT : this problems happened only with android >= 5.0.2

Never happened on kitkat and on android 5.0.1 , is a casuality ?

解决方案

I resolved this issue by giving one second gap between to successive BluetoothGatt read/write calls.

这篇关于蓝牙Gatt writeCharacteristic返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆