DittoBluetoothManager

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.

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun close()
Link copied to clipboard
fun refreshPermissions()
Link copied to clipboard
fun reportDisabled()
Link copied to clipboard
fun requestReset()

If the BluetoothPlatform itself detects a condition that seems like the Android stack is faulty, it can request to nuke itself. Give it one second to "cool off" - it seems that starting immediately after stopping does not always work because there is some async work occurring internally.

Link copied to clipboard
fun start()
Link copied to clipboard
fun stop()

Properties

Link copied to clipboard
var bleStartedByDitto: Boolean = false
Link copied to clipboard
val config: DittoBluetoothLeConfig
Link copied to clipboard
val context: Context