Update object variable to match its type
[connman] / test / disable-network
1 #!/usr/bin/python
2
3 import dbus
4
5 bus = dbus.SystemBus()
6
7 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
8                                         "org.moblin.connman.Manager")
9
10 elements = manager.ListElements()
11
12 for path in elements:
13         element = dbus.Interface(bus.get_object("org.moblin.connman", path),
14                                                 "org.moblin.connman.Element")
15
16         try:
17                 properties = element.GetProperties()
18                 if (properties["Type"] != "network"):
19                         continue
20
21                 if (properties["Enabled"] == dbus.Boolean(1)):
22                         print "Disabling %s" % (path)
23                         element.Disable()
24         except:
25                 pass