Skip to content

Latest commit

 

History

History
92 lines (80 loc) · 7.71 KB

ErrorMapping.md

File metadata and controls

92 lines (80 loc) · 7.71 KB

Error mapping for react-native-ble-plx

Platform specific errors

On iOS there are two domains of errors, GATT domain and CB domain. GATT errors are defined by using standard code points specified in VOL 3,F,3.4.1.1. Core Bluetooth errors are platform specific. Android also uses ATT code points for GATT exceptions.

Available errors

RxAndroidBLE Reason RNBLEPLX
BleAlreadyConnectedException Tried to connect to already connected device ???
BleCannotSetCharacteristicNotificationException Unable to change notification value ???
BleCharacteristicNotFoundException Characteristic doesn't exists ???
BleConflictingNotificationAlreadySetException Already set indication or notification ???
BleDisconnectedException Disconnected/failed before connection ???
BleException Generic error ???
BleGattCannotStartException (+context) Couldn't start GATT operation ???
BleGattException (+context, +gattcode) GATT specific exception ???
:: CONNECTION_STATE When connection changes state ???
:: SERVICE_DISCOVERY During service discovery ???
:: CHARACTERISTIC_READ Reading characteristic ???
:: CHARACTERISTIC_WRITE Writing characteristic ???
:: CHARACTERISTIC_CHANGED Not used ??? ???
:: DESCRIPTOR_READ Reading descriptor ???
:: DESCRIPTOR_WRITE Writing descriptor ???
:: RELIABLE_WRITE_COMPLETED Reliably writing (what??) ???
:: READ_RSSI Reading RSSI ???
:: ON_MTU_CHANGED Mtu changed ???
BleScanException During scanning ???
:: BLUETOOTH_CANNOT_START Cannot start scanning for some reason ???
:: BLUETOOTH_DISABLED Bluetooth is disabled ???
:: BLUETOOTH_NOT_AVAILABLE Bluetooth not Available ???
:: LOCATION_PERMISSION_MISSING Missing location permission ???
:: LOCATION_SERVICES_DISABLED Location services disabled ???
:: UNKNOWN ??? ???
CoreBluetooth Reason RNBLEPLX
unknown ??? ???
invalidParameters The specified parameters are invalid. ???
invalidHandle The specified attribute handle is invalid. ???
notConnected The device is not currently connected. ???
outOfSpace The device has run out of space to complete operation. ???
operationCancelled The operation is canceled. ???
connectionTimeout The connection timed out ???
peripheralDisconnected The peripheral disconnected. ???
uuidNotAllowed The specified UUID is not permitted. ???
alreadyAdvertising The peripheral is already advertising. (peripheral mode?) ???
connectionFailed The connection failed. ???
connectionLimitReached The device already has the maximum number of connections. ???
maxConnection The device already has the maximum number of connections. ???
gattErrors (look above) GATT specific errors VOL 3,F,3.4.1.1 ???
RxBluetoothKit Reason RNBLEPLX
bluetoothUnsupported Bluetooth unsupported ???
bluetoothUnauthorized Bluetooth unauthorized ???
bluetoothPoweredOff Bluetooth powered off ???
bluetoothInUnknownState Bluetooth in unknown state ???
bluetoothResetting Bluetooth resetting ???
peripheralConnectionFailed(Peripheral, Error?) Peripheral connection failed ???
peripheralDisconnected(Peripheral, Error?) Peripheral disconnected ???
peripheralDisconnected(Peripheral, Error?) Peripheral disconnected ???
peripheralRSSIReadFailed(Peripheral, Error?) After RSSI read ???
servicesDiscoveryFailed(Peripheral, Error?) Services failed ???
includedServicesDiscoveryFailed(Peripheral, Error?) Fixme: Should be service? ???
characteristicsDiscoveryFailed(Service, Error?) Characteristic discovery ???
characteristicWriteFailed(Characteristic, Error?) Characteristic write ???
characteristicReadFailed(Characteristic, Error?) Chracteristic read ???
characteristicNotifyChangeFailed(Characteristic, Error?) Notify change ???
descriptorsDiscoveryFailed(Characteristic, Error?) Descriptor discovery ???
descriptorWriteFailed(Descriptor, Error?) Descriptor write ???
descriptorReadFailed(Descriptor, Error?) Descriptor read ???

Potential fixes:

Android

  • BleDisconnectedException - add mac address?
  • BleGattException - add context as peripheral/characteristic/etc...

iOS:

  • servicesDiscoveryFailed - add services parameter
  • includedServicesDiscoveryFailed - should have service instead of peripheral

react-native-ble-plx Error structure:

To be decided