readableAlwaysSuccess

open fun readableAlwaysSuccess(encrypted: Boolean = false, onRead: suspend LocalDescriptor.(ConnectedDevice, Int) -> ByteArray)

Makes this LocalDescriptor readable by a com.splendo.kaluga.bluetooth.ConnectedDevice to always return GattResponse.ReadSuccess Cannot be called if readable, or readableAlwaysSuccess has been called before

Parameters

encrypted

true if reading from the descriptor should be encrypted. This will result in LocalCharacteristic.Permission.READ_ENCRYPTION_REQUIRED. Otherwise will add LocalCharacteristic.Permission.READABLE

onRead

the function to call when reading from the descriptor. This contains the com.splendo.kaluga.bluetooth.ConnectedDevice and the offset of the data to read and should return the ByteArray being read.


open fun <T> readableAlwaysSuccess(encrypted: Boolean = false, serializationStrategy: SerializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat, onRead: suspend LocalDescriptor.(ConnectedDevice) -> T)

Makes this LocalDescriptor readable by a com.splendo.kaluga.bluetooth.ConnectedDevice to always return GattResponse.ReadSuccess Cannot be called if readable, or readableAlwaysSuccess has been called before

Parameters

encrypted

true if reading from the descriptor should be encrypted. This will result in LocalCharacteristic.Permission.READ_ENCRYPTION_REQUIRED. Otherwise will add LocalCharacteristic.Permission.READABLE

serializationStrategy

the SerializationStrategy to use to encode the T to a ByteArray

bluetoothFormat

the BluetoothFormat to use to encode the T to a ByteArray

onRead

the function to call when reading from the descriptor. This contains the com.splendo.kaluga.bluetooth.ConnectedDevice and the offset of the data to read and should return the ByteArray being read.

Type Parameters

T

the type of the data being read