0

Which one is the actual confirmation callBack which tells that the data has been successfully delivered to the remote BLE Device from the Android Phone? onCharacteristicWrite() or onCharacteristicChanged() or something else. The data I am writing is with the BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE.

Raulp
  • 7,758
  • 20
  • 93
  • 155
  • onCharacteristicWrite() will be called on successful delivery. – Usman Rana Jul 06 '17 at 07:36
  • @UsmanRana I have seen instances that gettign this callback doesnt always means that the remote device has got the data at the Gatt Layer.I Have also read that these writeRequests gets Queued up in the Android BLE stack buffer and that when sends the data over the air to the remote device gets this call back invoked.Do you have any official stuff to prove your statement? – Raulp Jul 06 '17 at 07:40
  • onCharacteristicChanged() is called when you have enabled notification, so whenever any change is detected in characteristic it will be triggered. onCharacteristicWrite() is specifically called when you write packet on device and device responds for confirmation. Check docs: https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback.html – Usman Rana Jul 06 '17 at 07:43

1 Answers1

1

When you use BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE there is no confirmation of successful delivery at all. When you get the onCharacteristicWrite callback it only means the packet has been buffered and the Bluetooth stack has place to accept another packet.

Emil
  • 16,784
  • 2
  • 41
  • 52