# Enum NearbyError

java.lang.Object
java.lang.Enum<NearbyError>
com.codename1.nearby.NearbyError

All Implemented Interfaces:
  `Comparable<NearbyError>`

public enum NearbyError extends Enum<NearbyError>
Typed error codes carried by every `NearbyException` thrown through the failure path of the `com.codename1.nearby` APIs. Callers branch on these via `NearbyException.getError()` rather than string-matching a message.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `BUSY`
  A conflicting operation is already in progress -- for example a second association flow while the system chooser is open.
  `INVALID_TOKEN`
  The supplied token, accessory configuration, endpoint identifier or device filter could not be decoded or used, or came from a different platform.
  `IO_ERROR`
  Transport-level I/O failure while moving a payload.
  `NOT_SUPPORTED`
  The requested feature is not available on this port, this OS version or this hardware.
  `PEER_UNAVAILABLE`
  The peer, accessory or endpoint could not be reached, or moved out of range before the operation completed.
  `RADIO_UNAVAILABLE`
  The radio this feature needs is switched off or otherwise unavailable right now -- UWB disabled in settings, Bluetooth powered off, Wi-Fi off.
  `SESSION_FAILED`
  A ranging or transport session could not be started -- an invalid configuration, too many concurrent sessions, or a platform-level refusal.
  `SESSION_INVALIDATED`
  A running session was invalidated by the platform and cannot be resumed.
  `TIMEOUT`
  The platform never delivered a completion callback within the safety timeout, or a discovery/connection attempt timed out.
  `UNAUTHORIZED`
  A required runtime permission or OS authorization is missing.
  `UNKNOWN`
  Unclassified failure; the exception message carries the details.
  `USER_CANCELED`
  The user dismissed a system dialog (the device chooser, the association prompt, a permission request) or the operation was cancelled through `AsyncResource.cancel()`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static NearbyError`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static NearbyError[]`
  `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 NearbyError NOT_SUPPORTED
    The requested feature is not available on this port, this OS version or this hardware. The capability queries -- `isSupported()` on each entry point, plus the finer-grained `RangingCapabilities` -- let cross-platform code branch before ever seeing this code, and the inert fallback bridges fail every operation with it.

  - ### UNAUTHORIZED

    public static final NearbyError UNAUTHORIZED
    A required runtime permission or OS authorization is missing. On Android that is `UWB_RANGING`, the Bluetooth runtime grants or location; on iOS it is the Nearby Interaction or local network authorization the user declined. See the `requestPermissions` method on the relevant entry point.

  - ### RADIO_UNAVAILABLE

    public static final NearbyError RADIO_UNAVAILABLE
    The radio this feature needs is switched off or otherwise unavailable right now -- UWB disabled in settings, Bluetooth powered off, Wi-Fi off. Unlike `NOT_SUPPORTED` this is recoverable: the same call may succeed once the user turns the radio on.

  - ### PEER_UNAVAILABLE

    public static final NearbyError PEER_UNAVAILABLE
    The peer, accessory or endpoint could not be reached, or moved out of range before the operation completed.

  - ### SESSION_FAILED

    public static final NearbyError SESSION_FAILED
    A ranging or transport session could not be started -- an invalid configuration, too many concurrent sessions, or a platform-level refusal.

  - ### SESSION_INVALIDATED

    public static final NearbyError SESSION_INVALIDATED
    A running session was invalidated by the platform and cannot be resumed. Start a new one.

  - ### INVALID_TOKEN

    public static final NearbyError INVALID_TOKEN

    The supplied token, accessory configuration, endpoint identifier or device filter could not be decoded or used, or came from a different platform. Tokens are opaque and are not portable between iOS and Android.

    A device filter reports this rather than being dropped: an association request whose filter cannot be installed would otherwise offer the user every visible device instead of the ones asked for, and they could associate the wrong accessory from a picker that was never meant to show it.

  - ### TIMEOUT

    public static final NearbyError TIMEOUT
    The platform never delivered a completion callback within the safety timeout, or a discovery/connection attempt timed out.

  - ### BUSY

    public static final NearbyError BUSY
    A conflicting operation is already in progress -- for example a second association flow while the system chooser is open.

  - ### USER_CANCELED

    public static final NearbyError USER_CANCELED
    The user dismissed a system dialog (the device chooser, the association prompt, a permission request) or the operation was cancelled through `AsyncResource.cancel()`.

  - ### IO_ERROR

    public static final NearbyError IO_ERROR
    Transport-level I/O failure while moving a payload. Blocking stream payloads throw plain `java.io.IOException` instead.

  - ### UNKNOWN

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

- ## Method Details

  - ### values

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