1

I am developing in BLE for Android , I have a question about onCharacteristicWrite.

I know the onCharacteristicWrite will be call and return the status when write value to remote BLE device.

When the onCharacteristicWrite return status is 0 after Gatt.writeCharacteristic, it means write success.

Question:

How the onCharacteristicWrite know the return status is 0 ?? Does remote BLE device will send ACK to Android ??

Wun
  • 6,211
  • 11
  • 56
  • 101

2 Answers2

1

Yes, the BLE device will send successful write acknowledgement. It is part of the low level Bluetooth Low Energy Specification.

Rob Gorman
  • 3,502
  • 5
  • 28
  • 45
1

From what I can tell, it assumes that if no error was received, it was sent successfully. So to answer your question, it doesn't know.

The reason I know this is because I have received GATT_SUCCESS several times in succession in onCharacteristicWrite to a device that was physically powered off and thus, couldn't possibly have received the data that was sent.

tayoung
  • 411
  • 1
  • 4
  • 16
  • The characteristic may have write acknowledgements disabled. So yes, in this case the sender doesn't know and assumes success. But with write acknowledgements enabled the sender is notified about reception and knows whether write was successful or not. – grzegorz Oct 15 '16 at 09:29