[pulseaudio-discuss] [RFC v1 13/14] bluetooth: Update to new property setter API in BlueZ 5

Mikel Astiz mikel.astiz.oss at gmail.com
Mon Jan 14 07:41:37 PST 2013


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

If BlueZ 5 is in use, the standard org.freedesktop.DBus.Properties needs
to be used instead of the old SetProperty() method.
---
 src/modules/bluetooth/bluetooth-util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index d2d46b4..b0ce59f 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1537,6 +1537,20 @@ static void set_property(pa_bluetooth_discovery *y, const char *bus, const char
     pa_assert(interface);
     pa_assert(prop_name);
 
+    if (y->version >= BLUEZ_VERSION_5) {
+        pa_assert_se(m = dbus_message_new_method_call(bus, path, "org.freedesktop.DBus.Properties", "Set"));
+        dbus_message_iter_init_append(m, &i);
+        dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &interface);
+        dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &prop_name);
+        pa_dbus_append_basic_variant(&i, prop_type, prop_value);
+
+        dbus_message_set_no_reply(m, true);
+        pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL));
+        dbus_message_unref(m);
+
+        return;
+    }
+
     pa_assert_se(m = dbus_message_new_method_call(bus, path, interface, "SetProperty"));
     dbus_message_iter_init_append(m, &i);
     dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &prop_name);
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list