write

abstract suspend fun write(characteristic: Characteristic, data: ByteArray, writeType: WriteType = WithoutResponse)

Writes data to characteristic.

If characteristic was created via characteristicOf then the first found characteristic with a property matching the specified writeType and matching the service UUID and characteristic UUID in the GATT profile will be used. If multiple characteristics with the same UUID and properties exist in the GATT profile, then a discovered characteristic from services should be used instead.

Throws

if invoked without an established connection.


abstract suspend fun write(descriptor: Descriptor, data: ByteArray)

Writes data to descriptor.

If descriptor was created via descriptorOf then the first found descriptor (matching the service UUID, characteristic UUID and descriptor UUID) in the GATT profile will be used. If multiple descriptors with the same UUID exist in the GATT profile, then a discovered descriptor from services should be used instead.

Throws

if invoked without an established connection.