[pulseaudio-discuss] [RFC next v5 10/11] bluetooth: Update to new property setter API in BlueZ 5

Mikel Astiz mikel.astiz.oss at gmail.com
Fri May 10 01:30:51 PDT 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 9b76ce5..faad5b2 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1594,6 +1594,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.8.1.4



More information about the pulseaudio-discuss mailing list