[pulseaudio-discuss] [PATCH v4 19/41] bluetooth: Handle PropertiesChanged for org.bluez.Device1

jprvita at gmail.com jprvita at gmail.com
Wed Sep 18 14:17:13 PDT 2013


From: João Paulo Rechi Vita <jprvita at openbossa.org>

---
 src/modules/bluetooth/bluez5-util.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index 49d5c38..b9f5932 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -906,6 +906,23 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
             }
 
             parse_adapter_properties(a, &arg_i, true);
+
+        } else if (pa_streq(iface, BLUEZ_DEVICE_INTERFACE)) {
+            pa_bluetooth_device *d;
+
+            pa_log_debug("Properties changed in device %s", dbus_message_get_path(m));
+
+            if (!(d = pa_hashmap_get(y->devices, dbus_message_get_path(m)))) {
+                pa_log_warn("Properties changed in unknown device");
+                return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+            }
+
+            if (d->device_info_valid != 1) {
+                pa_log_warn("Properties changed in a device which information is unknown or invalid");
+                return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+            }
+
+            parse_device_properties(d, &arg_i, true);
         }
 
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -1420,6 +1437,8 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
             "member='InterfacesRemoved'",
             "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
             ",arg0='" BLUEZ_ADAPTER_INTERFACE "'",
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            ",arg0='" BLUEZ_DEVICE_INTERFACE "'",
             NULL) < 0) {
         pa_log_error("Failed to add D-Bus matches: %s", err.message);
         goto fail;
@@ -1485,6 +1504,8 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
                 "member='InterfacesRemoved'",
                 "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',"
                 "member='PropertiesChanged',arg0='" BLUEZ_ADAPTER_INTERFACE "'",
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',"
+                "member='PropertiesChanged',arg0='" BLUEZ_DEVICE_INTERFACE "'",
                 NULL);
 
         if (y->filter_added)
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list