* [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties
@ 2012-12-17 13:25 Luiz Augusto von Dentz
2012-12-17 13:25 ` [PATCH BlueZ 2/2] test: Fix pbap-client to handle PullAll reply properly Luiz Augusto von Dentz
2012-12-17 14:32 ` [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2012-12-17 13:25 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH BlueZ 2/2] test: Fix pbap-client to handle PullAll reply properly
2012-12-17 13:25 [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties Luiz Augusto von Dentz
@ 2012-12-17 13:25 ` Luiz Augusto von Dentz
2012-12-17 14:32 ` [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2012-12-17 13:25 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
PullAll reply consist in 2 parameters, the transfer object followed by
its properties not a structure containing both.
---
test/pbap-client | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/test/pbap-client b/test/pbap-client
index fbe930c..7be8bad 100755
--- a/test/pbap-client
+++ b/test/pbap-client
@@ -33,8 +33,7 @@ class PbapClient:
signal_name="Error",
path_keyword="path")
- def register(self, reply, transfer):
- (path, properties) = reply
+ def register(self, path, properties, transfer):
transfer.path = path
transfer.filename = properties["Filename"]
self.props[path] = transfer
@@ -73,15 +72,15 @@ class PbapClient:
def pull(self, vcard, params, func):
req = Transfer(func)
self.pbap.Pull(vcard, "", params,
- reply_handler=lambda r: self.register(r, req),
- error_handler=self.error)
+ reply_handler=lambda o, p: self.register(o, p, req),
+ error_handler=self.error)
self.transfers += 1
def pull_all(self, params, func):
req = Transfer(func)
self.pbap.PullAll("", params,
- reply_handler=lambda r: self.register(r, req),
- error_handler=self.error)
+ reply_handler=lambda o, p: self.register(o, p, req),
+ error_handler=self.error)
self.transfers += 1
def flush_transfers(self, func):
--
1.7.11.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties
2012-12-17 13:25 [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties Luiz Augusto von Dentz
2012-12-17 13:25 ` [PATCH BlueZ 2/2] test: Fix pbap-client to handle PullAll reply properly Luiz Augusto von Dentz
@ 2012-12-17 14:32 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-12-17 14:32 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Mon, Dec 17, 2012, Luiz Augusto von Dentz wrote:
> 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(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-17 14:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-17 13:25 [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties Luiz Augusto von Dentz
2012-12-17 13:25 ` [PATCH BlueZ 2/2] test: Fix pbap-client to handle PullAll reply properly Luiz Augusto von Dentz
2012-12-17 14:32 ` [PATCH BlueZ 1/2] obex-client: Make use of g_dbus_get_properties to get transfer properties Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).