spacecheese / bluez_peripheral

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

Is there a way to detect connections and disconnections? #39

Open NekomuraHana opened 8 months ago

NekomuraHana commented 8 months ago

Nice to meet you. I was looking for a Bluetooth LE module that would work in a debian12 environment and came across this module. This module is very stable and I am satisfied with its operation.

However, I could not figure out how to know when events occur when connecting and disconnecting. Is it possible to detect them with this module? Is it difficult to achieve this functionality?

spacecheese commented 8 months ago

Hello, thanks for the issue.

There isn't presently a way to do this. You can detect when a device is paired but not when one is connected or disconnected. It would be possible to do this- the org.bluez.Device api does expose this and I was planning on supporting this api to support some testing improvements though I haven't been able to make much progress on this recently.

NekomuraHana commented 8 months ago

Thank you.

I am relieved that it is a feasible feature. I am sorry, but I can only try to encourage you. But I wish you the best.

In debian12, using pip in a global environment is very severely restricted. So, in many cases, even well-known modules cannot work. Among them, this bluez_peripheral is very valuable.