Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash - exception could not be delivered #819

Open
1 task
pmagnuson opened this issue Nov 11, 2023 · 2 comments
Open
1 task

App crash - exception could not be delivered #819

pmagnuson opened this issue Nov 11, 2023 · 2 comments

Comments

@pmagnuson
Copy link

Describe the bug
When the Bluetooth device disconnects, the Bluetooth stack has an undeliverable exception and the app crashes.

To Reproduce
So far, this has only happened on Android, not on iOS.

Steps to reproduce the behavior:

  1. Connect to one device using connectTo()
  2. Write to a protected characteristic
  3. Read a characteristic which reports the bonding status
  4. Once bonding is complete, write app specific commands and setup notify streams on 2 characteristics
  5. The device does a Bluetooth disconnect and 5-10 seconds later starts advertising again.
  6. 10-20% of the time flutter_reactive_ble will encounter the exception and the library will crash.
  7. 80-90% of the time the device starts advertising again and the app successfully scans for the device. Repeat from step 1.

Expected behavior
The Bluetooth library should not crash and cause the app to crash.

  • I tried doing the same with a general BLE scanner application (e.g. nRF Connect) and it exhibits the expected behavior as described above

Smartphone / tablet

  • Device: Google Pixel 5a
  • OS: Android 13 SDK 33
  • Package version: 5.0.2

Also on

  • Device: Samsung Galaxy S22
  • OS: Android 12
  • Package version: 5.0.2

Peripheral device

  • Vendor, model: CUSTOM
  • Does it run a custom firmware / software: yes
  • Device runs Zephyr OS and uses the Zephyr/Nordic Bluetooth libraries

Additional context
In the following logs, lines with [log] are from the application.

successful connection

I/flutter (30524): REACTIVE_BLE: Received ScanResult(result: Result<DiscoveredDevice, GenericFailure<ScanFailure>?>.success(DiscoveredDevice(id: 52:A6:D4:89:11:96, name: DharmaDr, serviceData: {}, serviceUuids: [0eaa6289-88f3-4817-985e-f0b869ad5e05], manufacturerData: [], rssi: -64, connectable: Connectable.available)))
[log] FINER: 14:43:53:777: TabProvider: new Device 52:A6:D4:89:11:96 DharmaDr
I/flutter (30524): REACTIVE_BLE: Received ScanResult(result: Result<DiscoveredDevice, GenericFailure<ScanFailure>?>.success(DiscoveredDevice(id: 52:A6:D4:89:11:96, name: DharmaDr, serviceData: {}, serviceUuids: [0eaa6289-88f3-4817-985e-f0b869ad5e05], manufacturerData: [], rssi: -69, connectable: Connectable.available)))
[log] FINER: 14:43:53:780: TabProvider: leftConnectDevice 52:A6:D4:89:11:96
[log] FINER: 14:43:53:782: TabProvider: new Device 52:A6:D4:89:11:96 DharmaDr
I/flutter (30524): REACTIVE_BLE: Connect to device: 52:A6:D4:89:11:96, servicesWithCharacteristicsToDiscover: null, timeout: 0:00:01.500000
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connecting, failure: null)
[log] FINER: 14:43:54:344: TabProvider: leftConnectDevice 52:A6:D4:89:11:96 connecting null
D/BluetoothGatt(30524): connect() - device: 52:A6:D4:89:11:96, auto: false
D/BluetoothGatt(30524): registerApp()
D/BluetoothGatt(30524): registerApp() - UUID=8893b941-7ead-4497-bf04-2f86ec9907bd
D/BluetoothGatt(30524): onClientRegistered() - status=0 clientIf=7
[log] FINER: 14:43:54:409: TabProvider: new Device 52:A6:D4:89:11:96 DharmaDr
I/flutter (30524): REACTIVE_BLE: Received ScanResult(result: Result<DiscoveredDevice, GenericFailure<ScanFailure>?>.success(DiscoveredDevice(id: 52:A6:D4:89:11:96, name: DharmaDr, serviceData: {}, serviceUuids: [0eaa6289-88f3-4817-985e-f0b869ad5e05], manufacturerData: [], rssi: -65, connectable: Connectable.available)))
D/BluetoothGatt(30524): onClientConnectionState() - status=0 clientIf=7 device=52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connected, failure: null)
[log] FINER: 14:43:54:855: TabProvider: leftConnectDevice 52:A6:D4:89:11:96 connected null
[log] FINER: 14:43:54:856: AppBle: writeSecureMode
[log] FINEST: 14:43:54:858: AppBle: writeCommandWithResponse 52:A6:D4:89:11:96 0eaa6289 0eaa6294 [254]
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
D/BluetoothGatt(30524): discoverServices() - device: 52:A6:D4:89:11:96
D/BluetoothGatt(30524): onSearchComplete() = Device=52:A6:D4:89:11:96 Status=0
I/flutter (30524): REACTIVE_BLE: Write with response to CharacteristicInstance(characteristicId: 0eaa6294-88f3-4817-985e-f0b869ad5e05(34), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), value: [254]
I/flutter (30524): REACTIVE_BLE: Read characteristic: CharacteristicInstance(characteristicId: 0eaa6294-88f3-4817-985e-f0b869ad5e05(34), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
D/BluetoothGatt(30524): onPhyUpdate() - status=0 address=52:A6:D4:89:11:96 txPhy=2 rxPhy=2
[log] FINER: 14:43:57:800: TabProvider: app inactive lockScreen: false inLocalMode true
[log] FINER: 14:43:59:008: TabProvider: app inactive lockScreen: false inLocalMode true
[log] FINER: 14:43:59:009: TabProvider: app resumed lockRestart false
D/BluetoothGatt(30524): onConnectionUpdated() - Device=52:A6:D4:89:11:96 interval=24 latency=0 timeout=42 status=0
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6294-88f3-4817-985e-f0b869ad5e05(34), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
[log] FINEST: 14:44:00:128: TabProvider: 0 bondValue: 2
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
[log] FINER: 14:44:00:130: AppBle: appMode
[log] FINEST: 14:44:00:131: AppBle: writeCommandWithResponse 52:A6:D4:89:11:96 0eaa6289 0eaa628a [1]
[log] FINEST: 14:44:00:132: DatabaseService: logUserEvent {user: BHkbEDVsZgVnmTujuz6xkhNSrvX2, time: 2023-11-11 22:44:00.132185Z, event: tabConnect, params: null}
[log] FINER: 14:44:00:152: TabUIState: build mode: HomeScreenMode.localOnly connected: true chatID:
[log] FINE: 14:44:00:159: MenuScreen: build leftIsConnected true
[log] FINER: 14:44:00:235: BatteryStatus: connected: true levels: [100, 100]
[log] FINER: 14:44:00:253: BatteryStatus: connected: true levels: [100, 100]
[log] FINER: 14:44:00:257: SliderControl: currentValue: 5.0
[log] FINER: 14:44:00:266: SliderControl: currentValue: 5.0
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Start subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa628e-88f3-4817-985e-f0b869ad5e05(37), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Write with response to CharacteristicInstance(characteristicId: 0eaa628a-88f3-4817-985e-f0b869ad5e05(20), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), value: [1]
I/flutter (30524): REACTIVE_BLE: Start subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa6290-88f3-4817-985e-f0b869ad5e05(40), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Read characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Read characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa628e-88f3-4817-985e-f0b869ad5e05 enable: true
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa6290-88f3-4817-985e-f0b869ad5e05 enable: true
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
[log] FINER: 14:44:01:050: TabUpdateListTile: FW version L:v0.809, Nov 2, 2023
      R:v0.809, Nov 2, 2023
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
[log] FINEST: 14:44:01:259: DatabaseService: getLatestFWDescriptor {hw_filename: v0.808/tabhw_v0.808_oct26_app_update.bin, version: v0.808, dk_filename: v0.808/dk_v0.808_oct26_app_update.bin}
[log] FINER: 14:44:01:269: TabUpdateListTile: tabFW: L:v0.809, Nov 2, 2023 R:v0.809, Nov 2, 2023 newFW: v0.808
[log] FINER: 14:44:01:281: TabUpdateListTile: leftVersion: 0.809 rightVersion: 0.809 newFW: 0.808 forceFW:
D/BluetoothGatt(30524): onClientConnectionState() - status=8 clientIf=7 device=52:A6:D4:89:11:96
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa628e-88f3-4817-985e-f0b869ad5e05 enable: false

successful disconnect & reconnect

I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
[log] FINER: 14:44:11:251: TabProvider: leftConnectDevice 52:A6:D4:89:11:96 disconnected ConnectionError.failedToConnect
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Disconnect device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Stop subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa628e-88f3-4817-985e-f0b869ad5e05(37), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Stop subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa6290-88f3-4817-985e-f0b869ad5e05(40), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
[log] FINEST: 14:44:11:253: DatabaseService: logUserEvent {user: BHkbEDVsZgVnmTujuz6xkhNSrvX2, time: 2023-11-11 22:44:11.253233Z, event: tabDisconnect, params: null}
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: null)
[log] FINER: 14:44:11:296: TabUIState: build mode: HomeScreenMode.localOnly connected: false chatID:
[log] FINE: 14:44:11:298: MenuScreen: build leftIsConnected false
[log] FINER: 14:44:11:325: BatteryStatus: connected: false levels: [100, 100]
[log] FINER: 14:44:11:330: BatteryStatus: connected: false levels: [100, 100]
[log] FINER: 14:44:11:331: SliderControl: currentValue: 5.0
[log] FINER: 14:44:11:333: SliderControl: currentValue: 5.0
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ScanResult(result: Result<DiscoveredDevice, GenericFailure<ScanFailure>?>.success(DiscoveredDevice(id: 52:A6:D4:89:11:96, name: DharmaDr, serviceData: {}, serviceUuids: [0eaa6289-88f3-4817-985e-f0b869ad5e05], manufacturerData: [], rssi: -66, connectable: Connectable.available)))
[log] FINER: 14:44:18:488: TabProvider: new Device 52:A6:D4:89:11:96 DharmaDr
[log] FINER: 14:44:18:489: TabProvider: leftConnectDevice 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Connect to device: 52:A6:D4:89:11:96, servicesWithCharacteristicsToDiscover: null, timeout: 0:00:01.500000
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connecting, failure: null)
D/BluetoothGatt(30524): connect() - device: 52:A6:D4:89:11:96, auto: false
D/BluetoothGatt(30524): registerApp()
D/BluetoothGatt(30524): registerApp() - UUID=5b9ce668-1f30-449c-b12b-4581c4f4109a
[log] FINER: 14:44:19:019: TabProvider: leftConnectDevice 52:A6:D4:89:11:96 connecting null
D/BluetoothGatt(30524): onClientRegistered() - status=0 clientIf=7
[log] FINER: 14:44:19:101: TabProvider: new Device 52:A6:D4:89:11:96 DharmaDr
I/flutter (30524): REACTIVE_BLE: Received ScanResult(result: Result<DiscoveredDevice, GenericFailure<ScanFailure>?>.success(DiscoveredDevice(id: 52:A6:D4:89:11:96, name: DharmaDr, serviceData: {}, serviceUuids: [0eaa6289-88f3-4817-985e-f0b869ad5e05], manufacturerData: [], rssi: -67, connectable: Connectable.available)))
D/BluetoothGatt(30524): onClientConnectionState() - status=0 clientIf=7 device=52:A6:D4:89:11:96
[log] FINER: 14:44:19:272: TabProvider: leftConnectDevice 52:A6:D4:89:11:96 connected null
[log] FINER: 14:44:19:273: AppBle: writeSecureMode
[log] FINEST: 14:44:19:274: AppBle: writeCommandWithResponse 52:A6:D4:89:11:96 0eaa6289 0eaa6294 [254]
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connected, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.connected, failure: null)
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
D/BluetoothGatt(30524): discoverServices() - device: 52:A6:D4:89:11:96
D/BluetoothGatt(30524): onConnectionUpdated() - Device=52:A6:D4:89:11:96 interval=16 latency=0 timeout=500 status=0
D/BluetoothGatt(30524): onPhyUpdate() - status=0 address=52:A6:D4:89:11:96 txPhy=2 rxPhy=2
D/BluetoothGatt(30524): onSearchComplete() = Device=52:A6:D4:89:11:96 Status=0
I/flutter (30524): REACTIVE_BLE: Write with response to CharacteristicInstance(characteristicId: 0eaa6294-88f3-4817-985e-f0b869ad5e05(34), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), value: [254]
I/flutter (30524): REACTIVE_BLE: Read characteristic: CharacteristicInstance(characteristicId: 0eaa6294-88f3-4817-985e-f0b869ad5e05(34), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
D/BluetoothGatt(30524): onConnectionUpdated() - Device=52:A6:D4:89:11:96 interval=24 latency=0 timeout=500 status=0
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6294-88f3-4817-985e-f0b869ad5e05(34), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
[log] FINEST: 14:44:22:221: TabProvider: 0 bondValue: 2
[log] FINER: 14:44:22:223: AppBle: appMode
[log] FINEST: 14:44:22:224: AppBle: writeCommandWithResponse 52:A6:D4:89:11:96 0eaa6289 0eaa628a [1]
[log] FINEST: 14:44:22:225: DatabaseService: logUserEvent {user: BHkbEDVsZgVnmTujuz6xkhNSrvX2, time: 2023-11-11 22:44:22.224875Z, event: tabConnect, params: null}
[log] FINER: 14:44:22:237: TabUIState: build mode: HomeScreenMode.localOnly connected: true chatID:
[log] FINE: 14:44:22:240: MenuScreen: build leftIsConnected true
[log] FINER: 14:44:22:279: BatteryStatus: connected: true levels: [100, 100]
[log] FINER: 14:44:22:285: BatteryStatus: connected: true levels: [100, 100]
[log] FINER: 14:44:22:286: SliderControl: currentValue: 5.0
[log] FINER: 14:44:22:290: SliderControl: currentValue: 5.0
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Get discovered services for device: 52:A6:D4:89:11:96
I/flutter (30524): REACTIVE_BLE: Start subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa628e-88f3-4817-985e-f0b869ad5e05(37), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Write with response to CharacteristicInstance(characteristicId: 0eaa628a-88f3-4817-985e-f0b869ad5e05(20), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), value: [1]
I/flutter (30524): REACTIVE_BLE: Start subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa6290-88f3-4817-985e-f0b869ad5e05(40), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Read characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Read characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa628e-88f3-4817-985e-f0b869ad5e05 enable: true
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa6290-88f3-4817-985e-f0b869ad5e05 enable: true
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
[log] FINER: 14:44:22:673: TabUpdateListTile: FW version L:v0.809, Nov 2, 2023
      R:v0.809, Nov 2, 2023
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
I/flutter (30524): REACTIVE_BLE: Received CharacteristicValue(characteristic: CharacteristicInstance(characteristicId: 0eaa6291-88f3-4817-985e-f0b869ad5e05(30), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96), result: CharacteristicValue)
[log] FINEST: 14:44:22:901: DatabaseService: getLatestFWDescriptor {hw_filename: v0.808/tabhw_v0.808_oct26_app_update.bin, version: v0.808, dk_filename: v0.808/dk_v0.808_oct26_app_update.bin}
[log] FINER: 14:44:22:902: TabUpdateListTile: tabFW: L:v0.809, Nov 2, 2023 R:v0.809, Nov 2, 2023 newFW: v0.808
[log] FINER: 14:44:22:904: TabUpdateListTile: leftVersion: 0.809 rightVersion: 0.809 newFW: 0.808 forceFW:
D/BluetoothGatt(30524): onConnectionUpdated() - Device=52:A6:D4:89:11:96 interval=24 latency=0 timeout=42 status=0
D/BluetoothGatt(30524): onClientConnectionState() - status=8 clientIf=7 device=52:A6:D4:89:11:96

crash on disconnect

I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
[log] FINER: 14:44:35:805: TabProvider: leftConnectDevice 52:A6:D4:89:11:96 disconnected ConnectionError.failedToConnect
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa628e-88f3-4817-985e-f0b869ad5e05 enable: false
I/flutter (30524): REACTIVE_BLE: Disconnect device: 52:A6:D4:89:11:96
D/BluetoothGatt(30524): close()
D/BluetoothGatt(30524): unregisterApp() - mClientIf=7
I/flutter (30524): REACTIVE_BLE: Stop subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa628e-88f3-4817-985e-f0b869ad5e05(37), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Stop subscribing to notifications for CharacteristicInstance(characteristicId: 0eaa6290-88f3-4817-985e-f0b869ad5e05(40), serviceId: 0eaa6289-88f3-4817-985e-f0b869ad5e05(18), deviceId: 52:A6:D4:89:11:96)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
D/BluetoothGatt(30524): setCharacteristicNotification() - uuid: 0eaa6290-88f3-4817-985e-f0b869ad5e05 enable: false
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnected, failure: GenericFailure<ConnectionError>(code: ConnectionError.failedToConnect, message: "Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"))
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
[log] FINEST: 14:44:35:806: DatabaseService: logUserEvent {user: BHkbEDVsZgVnmTujuz6xkhNSrvX2, time: 2023-11-11 22:44:35.806769Z, event: tabDisconnect, params: null}
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
I/flutter (30524): REACTIVE_BLE: Received ConnectionStateUpdate(deviceId: 52:A6:D4:89:11:96, connectionState: DeviceConnectionState.disconnecting, failure: null)
W/System.err(30524): io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
W/System.err(30524): 	at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:313)
W/System.err(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableReplay$ReplayObserver.dispose(ObservableReplay.java:271)
W/System.err(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableRefCount.timeout(ObservableRefCount.java:156)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableRefCount.cancel(ObservableRefCount.java:103)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableRefCount$RefCountObserver.dispose(ObservableRefCount.java:252)
W/System.err(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
W/System.err(30524): 	at io.reactivex.internal.operators.mixed.CompletableAndThenObservable$AndThenObservableObserver.dispose(CompletableAndThenObservable.java:86)
W/System.err(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
W/System.err(30524): 	at io.reactivex.internal.operators.mixed.SingleFlatMapObservable$FlatMapObserver.dispose(SingleFlatMapObservable.java:84)
W/System.err(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.dispose(ObservableFlatMap.java:588)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.disposeAll(ObservableFlatMap.java:510)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:310)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.disposeAll(ObservableFlatMap.java:504)
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:310)
[log] FINER: 14:44:35:844: TabUIState: build mode: HomeScreenMode.localOnly connected: false chatID:
[log] FINE: 14:44:35:844: MenuScreen: build leftIsConnected false
W/System.err(30524): 	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.dispose(ObservableObserveOn.java:146)
W/System.err(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
W/System.err(30524): 	at io.reactivex.internal.observers.LambdaObserver.dispose(LambdaObserver.java:102)
W/System.err(30524): 	at com.signify.hue.flutterreactiveble.channelhandlers.CharNotificationHandler.unsubscribeFromAllNotifications(CharNotificationHandler.kt:71)
W/System.err(30524): 	at com.signify.hue.flutterreactiveble.channelhandlers.CharNotificationHandler.onCancel(CharNotificationHandler.kt:29)
W/System.err(30524): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onCancel(EventChannel.java:231)
W/System.err(30524): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:199)
W/System.err(30524): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
W/System.err(30524): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
W/System.err(30524): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
W/System.err(30524): 	at android.os.Handler.handleCallback(Handler.java:942)
W/System.err(30524): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(30524): 	at android.os.Looper.loopOnce(Looper.java:201)
W/System.err(30524): 	at android.os.Looper.loop(Looper.java:288)
W/System.err(30524): 	at android.app.ActivityThread.main(ActivityThread.java:7918)
W/System.err(30524): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err(30524): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
W/System.err(30524): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
W/System.err(30524): Caused by: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
W/System.err(30524): 	at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:81)
W/System.err(30524): 	at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:299)
W/System.err(30524): 	at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:864)
W/System.err(30524): 	at android.bluetooth.BluetoothGatt.-$$Nest$mrunOrQueueCallback(Unknown Source:0)
W/System.err(30524): 	at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:294)
W/System.err(30524): 	at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:128)
W/System.err(30524): 	at android.os.Binder.execTransactInternal(Binder.java:1285)
W/System.err(30524): 	at android.os.Binder.execTransact(Binder.java:1244)
[log] FINER: 14:44:35:872: BatteryStatus: connected: false levels: [100, 100]
[log] FINER: 14:44:35:878: BatteryStatus: connected: false levels: [100, 100]
[log] FINER: 14:44:35:879: SliderControl: currentValue: 5.0
[log] FINER: 14:44:35:882: SliderControl: currentValue: 5.0
D/CompatibilityChangeReporter(30524): Compat change id reported: 194532703; UID 10641; state: ENABLED
E/AndroidRuntime(30524): FATAL EXCEPTION: main
E/AndroidRuntime(30524): Process: com.dharmadr.dharmadrapp, PID: 30524
E/AndroidRuntime(30524): io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
E/AndroidRuntime(30524): 	at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:313)
E/AndroidRuntime(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableReplay$ReplayObserver.dispose(ObservableReplay.java:271)
E/AndroidRuntime(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableRefCount.timeout(ObservableRefCount.java:156)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableRefCount.cancel(ObservableRefCount.java:103)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableRefCount$RefCountObserver.dispose(ObservableRefCount.java:252)
E/AndroidRuntime(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.mixed.CompletableAndThenObservable$AndThenObservableObserver.dispose(CompletableAndThenObservable.java:86)
E/AndroidRuntime(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.mixed.SingleFlatMapObservable$FlatMapObserver.dispose(SingleFlatMapObservable.java:84)
E/AndroidRuntime(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.dispose(ObservableFlatMap.java:588)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.disposeAll(ObservableFlatMap.java:510)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:310)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.disposeAll(ObservableFlatMap.java:504)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:310)
E/AndroidRuntime(30524): 	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.dispose(ObservableObserveOn.java:146)
E/AndroidRuntime(30524): 	at io.reactivex.internal.disposables.DisposableHelper.dispose(DisposableHelper.java:124)
E/AndroidRuntime(30524): 	at io.reactivex.internal.observers.LambdaObserver.dispose(LambdaObserver.java:102)
E/AndroidRuntime(30524): 	at com.signify.hue.flutterreactiveble.channelhandlers.CharNotificationHandler.unsubscribeFromAllNotifications(CharNotificationHandler.kt:71)
E/AndroidRuntime(30524): 	at com.signify.hue.flutterreactiveble.channelhandlers.CharNotificationHandler.onCancel(CharNotificationHandler.kt:29)
E/AndroidRuntime(30524): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onCancel(EventChannel.java:231)
E/AndroidRuntime(30524): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:199)
E/AndroidRuntime(30524): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime(30524): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/AndroidRuntime(30524): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/AndroidRuntime(30524): 	at android.os.Handler.handleCallback(Handler.java:942)
E/AndroidRuntime(30524): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(30524): 	at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(30524): 	at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(30524): 	at android.app.ActivityThread.main(ActivityThread.java:7918)
E/AndroidRuntime(30524): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(30524): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(30524): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(30524): Caused by: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
E/AndroidRuntime(30524): 	at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:81)
E/AndroidRuntime(30524): 	at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:299)
E/AndroidRuntime(30524): 	at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:864)
E/AndroidRuntime(30524): 	at android.bluetooth.BluetoothGatt.-$$Nest$mrunOrQueueCallback(Unknown Source:0)
E/AndroidRuntime(30524): 	at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:294)
E/AndroidRuntime(30524): 	at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:128)
E/AndroidRuntime(30524): 	at android.os.Binder.execTransactInternal(Binder.java:1285)
E/AndroidRuntime(30524): 	at android.os.Binder.execTransact(Binder.java:1244)
I/Process (30524): Sending signal. PID: 30524 SIG: 9
Lost connection to device.
Exited
@chipweinberger
Copy link

