GattConnectionStateAction

Describes the action the BLE platform should take after receiving an android.bluetooth.BluetoothGattCallback.onConnectionStateChange event.

Extracted as a pure function so the decision matrix can be unit-tested without Android framework classes.

Inheritors

Types

Link copied to clipboard

GATT is transitioning to disconnected — log and wait.

Link copied to clipboard
data class CleanUpDisconnected(val wasError: Boolean, val status: Int, val isKnownGatt: Boolean) : GattConnectionStateAction

GATT is disconnected — clean up resources and call gatt.close().

Link copied to clipboard

An error occurred while connected or connecting — initiate disconnect.

Link copied to clipboard

A duplicate GATT appeared for the same address while connected — tear it down.

Link copied to clipboard

Event for an unknown GATT that isn't connected — ignore it.

Link copied to clipboard

GATT connected successfully — proceed with service discovery.