write

abstract suspend fun write(data: ByteArray, writeType: WriteType = properties.defaultWriteType ?: WriteType.WITH_RESPONSE)

Writes the value of the characteristic.

Parameters

data

The data to be written.

writeType

The write type to be used. By default set to the characteristic's default write type based on its properties.

Throws

if the value was sent using Long Write or Reliable Write procedure and the value replied back by the peripheral does not match the value written.

if the operation failed.

if the characteristic has been invalidated due to disconnection of service change event.

if the implementation fails, see cause for a reason.