-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
[0.13.0] "UniversalBle.connect" seems to be fully broken for iOS? #92
Comments
@AlexDochioiu now |
@rohitsangwan01 On version 0.13.0? It just seems to always fail to connect and time out with error along the lines of: PlatformException(IllegalArgument, Unknown deviceId: DE:F1:2C:9F:41:60, null, null) |
@AlexDochioiu can you try the example app and verify that it works? Can you also cross-check with another type of peripheral? |
I will do that. But, for context. The exact same device (and device type) works consistently on 0.12.0 and never works on 0.13.0. |
0.13 was a big release. We did plenty of changes but we are also actively using it with multiple hardware configurations and didn't face any issue. Let's try to narrow it down and see where the problem lies. |
@AlexDochioiu in your code, now you don't have to handle all the complexity of waiting for the connection from callbacks here Now all this is handled within UniversalBle and you can just call try {
print("Connecting");
await UniversalBle.connect(
deviceId,
connectionTimeout: const Duration(seconds: 5),
);
print("Connected successfully");
} catch (e) {
print("Connection Failed with error: $e");
} |
Sorry for being slow to reply. I tried that and it did not work for me. I believe the await to connect was always failing with platform error: unknown device id for some reason. I'll need to update again to 0.13 to double check since it's been a while and my memory is a bit foggy. |
@AlexDochioiu To avoid this error |
@rohitsangwan01 I am performing a scan. That's how I get the device id in the first place. It's not hard coded/etc. |
@AlexDochioiu, could you try the new version on Main and let me know the current status? As I mentioned earlier, we can now simply wait for the connection attempt to either complete or fail with an error. The connect logic can now be streamlined. Please let me know if you still encounter any issues. Here’s how you can modify your connect method: @override
Future<void> connect(LedgerDevice device) async {
....
// No need for completers, just call connect and await the result
try {
print("Connecting");
await UniversalBle.connect(
deviceId,
connectionTimeout: const Duration(seconds: 5),
);
// Logic after successful connection...
} catch (e) {
// Handle failure...
}
....
} |
@AlexDochioiu could you please rest the newly released 0.14 with the above code suggestion and report back? |
I tried to upgrade universal_ble for our package from version 0.12.0 to 0.13.0 and it seems that
connect
just does not work anymore. Behaviour observations:[0.12.0][iOS] Calling await for
UniversalBle.connect
causes it to hang and not complete.[0.12.0][iOS] Calling
UniversalBle.connect
without awaiting seems to work perfectly fine (When connection completes, I get notified via the listener added toUniversalBle.onConnectionChange
)[0.13.0][iOS] Calling await for
UniversalBle.connect
causes it to hang and not complete.[0.13.0][iOS] Calling
UniversalBle.connect
without awaiting seems to still not work, unlike 0.12.0.UniversalBle.onConnectionChange
never gets invoked.The text was updated successfully, but these errors were encountered: