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

ConnectToDevice does not return #81

Open
alessandrofrancesconi opened this issue Jun 9, 2020 · 2 comments
Open

ConnectToDevice does not return #81

alessandrofrancesconi opened this issue Jun 9, 2020 · 2 comments

Comments

@alessandrofrancesconi
Copy link

alessandrofrancesconi commented Jun 9, 2020

Ble.net version 1.2.1
Android API 28

I have this piece of code. I prepare a cancellation token of 3000ms, then I start the connection to a known device in another thread. I've found that:

  • if the device is reachable, ConnectToDevice() returns successfully
  • if it is not, the function never returns even with the cancellation token!
this.connectToken = new CancellationTokenSource(3000);
this.connectionTask = Task.Run(async () =>
{
    try
    {
        var connection = await this.ble.ConnectToDevice(
                new Guid(d.Address),
                connectToken.Token
        );
        
        if (connection.IsSuccessful()) // <--- not reaching this!
        {
@alessandrofrancesconi
Copy link
Author

I see that after 3 seconds this line appears:
06-09 21:55:02.130 D/BluetoothGatt(19579): cancelOpen() - device: 00:13:AA:00:7F:91

But nothing else and the code keeps stuck at ConnectToDevice()

@christian-strydom
Copy link

I'm having the same problem. It seems to be working on iOS, but not on Android. Have you managed to get it working?

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

2 participants