Delphi FMX BluetoothLE – Writing Characteristic unsuccessful


I’m writing an application targeting Android and iOS that communicates by BLE with Adafruit Bluefruit LE UART Friend using Nordic UART service and TxD/RxD characteristics.

TxGattCharact: TBluetoothGattCharacteristic;
SelectedDevice: TBluetoothLEDevice;

TxGattCharact.SetValueAsString(myString, True); // UTF8 required
if BluetoothLE1.WriteCharacteristic(SelectedDevice, TxGattCharact) then
… // everything just fine
Log(‘Writing Characteristic denied or unsuccessfull’);

I had to split my string into chunks of max 20 characters as BLE rule.
This is working 90% of the time
However, sometimes, WriteCharacteristic is not successfull

Is there a way to understand the reason and a possible action to prevent this?
Can I flush the BLE buffers to clean everything before sending another string?

Thank you in advance for your help

Comments are closed.