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

adapter.DeviceConnected is executed only once after running ConnectToKnownDeviceAsync #795

Open
juniorsaraviao opened this issue Jan 5, 2024 · 2 comments

Comments

@juniorsaraviao
Copy link

I'm currently migrating a Xamarin app which uses Plugin.BLE. I'm using .NET MAUI 8 and Plugin.BLE.

When I use ConnectToKnownDeviceAsync in .NET MAUI 8 and run the following code:

var param = new ConnectParameters(true, forceBleTransport: true);
await adapter.ConnectToKnownDeviceAsync(localDeviceId, param);

the EventHandler adapter.DeviceConnected is executed only once

adapter.DeviceConnected += Adapter_DeviceConnected;

I compared the previous Xamarin app and realized every time the adapter.ConnectToKnownDeviceAsync was executed, it ran the Adapter_DeviceConnected (even if the device was already paired or not).

Steps to reproduce

  1. Implement the event Handler adapter.DeviceConnected

  2. Execute adapter.ConnectToKnownDeviceAsync(localDeviceId, param);

Expected behavior

Keep the same functionality (Xamarin version) to execute the Adapter_DeviceConnected every time the ConnectToKnownDeviceAsync is executed too.

Actual behavior

adapter.DeviceConnected is executed only once.

Crashlog

None

Configuration

Version of the Plugin: v3.1.0-beta.1

Platform: Android v13

Device: Samsung Galaxy A53

@smsissuechecker
Copy link

Hi @juniorsaraviao,

I'm the friendly issue checker.
Thanks for using the issue template 🌟
I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.

@IainS1986
Copy link

Not sure I follow. Why would it fire more than once? And why would you call it if you're already connected?

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

No branches or pull requests

4 participants