read

abstract suspend fun read(): ByteArray

Reads the value of the characteristic.

This method suspends until the value is read from the peripheral. Long Read procedure will be used automatically if the value is longer than the MTU.

Example

val value: ByteArray = remoteCharacteristic.read()

Return

The value of the characteristic.

Throws

if the operation failed.

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

if the implementation fails, see BluetoothException.cause for a reason.