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

Corebluetooth peripheral cant be used after reconnect #413

Open
saty9 opened this issue Dec 10, 2024 · 2 comments
Open

Corebluetooth peripheral cant be used after reconnect #413

saty9 opened this issue Dec 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@saty9
Copy link

saty9 commented Dec 10, 2024

Describe the bug
When I have a peripheral that disconnects and I later call connect on it successfully the stream returned by notifications() never produces an event.

Expected behavior
I can re-use a peripheral after it has reconnected

Actual behavior
The peripheral stops producing notifications after the first diconnect

Additional context
The log message Event receiver died, breaking out of corebluetooth device loop appears which seems to show the event handler for my peripheral dying. I am currently working around this be rescanning and getting a fresh version of the peripheral from Central.

@saty9 saty9 added the bug Something isn't working label Dec 10, 2024
@laxian
Copy link

laxian commented Dec 11, 2024

Yes, the TX/RX channel is initialized in Peripheral::new() and cleaned up in Drop.
When disconnected, the peripheral is removed from the manager's HashMap, triggering its Drop implementation.

@saty9
Copy link
Author

saty9 commented Dec 11, 2024

It would be helpful if all methods return an error after that point instead of appearing to work if this is intentional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants