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

Device.removeAllListeners('disconnect') does not work #29

Open
ebeling opened this issue Oct 14, 2021 · 0 comments
Open

Device.removeAllListeners('disconnect') does not work #29

ebeling opened this issue Oct 14, 2021 · 0 comments

Comments

@ebeling
Copy link

ebeling commented Oct 14, 2021

I try to implement reconnecting device after loosing bluetooth connection (for example because of leaving the bluetooth range). Therefore I register a listener with "Device.on('disconnect', ...)". One issue is if I call this after "Adapter.waitDevice(...)" promise on the received device, no events will be emitted. Therefore I call "Adapter.getDevice(...)" and register disconnect listener. Now the event is emitted. But for some reasons I like remove the "disconnect event listener" from Device, but this does not work.
I can see in your source, that the 'disconnect' - event is forwarded from BusHelper-propertiesChanged-event. Is this the reason that I can not unregister the listener for 'disconnect'-events on Device?

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

1 participant