| #!/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) |