hypfvieh / bluez-dbus

bluetooth library for linux OSes using DBus and bluez (http://www.bluez.org/).
MIT License
68 stars 20 forks source link

Ability to remove property and signal handlers from the com.github.hypfvieh.bluetooth.DeviceManager #48

Closed OlegAndreych closed 3 years ago

OlegAndreych commented 3 years ago

I have a case when the need for subscriptions for different properties comes and goes.

As a workaround, I can have a generic subscription, which will delegate to specific handlers, relieving one from the need to register handlers in the DeviceManager. But having only handlers with a lifecycle tied to the objects representing devices seems more natural.

As far as I can see, underlying org.freedesktop.dbus.connections.impl.DBusConnection already has corresponding methods.

hypfvieh commented 3 years ago

I added methods to remove signal handlers. But you can already do that without these methods by calling deviceManager.getDBusConnection().removeSigHandler(class, handler)

OlegAndreych commented 3 years ago

But you can already do that without these methods by calling deviceManager.getDBusConnection().removeSigHandler(class, handler)

Thanks for the methods and the idea.