Android API 18 ble writeCharacteristic无法正常工作

pro*_*sed 5 bluetooth-lowenergy gatt android-4.3-jelly-bean

我正在使用android 4.3的新ble API。我可以从我的LE设备进行扫描,连接,发现特征等。

在读取特性值的情况下,对于某些特性,我得到响应,而对于另一些特性,我没有响应。//猜测是设备故障

问题出在写操作上。该器件具有2个具有写入特性的特性。当我尝试编写它们时,随机出现2种情况-

  1. 不会调用onWriteCharacteristic,并且不会更改设备的值。
  2. onWriteCharacteristic被称为与成功地位尽管WriteType设置为事实WRITE_TYPE_NO_RESPONSE,但仍然没有值的变化。

某些非4.3应用程序已成功更改特征值。所以我想这不是设备故障。

任何见识或帮助将不胜感激。

编辑1: 当我尝试将特征写入设备时,这是日志的摘要。

08-26 10:59:49.181: D/BluetoothGatt(13516): writeCharacteristic() - uuid: 00002a06-0000-1000-8000-00805f9b34fb
08-26 10:59:49.181: D/BtGatt.GattService(1082): writeCharacteristic() - address=CC:AB:96:49:4C:9F
08-26 10:59:49.181: D/BtGatt.btif(1082): btif_gattc_write_char
08-26 10:59:49.181: D/BtGatt.btif(1082): btgattc_handle_event: Event 1015
08-26 10:59:49.181: D/BtGatt.btif(1082): btif_gattc_upstreams_evt: Event 4
08-26 10:59:49.181: D/BtGatt.GattService(1082): onWriteCharacteristic() - address=CC:AB:96:49:4C:9F, status=0
08-26 10:59:49.181: I/MainActivity(13516): Writing characteristic Initiated for Alert Level:true
08-26 10:59:49.191: D/BluetoothGatt(13516): onCharacteristicWrite() - Device=CC:AB:96:49:4C:9F UUID=00002a06-0000-1000-8000-00805f9b34fb Status=0
08-26 10:59:49.191: I/MainActivity#onWrite(13516): Immediate Alert Service characteristic - Alert Level value in string:  value in hex: 02
Run Code Online (Sandbox Code Playgroud)

WriteType设置为WRITE_TYPE_NO_RESPONSE,但是我仍然收到onWriteCharacteristic调用,但是该值未更改为设备。

有人可以帮忙吗?

编辑2: 我正在使用nexus-4测试该应用程序,但与此手机仍然存在相同的问题,但是嘿,代码在Samsung S4上工作正常,并且能够在LE设备上写入特征值。那么Nexus-4是否有问题?但是 这里的这个人说他能够使用Nexus-4进行书写