spacecheese / bluez_peripheral

A library for building BLE peripherals using GATT and bluez
MIT License
38 stars 8 forks source link

Way to understand when notify char has subscriber #36

Closed DrewPerkinsSoftRobot closed 10 months ago

DrewPerkinsSoftRobot commented 10 months ago

Is there a simple way with the notify characteristic to understand when someone has subscribed or would this be best left to the central to send a following message that they have subscribed to the peripheral?

spacecheese commented 10 months ago

Hello, This is possible- the StartNotify and StopNotify methods in the characteristic will be called by Bluez when this happens. The library already uses these to make sure notifications are only issued when enabled (when you call the changed method although I don’t remember if I say that in the docs) but if you wanted to add some extra functionality I’d recommend overriding the characteristic class.