[RFC v2 14/15] bluetooth: Update to new property setter API in BlueZ 5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

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 cd6db4b..7589c22 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1587,6 +1587,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



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux