-
public final class DittoBluetoothManagerOwns 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDittoBluetoothManager.Companion
-
Field Summary
Fields Modifier and Type Field Description private BooleanbleStartedByDittoprivate final Contextcontextprivate final DittoBluetoothLeConfigconfig
-
Constructor Summary
Constructors Constructor Description DittoBluetoothManager(Context context, DittoHandle dittoHandleWrapper, DittoBluetoothLeConfig config)
-
Method Summary
Modifier and Type Method Description final BooleangetBleStartedByDitto()final UnitsetBleStartedByDitto(Boolean bleStartedByDitto)final ContextgetContext()final DittoBluetoothLeConfiggetConfig()final Unitclose()final Unitstop()final Unitstart()final UnitrequestReset()If the BluetoothPlatform itself detects a condition that seems like the Android stack is faulty, it can request to nuke itself. final UnitreportDisabled()final UnitrefreshPermissions()-
-
Constructor Detail
-
DittoBluetoothManager
DittoBluetoothManager(Context context, DittoHandle dittoHandleWrapper, DittoBluetoothLeConfig config)
-
-
Method Detail
-
getBleStartedByDitto
final Boolean getBleStartedByDitto()
-
setBleStartedByDitto
final Unit setBleStartedByDitto(Boolean bleStartedByDitto)
-
getContext
final Context getContext()
-
getConfig
final DittoBluetoothLeConfig getConfig()
-
requestReset
final Unit 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.
-
reportDisabled
final Unit reportDisabled()
-
refreshPermissions
final Unit refreshPermissions()
-
-
-
-