# Enum BluetoothError

java.lang.Object
java.lang.Enum<BluetoothError>
com.codename1.bluetooth.BluetoothError

All Implemented Interfaces:
  `Comparable<BluetoothError>`

public enum BluetoothError extends Enum<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 Constants
  Enum Constant
  Description
  `ADVERTISE_FAILED`
  Advertising could not be started -- payload too large, too many concurrent advertisers, or hardware limitation.
  `BOND_FAILED`
  Bonding/pairing failed or was rejected by the remote device.
  `BUSY`
  Resource conflict -- e.g.
  `CONNECTION_FAILED`
  A connection attempt failed or timed out before it was established.
  `CONNECTION_LOST`
  An established link dropped unexpectedly.
  `GATT_ERROR`
  ATT-level failure reported by the remote GATT server.
  `IO_ERROR`
  Transport I/O failure on a non-stream operation.
  `NOT_CONNECTED`
  A GATT operation was attempted while the peripheral is not connected.
  `NOT_SUPPORTED`
  The requested feature is not available on this port or device.
  `POWERED_OFF`
  The adapter is powered off or otherwise unavailable.
  `SCAN_FAILED`
  The OS refused to start a scan or aborted a running one (throttling, too many concurrent scans, hardware error).
  `TIMEOUT`
  The platform never delivered a completion callback for an operation within the safety timeout.
  `UNAUTHORIZED`
  A required runtime permission or OS authorization is missing -- Android 12+ `BLUETOOTH_SCAN`/`BLUETOOTH_CONNECT`/`BLUETOOTH_ADVERTISE` runtime grants, location on older Android, or the iOS Bluetooth privacy authorization.
  `UNKNOWN`
  Unclassified failure; the exception message carries the details.
  `USER_CANCELED`
  The user dismissed a system dialog (enable request, pairing prompt, device chooser) or the operation was cancelled via `AsyncResource.cancel()`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BluetoothError`
  `valueOf(String name)`
  Returns 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`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### NOT_SUPPORTED

    public static final BluetoothError NOT_SUPPORTED
    The requested feature is not available on this port or device. Capability queries such as `Bluetooth.isLeSupported()` let cross-platform code branch before ever seeing this code; the no-op fallback base classes fail every operation with it.

  - ### POWERED_OFF

    public static final BluetoothError POWERED_OFF
    The adapter is powered off or otherwise unavailable. Ask the user to enable Bluetooth, optionally via `Bluetooth.requestEnable()`.

  - ### UNAUTHORIZED

    public static final BluetoothError UNAUTHORIZED
    A required runtime permission or OS authorization is missing -- Android 12+ `BLUETOOTH_SCAN`/`BLUETOOTH_CONNECT`/`BLUETOOTH_ADVERTISE` runtime grants, location on older Android, or the iOS Bluetooth privacy authorization. See `Bluetooth.requestPermissions(BluetoothPermission...)`.

  - ### SCAN_FAILED

    public static final BluetoothError SCAN_FAILED
    The OS refused to start a scan or aborted a running one (throttling, too many concurrent scans, hardware error).

  - ### ADVERTISE_FAILED

    public static final BluetoothError ADVERTISE_FAILED
    Advertising could not be started -- payload too large, too many concurrent advertisers, or hardware limitation.

  - ### CONNECTION_FAILED

    public static final BluetoothError CONNECTION_FAILED
    A connection attempt failed or timed out before it was established.

  - ### CONNECTION_LOST

    public static final BluetoothError 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

    public static final BluetoothError NOT_CONNECTED
    A GATT operation was attempted while the peripheral is not connected.

  - ### GATT_ERROR

    public static final BluetoothError GATT_ERROR
    ATT-level failure reported by the remote GATT server. `BluetoothException.getGattStatus()` carries the raw status code.

  - ### BOND_FAILED

    public static final BluetoothError BOND_FAILED
    Bonding/pairing failed or was rejected by the remote device.

  - ### TIMEOUT

    public static final BluetoothError 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

    public static final BluetoothError BUSY
    Resource conflict -- e.g. an RFCOMM channel is already in use or the adapter is busy with a conflicting operation.

  - ### IO_ERROR

    public static final BluetoothError IO_ERROR
    Transport I/O failure on a non-stream operation. Stream reads/writes on RFCOMM/L2CAP throw plain `java.io.IOException` instead.

  - ### USER_CANCELED

    public static final BluetoothError USER_CANCELED
    The user dismissed a system dialog (enable request, pairing prompt, device chooser) or the operation was cancelled via `AsyncResource.cancel()`.

  - ### UNKNOWN

    public static final BluetoothError UNKNOWN
    Unclassified failure; the exception message carries the details.

- ## Method Details

  - ### values

    public static BluetoothError[] 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

    public static BluetoothError valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null