OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
660 stars 111 forks source link

[Windows] Disconnection callback not invoked in manual disconnect #192

Closed kdewald closed 1 year ago

kdewald commented 1 year ago

From Discord:

Is it expected that on manual Disconnect call callback is not invoked?
at least on windows it does not trigger disconnect callback. But seems like working fine on mac os

callback called when resetting device, but not called when I manually call disconnect.
Still. This happens in my c# application. Going to try to reproduce issue in plain C++

yep, in c++ it does not called as well
I bet I had it called some time ago...
295d9f33728ac20a47e9c6e6b99b775eb71d1d81 on this revision it works, but not on master...

Also, quick note - this is Release build.
Maybe that will help

but for debug I have same behaviour
as a quick solution  hack I can suggest to invoke that callbacks manually on Connect Disconnect method calls. Before disconnecting, disable automatic callback calling somehow, and once disconnect routine executed - call user callback.
kdewald commented 1 year ago

Fixed in https://github.com/OpenBluetoothToolbox/SimpleBLE/commit/389b820a684bcf7d4e2009453320928e7883322b