FAQ

How to handle the BLE undeliverable exception

On Android side we use the RxAndroidBle library of Polidea. After migration towards RxJava 2 some of the errors are not routed properly to their listeners and thus this will result in a BLE Undeliverable Exception. The root cause lies in the threading of the Android OS. As workaround RxJava has a hook where you can set the global errorhandler. For more info see RxJava docs .

A default workaround implementation in the Flutter app (needs to be in the Java / Kotlin part e.g. mainactivity) is shown below. For an example (in Java) see Polidea RxAndroidBle sample.

BleException is coming from Polidea RxAndroidBle, so make sure your application declares the following depedency: implementation "com.polidea.rxandroidble2:rxandroidble:1.11.1"

RxJavaPlugins.setErrorHandler { throwable ->
  if (throwable is UndeliverableException && throwable.cause is BleException) {
    return@setErrorHandler // ignore BleExceptions since we do not have subscriber
  }
  else {
    throw throwable
  }
}

@Baxi19
Copy link

Baxi19 commented May 30, 2024

Hi @pmagnuson

To resolve the issue, you primarily need to add the necessary dependency in your android/app/build.gradle file, like so:

android {
    // Other configurations...
}

flutter {
    source '../..'
}


dependencies {
    // TODO: Add this dependency
    implementation "com.polidea.rxandroidble2:rxandroidble:1.11.1"
}

Next, you'll need to update your Android´s main file. In my case, I'm using Kotlin (for Java the solution is in the README) , so your file might look something like this:

//TODO: Update it with your app information
package com.your_company.your_app

import io.flutter.embedding.android.FlutterActivity
import android.os.Bundle
import com.polidea.rxandroidble2.exceptions.BleException
import io.reactivex.exceptions.UndeliverableException
import io.reactivex.plugins.RxJavaPlugins

class MainActivity: FlutterActivity() {
   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)

       RxJavaPlugins.setErrorHandler { throwable ->
           if (throwable is UndeliverableException && throwable.cause is BleException) {
               // ignore BleExceptions since we do not have subscriber
               return@setErrorHandler
           } else {
               throw throwable
           }
       }
   }
}

Finally, after making these changes, clean your project to get the dependencies and then run it again.

flutter clean && flutter pub get && flutter run

The issue should now be resolved :octocat: 🔨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants