Connection State
Represents the various states of a Bluetooth Low Energy (BLE) connection.
This sealed class provides a type-safe way to handle different connection states during the BLE connection lifecycle. Each state represents a distinct phase in the connection process, from initial disconnection through to a fully operational connection.
Usage Example
when (connectionState) {
is ConnectionState.Disconnected -> handleDisconnected()
is ConnectionState.Connecting -> showConnectingIndicator()
is ConnectionState.Connected -> handleConnected()
is ConnectionState.DiscoveringServices -> showDiscoveringServices()
is ConnectionState.Ready -> enableOperations()
is ConnectionState.Error -> showError(connectionState.message)
}Content copied to clipboard
See also
Inheritors
Types
Link copied to clipboard
Represents a successfully established BLE connection.
Link copied to clipboard
Represents an ongoing connection attempt to a BLE device.
Link copied to clipboard
Represents a disconnected state where no BLE connection exists.
Link copied to clipboard
Represents the service discovery phase of the connection.
Link copied to clipboard
Represents an error state that occurred during the connection process.
Link copied to clipboard
Represents a fully operational BLE connection.