Describe the bug
When I try to discover the services on a BLE device by calling flutterReactiveBl.discoverAllServices, I sometimes get an exception:
PlatformException: service_discovery_failure
Caused by: java.util.NoSuchElementException
# RxJava
at io.reactivex.internal.operators.observable.ObservableElementAtSingle$ElementAtObserver.onComplete(ObservableElementAtSingle.java:115)
at io.reactivex.internal.operators.observable.ObservableFlatMapSingle$FlatMapSingleObserver.drainLoop(ObservableFlatMapSingle.java:254)
at io.reactivex.internal.operators.observable.ObservableFlatMapSingle$FlatMapSingleObserver.drain(ObservableFlatMapSingle.java:210)
at io.reactivex.internal.operators.observable.ObservableFlatMapSingle$FlatMapSingleObserver.onComplete(ObservableFlatMapSingle.java:133)
at io.reactivex.subjects.BehaviorSubject.subscribeActual(BehaviorSubject.java:244)
at io.reactivex.Observable.subscribe(Observable.java:12284)
at io.reactivex.internal.operators.observable.ObservableFlatMapSingle.subscribeActual(ObservableFlatMapSingle.java:48)
at io.reactivex.Observable.subscribe(Observable.java:12284)
at io.reactivex.internal.operators.observable.ObservableElementAtSingle.subscribeActual(ObservableElementAtSingle.java:37)
at io.reactivex.Single.subscribe(Single.java:3666)
at io.reactivex.internal.operators.single.SingleObserveOn.subscribeActual(SingleObserveOn.java:35)
at io.reactivex.Single.subscribe(Single.java:3666)
at io.reactivex.Single.subscribe(Single.java:3652)
# flutter_reactive_ble
at com.signify.hue.flutterreactiveble.PluginController.discoverServices(PluginController.kt:366)
at com.signify.hue.flutterreactiveble.PluginController.access$discoverServices(PluginController.kt:23)
at com.signify.hue.flutterreactiveble.PluginController$pluginMethods$14.invoke(PluginController.kt:40)
at com.signify.hue.flutterreactiveble.PluginController$pluginMethods$14.invoke(PluginController.kt:40)
at com.signify.hue.flutterreactiveble.PluginController.execute$reactive_ble_mobile_debug(PluginController.kt:89)
at com.signify.hue.flutterreactiveble.ReactiveBlePlugin.onMethodCall(ReactiveBlePlugin.kt:44)
# Flutter
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:286)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:313)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
# Android
at android.os.Handler.handleCallback(Handler.java:995)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loopOnce(Looper.java:273)
at android.os.Looper.loop(Looper.java:363)
at android.app.ActivityThread.main(ActivityThread.java:10060)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
To Reproduce
Steps to reproduce the behavior:
- Run
flutterRecativeBle.scanForDevices
Call flutterReactiveBle.discoverAllServices` with the ID of that device to connect to the GATT server and get a full service list instead only service information from BLE service announcements
- Observe a failure with exception (including the part of the stack trace, belonging to this package) …
Expected behavior
Services are discovered and no exception is thrown.
I wrote a small Python script to check whether the device might be at fault but my Python script (using bleak) could both discover and connect the device, fetching the full service and characteristic list without any issues.
Smartphone / tablet
- Device: Samsung Galaxy S25
- OS: Android 16
- Package version: 5.4.0
Peripheral device
- Vendor, model: cosinuss c-med alpha
- Does it run a custom firmware / software: no
Describe the bug
When I try to discover the services on a BLE device by calling
flutterReactiveBl.discoverAllServices, I sometimes get an exception:To Reproduce
Steps to reproduce the behavior:
flutterRecativeBle.scanForDevicesCallflutterReactiveBle.discoverAllServices` with the ID of that device to connect to the GATT server and get a full service list instead only service information from BLE service announcementsExpected behavior
Services are discovered and no exception is thrown.
I wrote a small Python script to check whether the device might be at fault but my Python script (using
bleak) could both discover and connect the device, fetching the full service and characteristic list without any issues.Smartphone / tablet
Peripheral device