简体   繁体   中英

Android BLE Gatt Characteristic WRITE_TYPE_NO_RESPONSE not working

I have developed an Android app that connects to a CC2540 BLE peripheral.

When I do a Characteristic write of type no response (WRITE_TYPE_NO_RESPONSE), I still get the callback onCharacteristicWrite at the app level. Is this behavior correct?

I understand there is probably a low level acknowledgement that occurs between the Android device and the peripheral.

But the reason I am asking is because this is causing an issue where I can only send a write once I have received this callback, which is slowing things down in the app.

Any light on this behavior would be appreciated it.

Thanks,

I did run into the same problem when I was trying to do some performance testing and found that when I used the WRITE_TYPE_DEFAULT specifically I stopped getting a response. There might be a bug with the android constants that is causing inverse behavior, but I am not quite not sure.

you can only make 1 transfer at a time on the low level so you need a callback to tell when the stack is ready to send another command. If you try to send several after each other without waiting for the air-interface to be ready you can seriously crash the BLE stack! This was happening a lot on earlier iOS CoreBluetooth. If one app crashes the BLE Stack then the phone need a reset or Bluetooth must be turned off and on again to reset the stack. The callback just tells you that the stack has send a request over the air-interface, not that it was acknowledged by the recipient. For that you would use the other api which will make the BLE Stack re-transmit several times (depending on how the connection parameters has been negotiated).

It's stated clearly in the BLE specification that only 1 transfer can be made at a time.

If you just bang the API with write requ

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM