Package-level declarations

Types

Link copied to clipboard
data class AdvertiseData(val localName: String?, val serviceUUIDs: List<UUID>)

Data advertised by a BluetoothServer

Link copied to clipboard

Identity of a local Bluetooth attribute (service, characteristic or descriptor), used to correlate a registered action with the matching incoming platform callback.

Link copied to clipboard

Builder class for creating a BluetoothServer.

Link copied to clipboard

A Bluetooth Server that makes the Hardware advertise AdvertiseData and exposes LocalService to connect to.

Link copied to clipboard
Link copied to clipboard
value class CBCharacteristicIdentity(val characteristic: CBCharacteristic) : AttributeIdentity
Link copied to clipboard
value class CBServiceIdentity(val service: CBService) : AttributeIdentity
Link copied to clipboard
actual interface ConnectedDevice : Device

A Device that connected to a BluetoothServer

actual interface ConnectedDevice : Device

A Device that connected to a BluetoothServer

expect interface ConnectedDevice : Device

A Device that connected to a BluetoothServer

Link copied to clipboard
class DefaultBluetoothServer : BluetoothServer, CoroutineScope

The default implementation of BluetoothServer. It makes the Hardware advertise AdvertiseData and exposes LocalService to connect to.

Link copied to clipboard

The default ConnectedDevice, wrapping the platform BluetoothDevice.

class DefaultConnectedDevice(val cbCentral: CBCentral) : ConnectedDevice

The default ConnectedDevice, wrapping the platform CBCentral.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Accessor to the platform level Local Bluetooth characteristic.

Accessor to the platform level Local Bluetooth characteristic.

Accessor to the platform level Local Bluetooth characteristic.

Link copied to clipboard
class LocalDescriptor(val wrapper: LocalDescriptorWrapper, val characteristic: LocalCharacteristic) : Descriptor

A Descriptor available from a BluetoothServer

Link copied to clipboard
actual interface LocalDescriptorWrapper

Accessor to the platform level Local Bluetooth descriptor.

actual interface LocalDescriptorWrapper

Accessor to the platform level Local Bluetooth descriptor.

expect interface LocalDescriptorWrapper

Accessor to the platform level Local Bluetooth descriptor.

Link copied to clipboard

A Service available from a BluetoothServer

Link copied to clipboard
actual interface LocalServiceWrapper

Accessor to the platform level Local Bluetooth service.

actual interface LocalServiceWrapper

Accessor to the platform level Local Bluetooth service.

expect interface LocalServiceWrapper

Accessor to the platform level Local Bluetooth service.

Link copied to clipboard

Creates the platform LocalServiceWrappers, LocalCharacteristicWrappers and LocalDescriptorWrappers for a LocalService graph. Injected into the DSL so tests can supply wrappers that don't require a live Bluetooth stack.

Link copied to clipboard
data class ServerSettings(val permissions: Permissions, val autoRequestPermission: Boolean = true, val autoEnableBluetooth: Boolean = true, val logger: Logger = RestrictedLogger(RestrictedLogLevel.None))

Settings for configuring a BluetoothServer

Link copied to clipboard

Functions

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

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
fun LocalCharacteristic.DSL.NotificationDSL<ByteArray>.triggerNotification(properties: Set<CharacteristicProperty.Notifiable> = setOf(CharacteristicProperty.Notify), encrypted: Boolean = false)

Makes this LocalCharacteristic a LocalCharacteristic.Notifiable and automatically sends the ByteArray as a notification This method can only be called once.

inline fun <Trigger> LocalCharacteristic.DSL.NotificationDSL<Trigger>.triggerNotification(properties: Set<CharacteristicProperty.Notifiable> = setOf(CharacteristicProperty.Notify), encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat)

Makes this LocalCharacteristic a LocalCharacteristic.Notifiable and automatically sends a ByteArray notification upon Trigger This method can only be called once.

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

inline fun <T : Any> LocalCharacteristic.DSL.writable(properties: Set<CharacteristicProperty.Writable> = setOf(CharacteristicProperty.Write), encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat, noinline onFailedToWrite: suspend LocalCharacteristic.(ConnectedDevice, Exception) -> GattResponse.WriteResponse = { _, _ -> GattResponse.ApplicationError(0x80) }, noinline onWrite: suspend LocalCharacteristic.(ConnectedDevice, T) -> GattResponse.WriteResponse)

Makes this LocalCharacteristic 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.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

inline fun <T : Any> LocalCharacteristic.DSL.writableAlwaysSuccess(properties: Set<CharacteristicProperty.Writable> = setOf(CharacteristicProperty.Write), encrypted: Boolean = false, bluetoothFormat: BluetoothFormat = BluetoothFormat, noinline onWrite: suspend LocalCharacteristic.(ConnectedDevice, T) -> Unit)

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