blob: 9e11322e3926c326e99e6224acc57c6743d3dccb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/python
import dbus
def extract_list(list):
val = "["
for i in list:
val += " " + str(i)
val += " ]"
return val
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.neard", "/"),
"org.neard.Manager")
properties = manager.GetProperties()
for path in properties["Adapters"]:
print "[ %s ]" % (path)
adapter = dbus.Interface(bus.get_object("org.neard", path),
"org.neard.Adapter")
properties = adapter.GetProperties()
for key in properties.keys():
if key in ["Powered", "Polling"]:
if properties[key] == dbus.Boolean(1):
val = "true"
else:
val = "false"
elif key in ["Protocols", "Tags", "Devices"]:
val = extract_list(properties[key])
else:
val = str(properties[key])
print " %s = %s" % (key, val)
|