[PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

In addition fix the reply generated by obc_transfer_create_dbus_reply to
not use a structure container instead use object, dict 'oa{sv}' as
indicated in the documentation.
---
 obexd/client/transfer.c | 46 ++++------------------------------------------
 1 file changed, 4 insertions(+), 42 deletions(-)

diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 29d61f3..fc3f87b 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -97,47 +97,6 @@ static void obc_transfer_append_dbus_properties(struct obc_transfer *transfer,
 						&transfer->progress);
 }
 
-static DBusMessage *obc_transfer_get_properties(DBusConnection *connection,
-					DBusMessage *message, void *user_data)
-{
-	struct obc_transfer *transfer = user_data;
-	DBusMessage *reply;
-	DBusMessageIter iter, dict;
-
-	reply = dbus_message_new_method_return(message);
-	if (!reply)
-		return NULL;
-
-	dbus_message_iter_init_append(reply, &iter);
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-						OBC_PROPERTIES_ARRAY_SIGNATURE,
-						&dict);
-
-	obc_transfer_append_dbus_properties(transfer, &dict);
-
-	dbus_message_iter_close_container(&iter, &dict);
-
-	return reply;
-}
-
-static void obc_transfer_append_dbus_data(struct obc_transfer *transfer,
-							DBusMessageIter *iter)
-{
-	const char *path = transfer->path;
-	DBusMessageIter entry, dict;
-
-	dbus_message_iter_open_container(iter, DBUS_TYPE_STRUCT, NULL, &entry);
-	dbus_message_iter_append_basic(&entry, DBUS_TYPE_OBJECT_PATH, &path);
-	dbus_message_iter_open_container(&entry, DBUS_TYPE_ARRAY,
-						OBC_PROPERTIES_ARRAY_SIGNATURE,
-						&dict);
-
-	obc_transfer_append_dbus_properties(transfer, &dict);
-
-	dbus_message_iter_close_container(&entry, &dict);
-	dbus_message_iter_close_container(iter, &entry);
-}
-
 DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer,
 							DBusMessage *message)
 {
@@ -149,7 +108,10 @@ DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer,
 		return NULL;
 
 	dbus_message_iter_init_append(reply, &iter);
-	obc_transfer_append_dbus_data(transfer, &iter);
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
+							&transfer->path);
+	g_dbus_get_properties(transfer->conn, transfer->path,
+						TRANSFER_INTERFACE, &iter);
 
 	return reply;
 }
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux