IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.58k stars 490 forks source link

How does bluepy-helper interface with DefaultDelegate's callback functions? #426

Open aero-man opened 3 years ago

aero-man commented 3 years ago

I have a question about the handleNotification and handleDiscovery functions in the DefaultDelegate class.

How do these get called? I am familiar with callback functions, but where in the Python code, bluepy-helper.c, or the bluez code does Bluepy know that handleNotification is what it needs to call when a notification packet is sent from a Bluetooth device?

This seems especially like magic to me, because I changed the name of handleNotification to handle_notification in the original DefaultDelegate class and re-ran setup.py install with this new, slightly altered, local version of mine and it still worked. How does this work?

Thanks.