[pulseaudio-discuss] [PATCH v5 17/39] bluetooth: Handle PropertiesChanged for org.bluez.Device1

jprvita at gmail.com jprvita at gmail.com
Tue Sep 24 15:45:37 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 17889b6..0d19091 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -936,6 +936,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;
@@ -1461,6 +1478,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;
@@ -1526,6 +1545,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