muka / go-bluetooth

Golang bluetooth client based on bluez DBus interfaces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After reconnecting to a device events are emmited twice

jsnjack opened this issue · comments

Hi,

First of all, many thanks for the library! I have notice that one of my bluetooth devices may disconnect once in a while. Sometimes I'm able to reconnect to the device and when I do, I start to receive double notifications for all events.

What would be the correct way to reconnect to the device?

Hi, this is indeed a bug. The event is emitted twice as the reconnect does create a doubled subscription.

Will check it

Sorry, time run fast and I had not yet time to fix.

Have you found a fix you could commit as a PR eventually?

No, unfortunately, not yet.. Haven't been able to get back to the project for some time :(

Hi
i tried to check over this but cannot replicate.

On('changed') unregister then register again to event notifications so duplication should not happens

https://github.com/muka/go-bluetooth/blob/master/api/Device.go#L279

Can provide some test code so I can check ?

Closing for now, reopen when needed. Thanks