Skip to main content

GattError

Sealed Class: GattError

Gatt Error. Called when BluetoothGatt onConnectionStateChange returns an error status, and delivered wrapped in BleError.GattError through BleListener.onError, after BleListener.onTerminalDisconnected.

Not every status listed below reaches your app as an error:

  • BleHciConnectionTimeout (8) and BleHciRemoteUserTerminatedConnection (19) are handled as a normal disconnection, for example when the terminal goes out of range: the SDK reports onTerminalDisconnected and no error.
  • GATTError (133) and GattFailure (257) are retried 3 times first, with BleListener.onReconnect called each time; only then is the error reported.

Parameters​

  • errorCode - Error code identifier
  • localizedDescription - Human-readable error description

Error Types​

BleHciConnectionTimeout​

object BleHciConnectionTimeout : GattError

Could not establish a connection in specified period. Maybe when distance for connect is so long or device is currently connected to something else

The SDK handles this status as a normal disconnection: it reports onTerminalDisconnected, not this error.

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 8
  • localizedDescription: BLE_HCI_CONNECTION_TIMEOUT

BleHciConnFailedToBeEstablished​

object BleHciConnFailedToBeEstablished : GattError

The BLE connection failed to be established. This could be due to a variety of reasons, such as the device being out of range, the device being turned off, or a problem with the BLE stack on either device

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 62
  • localizedDescription: BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED

BleHciConnIntervalUnacceptable​

object BleHciConnIntervalUnacceptable : GattError

The connection interval you requested is unacceptable to the BLE device

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 59
  • localizedDescription: BLE_HCI_CONN_INTERVAL_UNACCEPTABLE

BleHciConnTerminatedDueToMicFailure​

object BleHciConnTerminatedDueToMicFailure : GattError

The BLE connection was terminated because a packet failed its Message Integrity Check (MIC), the authentication tag of the encrypted link. This points to a problem with the link encryption, not to any audio hardware

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 61
  • localizedDescription: BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE

BleHciControllerBusy​

object BleHciControllerBusy : GattError

The BLE controller is busy and can't handle your request

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 58
  • localizedDescription: BLE_HCI_CONTROLLER_BUSY

BleHciDifferentTransactionCollision​

object BleHciDifferentTransactionCollision : GattError

A different BLE transaction collided with the current one

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 42
  • localizedDescription: BLE_HCI_DIFFERENT_TRANSACTION_COLLISION

BleHciDirectedAdvertiserTimeout​

object BleHciDirectedAdvertiserTimeout : GattError

The directed advertising procedure timed out before a connection could be established

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 60
  • localizedDescription: BLE_HCI_DIRECTED_ADVERTISER_TIMEOUT

BleHciInstantPassed​

object BleHciInstantPassed : GattError

The instant you specified has already passed

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 40
  • localizedDescription: BLE_HCI_INSTANT_PASSED

BleHciLocalHostTerminatedConnection​

object BleHciLocalHostTerminatedConnection : GattError

Your device terminated the BLE connection

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 22
  • localizedDescription: BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION

BleHciPairingWithUnitKeyUnsupported​

object BleHciPairingWithUnitKeyUnsupported : GattError

The BLE device doesn't support pairing with a unit key

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 41
  • localizedDescription: BLE_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED

BleHciRemoteDevTerminationDueToLowResources​

object BleHciRemoteDevTerminationDueToLowResources : GattError

The BLE device terminated the connection because it's low on resources

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 20
  • localizedDescription: BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES

BleHciRemoteDevTerminationDueToPowerOff​

object BleHciRemoteDevTerminationDueToPowerOff : GattError

The BLE device terminated the connection because it's powering off

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 21
  • localizedDescription: BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF

BleHciRemoteUserTerminatedConnection​

object BleHciRemoteUserTerminatedConnection : GattError

The user on the other end terminated the BLE connection

The SDK handles this status as a normal disconnection: it reports onTerminalDisconnected, not this error.

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 19
  • localizedDescription: BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION

BleHciStatusCodeCommandDisallowed​

object BleHciStatusCodeCommandDisallowed : GattError

The BLE device doesn't allow the command you're trying to send

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 12
  • localizedDescription: BLE_HCI_STATUS_CODE_COMMAND_DISALLOWED

BleHciStatusCodeInvalidBtleCommandParameters​

object BleHciStatusCodeInvalidBtleCommandParameters : GattError

The parameters you're using for the BLE command are invalid

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 18
  • localizedDescription: BLE_HCI_STATUS_CODE_INVALID_BTLE_COMMAND_PARAMETERS

BleHciStatusCodeInvalidLmpParameters​

object BleHciStatusCodeInvalidLmpParameters : GattError

The parameters for the Link Manager Protocol (LMP) are invalid

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 30
  • localizedDescription: BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS

BleHciStatusCodeLmpPduNotAllowed​

