orbital-systems / react-native-esp-idf-provisioning

ESP IDF provisioning and custom data library for react-native
MIT License
24 stars 5 forks source link

Reconnecting to a device that has been unpaired from Android bluetooth menu throws error on onCharacteristicWrite #48

Closed mateogianolio closed 7 months ago

mateogianolio commented 7 months ago

This is an edge-case bug, but I found out that if I

  1. Connect to a device
  2. Remove the device from Android bluetooth menu
  3. Reconnect to the device
  4. Try to scan wifi

I get error 133 on writing characteristic and immediately after I get disconnected from GATT with status code 19, which indicates that the device initiated the disconnection for some reason.

I found out that if I call disconnectDevice() in createESPDevice when the bond state of bluetoothDevice is BOND_NONE, this error does not occur anymore and scanning works again. Will fix in PR