public class BluetoothException

  1. Object
  2. Throwable
  3. Exception
  4. BluetoothException
Thrown via the failure path of every AsyncResource returned by the Bluetooth APIs. getError() returns a typed BluetoothError so callers can react without string-matching the message; for BluetoothError.GATT_ERROR failures getGattStatus() additionally exposes the raw ATT status code reported by the remote device.

Constructors

public BluetoothException(BluetoothError error)
public BluetoothException(BluetoothError error, String message)
public BluetoothException(BluetoothError error, String message, Throwable cause)
public BluetoothException(BluetoothError error, String message, int gattStatus)

Methods

public BluetoothError getError()Typed error code describing the failure.
public int getGattStatus()The raw ATT status code reported by the remote GATT server when getError() is BluetoothError.GATT_ERROR; -1 otherwise.

Inherited methods

Constructor details

BluetoothException

public BluetoothException(BluetoothError error)

BluetoothException

public BluetoothException(BluetoothError error, String message)

BluetoothException

public BluetoothException(BluetoothError error, String message, Throwable cause)

BluetoothException

public BluetoothException(BluetoothError error, String message, int gattStatus)

Method details

getError

public BluetoothError getError()
Typed error code describing the failure. Never null.

getGattStatus

public int getGattStatus()
The raw ATT status code reported by the remote GATT server when getError() is BluetoothError.GATT_ERROR; -1 otherwise.