PhilipsHue / flutter_reactive_ble

Flutter library that handles BLE operations for multiple devices.
https://developers.meethue.com/
Other
667 stars 331 forks source link

Example app is crashing when connecting/disconnecting same device #549

Open jasnicaa opened 2 years ago

jasnicaa commented 2 years ago

I've seen people reporting same issue which it says should be solved in 5.0.2 but the example app is crashing in the same way with the same error as before when I try to either connect again on the same device or connect and disconnect. And in my app it happens when I want to connect multi device

''' reactive_ble_mobile[/ConnectTaskController.swift:16](): Assertion failed

This happens on my iPhone mini 12 with iOS 15.1.1.

vincent-iQontrol commented 2 years ago

I have seen this issue too

AnimeshHestabit commented 2 years ago

IOS app is crashed after the connecting with device so for handle the crash using scanStream.cancel(), but after doing this one of my readCharacteristic is not working fine i am not getting the battery status from device, but this is working fine with Android. According to me this error is because of scanStream.cancel() because in IOS app we used this and Android we did not use this.

I am sharing the readCharacteristic method which is not working in IOS, please help me out into this.

version : flutter_reactive_ble: ^5.0.2

 if (Platform.isIOS) {
       connectedBluetooth.value = true;
            connectionForData();
            _scanStream.cancel();

   }
Future<void> connectionForData() async {
   try {
flutterReactiveBle
             .readCharacteristic(characteristicBattery)
             .then((List<int> result) {
           debugPrint("HERE ==>> connected bluetooth then");
           for (var i in result) {
             ///read the battery status (byte code)
             debugPrint("HERE ==>> connected bluetooth for");
             batteryStatus(i);
           }
         });
}, onError: (Object error) {

       CommonUtils.toastMesg(error.toString());
       // Handle a possible error
     });
   } catch (e) {
     debugPrint("HERE ==>> ${e.toString()}");
   }
jasnicaa commented 2 years ago

any updates? I forked the lib and did it by myself but when the app is going to update to support this solution?