summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-09-28 06:00:57 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-09-28 06:00:57 +0200
commit8be9168ec20d1860972047c7a5cdb76ae609daa5 (patch)
tree3601f054137c91df74d0b0221cea565cdb57fed2 /test
parentad5ecc880f25ddaf38dd598c55d6a683319f4e7d (diff)
List device and node objects
Diffstat (limited to 'test')
-rwxr-xr-xtest/list-devices38
1 files changed, 35 insertions, 3 deletions
diff --git a/test/list-devices b/test/list-devices
index ec6c580a..511d0cfa 100755
--- a/test/list-devices
+++ b/test/list-devices
@@ -7,6 +7,13 @@ bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.bluez.Manager")
+def extract_objects(object_list):
+ list = ""
+ for object in object_list:
+ val = str(object)
+ list = list + val[val.rfind("/") + 1:] + " "
+ return list
+
def extract_uuids(uuid_list):
list = ""
for uuid in uuid_list:
@@ -29,9 +36,17 @@ for i in adapter_list:
properties = adapter.GetProperties()
for key in properties.keys():
- print " %s = %s" % (key, properties[key])
+ value = properties[key]
+ if (key == "Devices"):
+ list = extract_objects(value)
+ print " %s = %s" % (key, list)
+ else:
+ print " %s = %s" % (key, value)
- device_list = adapter.ListDevices()
+ try:
+ device_list = properties["Devices"]
+ except:
+ device_list = []
for n in device_list:
device = dbus.Interface(bus.get_object("org.bluez", n),
@@ -41,7 +56,10 @@ for i in adapter_list:
properties = device.GetProperties()
for key in properties.keys():
value = properties[key]
- if (key == "UUIDs"):
+ if (key == "Nodes"):
+ list = extract_objects(value)
+ print " %s = %s" % (key, list)
+ elif (key == "UUIDs"):
list = extract_uuids(value)
print " %s = %s" % (key, list)
elif (key == "Class"):
@@ -49,4 +67,18 @@ for i in adapter_list:
else:
print " %s = %s" % (key, value)
+ try:
+ node_list = properties["Nodes"]
+ except:
+ node_list = []
+
+ for x in node_list:
+ node = dbus.Interface(bus.get_object("org.bluez", x),
+ "org.bluez.Node")
+ print " [ " + x + " ]"
+
+ properties = node.GetProperties()
+ for key in properties.keys():
+ print " %s = %s" % (key, properties[key])
+
print