7 manager = dbus.Interface(bus.get_object("org.bluez", "/"),
10 def extract_objects(object_list):
12 for object in object_list:
14 list = list + val[val.rfind("/") + 1:] + " "
17 def extract_uuids(uuid_list):
19 for uuid in uuid_list:
20 if (uuid.endswith("-0000-1000-8000-00805f9b34fb")):
21 if (uuid.startswith("0000")):
22 val = "0x" + uuid[4:8]
24 val = "0x" + uuid[0:8]
27 list = list + val + " "
30 adapter_list = manager.ListAdapters()
32 for i in adapter_list:
33 adapter = dbus.Interface(bus.get_object("org.bluez", i),
37 properties = adapter.GetProperties()
38 for key in properties.keys():
39 value = properties[key]
40 if (key == "Devices"):
41 list = extract_objects(value)
42 print " %s = %s" % (key, list)
43 elif (key == "UUIDs"):
44 list = extract_uuids(value)
45 print " %s = %s" % (key, list)
47 print " %s = %s" % (key, value)
50 device_list = properties["Devices"]
55 device = dbus.Interface(bus.get_object("org.bluez", n),
57 print " [ " + n + " ]"
59 properties = device.GetProperties()
60 for key in properties.keys():
61 value = properties[key]
63 list = extract_objects(value)
64 print " %s = %s" % (key, list)
65 elif (key == "UUIDs"):
66 list = extract_uuids(value)
67 print " %s = %s" % (key, list)
68 elif (key == "Class"):
69 print " %s = 0x%06x" % (key, value)
70 elif (key == "Vendor"):
71 print " %s = 0x%04x" % (key, value)
72 elif (key == "Product"):
73 print " %s = 0x%04x" % (key, value)
74 elif (key == "Version"):
75 print " %s = 0x%04x" % (key, value)
77 print " %s = %s" % (key, value)
80 node_list = properties["Nodes"]
85 node = dbus.Interface(bus.get_object("org.bluez", x),
87 print " [ " + x + " ]"
89 properties = node.GetProperties()
90 for key in properties.keys():
91 print " %s = %s" % (key, properties[key])