write method
Writes a value to the specified characteristic.
When withResponse
is false, writing is done without waiting for an acknowledgement.
Use this in case client does not need an acknowledgement
that the write was successfully performed. For consequitive write operations it is
recommended to execute a write with withResponse
true each n times to make sure
the BLE device is still responsive.
The returned future completes with an error in case of a failure during writing.
Implementation
Future<void> write(List<int> value, {bool withResponse = true}) async {
_assertValidity();
if (withResponse) {
await _lib._connectedDeviceOperator.writeCharacteristicWithResponse(_ids, value: value);
} else {
await _lib._connectedDeviceOperator.writeCharacteristicWithoutResponse(_ids, value: value);
}
}