object BleHciStatusCodeLmpPduNotAllowed : GattError

The LMP Protocol Data Unit (PDU) isn't allowed

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 36
  • localizedDescription: BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED

BleHciStatusCodeLmpResponseTimeout​

object BleHciStatusCodeLmpResponseTimeout : GattError

The LMP response timed out

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 34
  • localizedDescription: BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT

BleHciStatusCodeUnspecifiedError​

object BleHciStatusCodeUnspecifiedError : GattError

An unspecified error occurred with the BLE connection

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 31
  • localizedDescription: BLE_HCI_STATUS_CODE_UNSPECIFIED_ERROR

BleHciUnsupportedRemoteFeature​

object BleHciUnsupportedRemoteFeature : GattError

The BLE device doesn't support a feature that your device needs

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 26
  • localizedDescription: BLE_HCI_UNSUPPORTED_REMOTE_FEATURE

Error​

class Error(status: Int) : GattError

GATT error did not recover

GattAuthFail​

object GattAuthFail : GattError

Authentication failed when attempting to connect to the BLE device. This could be due to an incorrect password or pairing key

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 137
  • localizedDescription: GATT_AUTH_FAIL

GATTBusy​

object GATTBusy : GattError

The BLE device is busy and cannot handle the request at this time. This could be due to the device processing other requests or performing other tasks

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 132
  • localizedDescription: GATT_BUSY

GattConnectionCongested​

object GattConnectionCongested : GattError

The BLE connection is congested. This could be due to too many devices being connected to the device or too much data being transferred

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 143
  • localizedDescription: GATT_CONNECTION_CONGESTED

GattConnectionTimeout​

object GattConnectionTimeout : GattError

The BLE connection timed out. This could be due to the device being out of range or the device being turned off

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 147
  • localizedDescription: GATT_CONNECTION_TIMEOUT

GATTDbFull​

object GATTDbFull : GattError

The BLE device's database is full. This could prevent the device from storing new data or updating existing data

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 131
  • localizedDescription: GATT_DB_FULL

GATTError​

object GATTError : GattError

A generic GATT error occurred. This is a catch-all error that could indicate a variety of problems

The SDK retries 3 times, calling onReconnect each time, before it reports this error.

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 133
  • localizedDescription: GATT_ERROR

GattFailure​

object GattFailure : GattError

A generic GATT failure occurred. This is a catch-all error that could indicate a variety of problems

The SDK retries 3 times, calling onReconnect each time, before it reports this error.

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 257
  • localizedDescription: GATT_FAILURE

GattIllegalParameter​

object GattIllegalParameter : GattError

An illegal parameter was passed to the GATT function. This could be due to an incorrect value being passed or a parameter being missing

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 135
  • localizedDescription: GATT_ILLEGAL_PARAMETER

GattInsufficientAuthentication​

object GattInsufficientAuthentication : GattError

Insufficient authentication for a given operation

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 5
  • localizedDescription: GATT_INSUFFICIENT_AUTHENTICATION

GattInsufficientEncryption​

object GattInsufficientEncryption : GattError

The connection to the BLE device isn't secure enough

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 15
  • localizedDescription: GATT_INSUFFICIENT_ENCRYPTION

GATTInternalError​

object GATTInternalError : GattError

An internal error occurred on the BLE device. This is a generic error that could indicate a variety of problems

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 129
  • localizedDescription: GATT_INTERNAL_ERROR

GattInvalidAttributeLength​

object GattInvalidAttributeLength : GattError

The data you're trying to send or receive is the wrong length

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 13
  • localizedDescription: GATT_INVALID_ATTRIBUTE_LENGTH

GattInvalidOffset​

object GattInvalidOffset : GattError

A read or write operation was requested with an invalid offset

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 7
  • localizedDescription: GATT_INVALID_OFFSET

GATTNoRessources​

object GATTNoRessources : GattError

The BLE device does not have enough resources to complete the request. This could be due to the device being low on memory or processing power

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 128
  • localizedDescription: GATT_NO_RESSOURCES

GattReadNotPermitted​

object GattReadNotPermitted : GattError

GATT read operation is not permitted

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 2
  • localizedDescription: GATT_READ_NOT_PERMITTED

GattRequestNotSupported​

object GattRequestNotSupported : GattError

The given request is not supported

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 6
  • localizedDescription: GATT_REQUEST_NOT_SUPPORTED

GattWriteNotPermitted​

object GattWriteNotPermitted : GattError

GATT write operation is not permitted

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 3
  • localizedDescription: GATT_WRITE_NOT_PERMITTED

GATTWrongState​

object GATTWrongState : GattError

The BLE device is in the wrong state to complete the request. This could be due to the device not being connected or not being in the correct mode

Properties

  • errorCode: Int
  • localizedDescription: String

Parameters

  • errorCode: 130
  • localizedDescription: GATT_WRONG_STATE

See Also​