Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
sealed class BleClientOperation

Abstract sealed class representing a type of BLE operation

Link copied to clipboard
sealed class BleServerOperation

Abstract sealed class representing a type of BLE operation

Link copied to clipboard
data class CharacteristicRead(val device: BluetoothDevice, val characteristicUuid: UUID) : BleClientOperation

Read the value of a characteristic represented by characteristicUuid

Link copied to clipboard
data class CharacteristicWrite(val device: BluetoothDevice, val characteristicUuid: UUID, val writeType: Int, val payload: ByteArray) : BleClientOperation

Write payload as the value of a characteristic represented by characteristicUuid

Link copied to clipboard
class CommandQueue<T>(handler: Handler, callbacks: CommandQueueCallback<T>, operationTimeout: Long) : ConcurrentLinkedQueue<T>
Link copied to clipboard
abstract class CommandQueueCallback<T>
Link copied to clipboard
data class Connect(val device: BluetoothDevice, val context: Context) : BleClientOperation

Connect to device and perform service discovery

Link copied to clipboard
data class ConnectL2CapSocket(val device: BluetoothDevice, val psm: Int) : BleClientOperation
Link copied to clipboard
data class DescriptorRead(val device: BluetoothDevice, val descriptorUuid: UUID) : BleClientOperation

Read the value of a descriptor represented by descriptorUuid

Link copied to clipboard
data class DescriptorWrite(val device: BluetoothDevice, val descriptorUuid: UUID, val payload: ByteArray) : BleClientOperation

Write payload as the value of a descriptor represented by descriptorUuid

Link copied to clipboard
data class DisableNotifications(val device: BluetoothDevice, val characteristicUuid: UUID) : BleClientOperation

Disable notifications/indications on a characteristic represented by characteristicUuid

Link copied to clipboard

Disconnect from device and release all connection resources

Link copied to clipboard

Disconnect from device and release all connection resources

Link copied to clipboard
class DittoBluetoothManager(val context: Context, dittoHandleWrapper: DittoHandle, val config: DittoBluetoothLeConfig)

Owns the BluetoothPlatform and references to the Rust-based BLE Client and Server transports. Previously these were long-lived instances but sometimes the Android BLE stack gums up and stops reporting events properly until the app is restarted. The nuclear solution of dropping and recreating the BluetoothPlatform resolves this situation. At the expense of background support, this manager class will track disabled/enabled/background/foreground events and fully stop or start the platform accordingly.

Link copied to clipboard
data class EnableNotifications(val device: BluetoothDevice, val characteristicUuid: UUID) : BleClientOperation

Enable notifications/indications on a characteristic represented by characteristicUuid

Link copied to clipboard
data class MtuRequest(val device: BluetoothDevice, val mtu: Int) : BleClientOperation

Request for an MTU of mtu

Link copied to clipboard
data class NotifyCharacteristicChanged(val device: BluetoothDevice, val characteristic: BluetoothGattCharacteristic, val confirm: Boolean, val data: ByteArray) : BleServerOperation
Link copied to clipboard
Link copied to clipboard
data class StartAdvertisingSet(val adSetParams: AdvertisingSetParameters, val advertisingData: AdvertiseData, val scanResponse: AdvertiseData) : BleServerOperation
Link copied to clipboard
data class StartLegacyAdvertising(val adSettings: AdvertiseSettings, val advertisingData: AdvertiseData, val scanResponse: AdvertiseData) : BleServerOperation

Properties

Link copied to clipboard

UUID of the Client Characteristic Configuration Descriptor (0x2902).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val WRITE_DELAY_MS: Long = 5

Functions

Link copied to clipboard
fun <K, V> ConcurrentHashMap<K, V>.computeIfPresentCompat(key: K & Any, computation: (K, V) -> V?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Convenience extension function that returns true if this BluetoothGattDescriptor is a Client Characteristic Configuration Descriptor.

Link copied to clipboard
Link copied to clipboard

Android identifies remote devices by MAC address, whereas iOS uses a UUID. The cross-platform code uses 16-byte values to handle full-size UUIDs directly. On Android we expand a MAC address into 16 bytes.

Link copied to clipboard

Convert a ByteArray representing a MAC address into that MAC address string.

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