Skip to content

[Android] "Error, gatt is null" during nextCommand processing leaves callback unfulfilled #1291

Description

@polovi

Describe the bug
"Error, gatt is null" during nextCommand processing leaves callback unfulfilled. Whole commandQueue is cleared. There is no response back to react-native that some error happen during processing.

if (gatt == null) {
Log.d(BleManager.LOG_TAG, "Error, gatt is null");
commandQueue.clear();
commandQueueBusy = false;
return;
}

To Reproduce
Hard to reproduce, we have a device that for some reason sometimes ends up in a strange state and breaks bluetooth communication. If this error can happen, it should be handled better.

Expected behavior
Errors should be handled inside commands and properly reported back through their callback.

Version:

  • react-native-ble-manager version: 11.5.7

Additional context

2024-11-26 17:42:01.157 17752-17823 RNBleManager            com.rnapp                  D  Connect to: FB:83:98:81:E6:0D
2024-11-26 17:42:01.161 17752-17752 RNBleManager            com.rnapp                  I  DiscoverPeripheral: null
2024-11-26 17:42:01.213 17752-17752 RNBleManager            com.rnapp                  D  Is Or Greater than M $mBluetoothDevice
2024-11-26 17:42:01.238 17752-18853 RNBleManager            com.rnapp                  D  onConnectionStateChange to 2 on peripheral: FB:83:98:81:E6:0D with status 0
2024-11-26 17:42:01.249 17752-17752 RNBleManager            com.rnapp                  D  Peripheral event (BleManagerConnectPeripheral):FB:83:98:81:E6:0D
2024-11-26 17:42:01.249 17752-17752 RNBleManager            com.rnapp                  D  Connected to: FB:83:98:81:E6:0D
2024-11-26 17:42:01.453 17752-17765 RNBleManager            com.rnapp                  D  onConnectionStateChange to 0 on peripheral: FB:83:98:81:E6:0D with status 0
2024-11-26 17:42:01.504 17752-17752 RNBleManager            com.rnapp                  D  Peripheral event (BleManagerDisconnectPeripheral):FB:83:98:81:E6:0D
2024-11-26 17:42:02.596 17752-17823 RNBleManager            com.rnapp                  D  Retrieve services from: FB:83:98:81:E6:0D
2024-11-26 17:42:02.603 17752-17823 RNBleManager            com.rnapp                  D  Error, gatt is null

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions