All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 05/10] test: Update map-client to the changes in GetMessageListing
Date: Tue,  3 Jul 2012 21:28:09 +0300	[thread overview]
Message-ID: <1341340094-32522-5-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1341340094-32522-1-git-send-email-luiz.dentz@gmail.com>

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

This makes map-client to print the object path and properties of each
message found.
---
 test/map-client |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/test/map-client b/test/map-client
index da357a9..be3c307 100755
--- a/test/map-client
+++ b/test/map-client
@@ -6,6 +6,27 @@ import dbus
 import dbus.mainloop.glib
 from optparse import OptionParser
 
+from pprint import pformat
+
+def unwrap(x):
+    """Hack to unwrap D-Bus values, so that they're easier to read when
+    printed. Taken from d-feet """
+
+    if isinstance(x, list):
+        return map(unwrap, x)
+
+    if isinstance(x, tuple):
+        return tuple(map(unwrap, x))
+
+    if isinstance(x, dict):
+        return dict([(unwrap(k), unwrap(v)) for k, v in x.iteritems()])
+
+    for t in [unicode, str, long, int, float, bool]:
+        if isinstance(x, t):
+            return t(x)
+
+    return x
+
 def parse_options():
 	parser.add_option("-d", "--device", dest="device",
 			help="Device to connect", metavar="DEVICE")
@@ -54,6 +75,7 @@ if  __name__ == '__main__':
 			print "%s/" % (i["Name"])
 
 	if options.ls_msg is not None:
-		print map.GetMessageListing(options.ls_msg, dict())
+		ret = map.GetMessageListing(options.ls_msg, dict())
+		print pformat(unwrap(ret))
 
 	mainloop.run()
-- 
1.7.10.4


  parent reply	other threads:[~2012-07-03 18:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 18:28 [PATCH obexd 01/10] client: Change MessageAccess.GetFolderListing to not return raw xml Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 02/10] test: Update map-client to the changes in GetFolderListing Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 03/10] client-doc: Add documentation of MessageAccess.GetFolderListing Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 04/10] client: Change MessageAccess.GetMessageListing to not return raw xml Luiz Augusto von Dentz
2012-07-03 18:28 ` Luiz Augusto von Dentz [this message]
2012-07-03 18:28 ` [PATCH obexd 06/10] client-doc: Add documentation of MessageAccess.GetMessageListing Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 07/10] client: Use filter instead of dummy as argument name in MAP Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 08/10] client-doc: Add documentation of org.bluez.obex.Message Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 09/10] client: Add Message.Get implementation Luiz Augusto von Dentz
2012-07-03 18:28 ` [PATCH obexd 10/10] test: Add support for Message.Get to map-client Luiz Augusto von Dentz
2012-07-18 12:14 ` [PATCH obexd 01/10] client: Change MessageAccess.GetFolderListing to not return raw xml Johan Hedberg
  -- strict thread matches above, loose matches on Subject: below --
2012-06-27 12:04 Luiz Augusto von Dentz
2012-06-27 12:04 ` [PATCH obexd 05/10] test: Update map-client to the changes in GetMessageListing Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341340094-32522-5-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.