Linux bluetooth development
 help / color / mirror / Atom feed
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Anderson Lizardo <anderson.lizardo@openbossa.org>
Subject: [PATCH] Fix test/test-attrib script
Date: Thu, 24 Feb 2011 18:47:00 -0300	[thread overview]
Message-ID: <1298584020-14568-1-git-send-email-anderson.lizardo@openbossa.org> (raw)

Characteristics are not being fetched anymore when the device is
created. Discover method needs to be called actively to discover the
characteristics exposed by a given service.
---
 test/test-attrib |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/test-attrib b/test/test-attrib
index 05ee381..dc3f804 100755
--- a/test/test-attrib
+++ b/test/test-attrib
@@ -62,13 +62,17 @@ class Watcher(dbus.service.Object):
         print "Watcher: new value for %s: %s" % (char, dbus_type_to_str(newvalue))
 
 def handle_characteristics(char):
-    for (path, props) in char.GetCharacteristics().iteritems():
-        if options.char_path and path != options.char_path:
+    char.Discover()
+    for c in char.GetProperties()["Characteristics"]:
+        char = dbus.Interface(bus.get_object("org.bluez", c),
+                "org.bluez.Characteristic")
+
+        if options.char_path and c != options.char_path:
             continue
 
         if not options.set_property:
-            ret = "Characteristic: %s\nProperties:\n" % path
-            for (k, v) in props.iteritems():
+            ret = "Characteristic: %s\nProperties:\n" % c
+            for (k, v) in char.GetProperties().iteritems():
                 ret += "\t%s: %s\n" % (k, dbus_type_to_str(v))
             print ret
         elif options.set_property.get(path, None):
-- 
1.7.0.4


             reply	other threads:[~2011-02-24 21:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 21:47 Anderson Lizardo [this message]
2011-02-24 21:59 ` [PATCH] Fix test/test-attrib script Johan Hedberg

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=1298584020-14568-1-git-send-email-anderson.lizardo@openbossa.org \
    --to=anderson.lizardo@openbossa.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox