summaryrefslogtreecommitdiffstats
path: root/test/list-devices
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-09-01 22:34:04 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-09-01 22:34:04 +0200
commitcf92b6dc9c0fe11ace1a9ca4e7d18cb411ba56ba (patch)
tree54bfe64770b761a0148972fd9446921d446ef895 /test/list-devices
parentb2d5d2c1062af55008c5759c0fee2a1aecd83f66 (diff)
Move test scripts into test directory
Diffstat (limited to 'test/list-devices')
-rwxr-xr-xtest/list-devices52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/list-devices b/test/list-devices
new file mode 100755
index 00000000..ec6c580a
--- /dev/null
+++ b/test/list-devices
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+ "org.bluez.Manager")
+
+def extract_uuids(uuid_list):
+ list = ""
+ for uuid in uuid_list:
+ if (uuid.endswith("-0000-1000-8000-00805f9b34fb")):
+ if (uuid.startswith("0000")):
+ val = "0x" + uuid[4:8]
+ else:
+ val = "0x" + uuid[0:8]
+ else:
+ val = str(uuid)
+ list = list + val + " "
+ return list
+
+adapter_list = manager.ListAdapters()
+
+for i in adapter_list:
+ adapter = dbus.Interface(bus.get_object("org.bluez", i),
+ "org.bluez.Adapter")
+ print "[ " + i + " ]"
+
+ properties = adapter.GetProperties()
+ for key in properties.keys():
+ print " %s = %s" % (key, properties[key])
+
+ device_list = adapter.ListDevices()
+
+ for n in device_list:
+ device = dbus.Interface(bus.get_object("org.bluez", n),
+ "org.bluez.Device")
+ print " [ " + n + " ]"
+
+ properties = device.GetProperties()
+ for key in properties.keys():
+ value = properties[key]
+ if (key == "UUIDs"):
+ list = extract_uuids(value)
+ print " %s = %s" % (key, list)
+ elif (key == "Class"):
+ print " %s = 0x%06x" % (key, value)
+ else:
+ print " %s = %s" % (key, value)
+
+ print