DSL

Functions

Link copied to clipboard
abstract fun readable(encrypted: Boolean = false, onRead: suspend LocalDescriptor.(ConnectedDevice, Int) -> GattResponse.ReadResponse)

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

Link copied to clipboard
open fun readableAlwaysSuccess(encrypted: Boolean = false, onRead: suspend LocalDescriptor.(ConnectedDevice, Int) -> ByteArray)
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

Link copied to clipboard
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

Link copied to clipboard
abstract fun writable(encrypted: Boolean = false, onWrite: suspend LocalDescriptor.(ConnectedDevice, ByteArray, Int) -> GattResponse.WriteResponse)
open fun <T> writable(encrypted: Boolean = false, deserializationStrategy: DeserializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat, onFailedToWrite: suspend LocalDescriptor.(ConnectedDevice, Exception) -> GattResponse.WriteResponse = { _, _ -> GattResponse.ApplicationError(0x80) }, onWrite: suspend LocalDescriptor.(ConnectedDevice, T) -> GattResponse.WriteResponse)

Makes this LocalDescriptor writable by a com.splendo.kaluga.bluetooth.ConnectedDevice Cannot be called if writable has been called before

Link copied to clipboard
inline fun <T : Any> LocalDescriptor.DSL.writable(encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat, noinline onFailedToWrite: suspend LocalDescriptor.(ConnectedDevice, Exception) -> GattResponse.WriteResponse = { _, _ -> GattResponse.ApplicationError(0x80) }, noinline onWrite: suspend LocalDescriptor.(ConnectedDevice, T) -> GattResponse.WriteResponse)

Makes this LocalDescriptor writable by a com.splendo.kaluga.bluetooth.ConnectedDevice Cannot be called if LocalDescriptor.DSL.writable or LocalDescriptor.DSL.writableAlwaysSuccess has been called before

Link copied to clipboard
open fun writableAlwaysSuccess(encrypted: Boolean = false, onWrite: suspend LocalDescriptor.(ConnectedDevice, ByteArray, Int) -> Unit)
open fun <T> writableAlwaysSuccess(encrypted: Boolean = false, deserializationStrategy: DeserializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat, onWrite: suspend LocalDescriptor.(ConnectedDevice, T) -> Unit)

Makes this LocalDescriptor writable by a com.splendo.kaluga.bluetooth.ConnectedDevice and always responds with GattResponse.WriteSuccess Cannot be called if writable or writableAlwaysSuccess has been called before

Link copied to clipboard
inline fun <T : Any> LocalDescriptor.DSL.writableAlwaysSuccess(encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat, noinline onWrite: suspend LocalDescriptor.(ConnectedDevice, T) -> Unit)

Makes this LocalDescriptor writable by a com.splendo.kaluga.bluetooth.ConnectedDevice and always responds with GattResponse.WriteSuccess Cannot be called if LocalDescriptor.DSL.writable or LocalDescriptor.DSL.writableAlwaysSuccess has been called before