labapart / gattlib

Library to access GATT information from BLE (Bluetooth Low Energy) devices
http://labapart.com/
436 stars 157 forks source link

Fixed bug where notifications will be enabled but no events will be received. #206

Closed kdewald closed 3 years ago

kdewald commented 3 years ago

For g_signal_connect to work, the process (either outside or within the library) needs to have at least one GMainLoop active to handle all the incoming events.

When a connection is established, create a pthread that keeps a main event loop open, and close it when disconnect is called.

Fixes:

oliviermartin commented 3 years ago

Thanks a lot @kdewald :-) I was guessing the issue might have been related to GMainLoop. But I could not see what I 'recently' changed that might have affected the library.

Anyway, thanks to your PR, it fixes a critical issue people were having :+1: