Ble Connection Exception
class BleConnectionException(message: String, val gattStatus: Int? = null, val deviceAddress: String? = null) : BleException
Exception thrown when a BLE connection attempt fails or an existing connection is lost.
This exception is used for errors that occur during:
Initial connection establishment
Connection state changes
Unexpected disconnections
Common Causes
Device out of range
Device powered off
Too many connected devices
GATT server unavailable
Connection timeout
Usage Example
when (error) {
is BleConnectionException -> {
Log.e("BLE", "Connection failed to ${error.deviceAddress}")
error.gattStatus?.let { status ->
Log.e("BLE", "GATT status: $status")
}
}
}Content copied to clipboard