Enum BluetoothError
- All Implemented Interfaces:
Comparable<BluetoothError>
Typed error codes carried by every
BluetoothException fired through the
failure path of the asynchronous Bluetooth APIs. Callers branch on these
via BluetoothException.getError() instead of string-matching messages.-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAdvertising could not be started -- payload too large, too many concurrent advertisers, or hardware limitation.Bonding/pairing failed or was rejected by the remote device.Resource conflict -- e.g.A connection attempt failed or timed out before it was established.An established link dropped unexpectedly.ATT-level failure reported by the remote GATT server.Transport I/O failure on a non-stream operation.A GATT operation was attempted while the peripheral is not connected.The requested feature is not available on this port or device.The adapter is powered off or otherwise unavailable.The OS refused to start a scan or aborted a running one (throttling, too many concurrent scans, hardware error).The platform never delivered a completion callback for an operation within the safety timeout.A required runtime permission or OS authorization is missing -- Android 12+BLUETOOTH_SCAN/BLUETOOTH_CONNECT/BLUETOOTH_ADVERTISEruntime grants, location on older Android, or the iOS Bluetooth privacy authorization.Unclassified failure; the exception message carries the details.The user dismissed a system dialog (enable request, pairing prompt, device chooser) or the operation was cancelled viaAsyncResource.cancel(). -
Method Summary
Modifier and TypeMethodDescriptionstatic BluetoothErrorReturns the enum constant of this type with the specified name.static BluetoothError[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
NOT_SUPPORTED
The requested feature is not available on this port or device. Capability queries such asBluetooth.isLeSupported()let cross-platform code branch before ever seeing this code; the no-op fallback base classes fail every operation with it. -
POWERED_OFF
The adapter is powered off or otherwise unavailable. Ask the user to enable Bluetooth, optionally viaBluetooth.requestEnable(). -
UNAUTHORIZED
A required runtime permission or OS authorization is missing -- Android 12+BLUETOOTH_SCAN/BLUETOOTH_CONNECT/BLUETOOTH_ADVERTISEruntime grants, location on older Android, or the iOS Bluetooth privacy authorization. SeeBluetooth.requestPermissions(BluetoothPermission...). -
SCAN_FAILED
The OS refused to start a scan or aborted a running one (throttling, too many concurrent scans, hardware error). -
ADVERTISE_FAILED
Advertising could not be started -- payload too large, too many concurrent advertisers, or hardware limitation. -
CONNECTION_FAILED
A connection attempt failed or timed out before it was established. -
CONNECTION_LOST
An established link dropped unexpectedly. Delivered as the reason of the disconnection event and used to fail operations that were in-flight when the link died. -
NOT_CONNECTED
A GATT operation was attempted while the peripheral is not connected. -
GATT_ERROR
ATT-level failure reported by the remote GATT server.BluetoothException.getGattStatus()carries the raw status code. -
BOND_FAILED
Bonding/pairing failed or was rejected by the remote device. -
TIMEOUT
The platform never delivered a completion callback for an operation within the safety timeout. The internal per-peripheral operation queue fails the operation with this code and moves on rather than wedging. -
BUSY
Resource conflict -- e.g. an RFCOMM channel is already in use or the adapter is busy with a conflicting operation. -
IO_ERROR
Transport I/O failure on a non-stream operation. Stream reads/writes on RFCOMM/L2CAP throw plainjava.io.IOExceptioninstead. -
USER_CANCELED
The user dismissed a system dialog (enable request, pairing prompt, device chooser) or the operation was cancelled viaAsyncResource.cancel(). -
UNKNOWN
Unclassified failure; the exception message carries the details.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-