readableAlwaysSuccess

inline fun <T : Any> LocalCharacteristic.DSL.readableAlwaysSuccess(encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat, noinline onRead: suspend LocalCharacteristic.(ConnectedDevice) -> T)

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

Parameters

encrypted

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

bluetoothFormat

the BluetoothFormat to use to encode the T to a ByteArray

onRead

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

Type Parameters

T

the type of the data being read


inline fun <T : Any> LocalDescriptor.DSL.readableAlwaysSuccess(encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat, noinline 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 LocalDescriptor.DSL.readable, or LocalDescriptor.DSL.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

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