Change test scripts to use Powered property
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Dec 2008 12:27:51 +0000 (13:27 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Dec 2008 12:27:51 +0000 (13:27 +0100)
test/disable-device
test/enable-device

index ac55e77..31e9f95 100755 (executable)
@@ -7,17 +7,17 @@ bus = dbus.SystemBus()
 manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"),
                                        'org.moblin.connman.Manager')
 
-elements = manager.ListElements()
+properties = manager.GetProperties()
 
-for path in elements:
-       element = dbus.Interface(bus.get_object('org.moblin.connman', path),
-                                               'org.moblin.connman.Element')
+for path in properties["Devices"]:
+       device = dbus.Interface(bus.get_object('org.moblin.connman', path),
+                                               'org.moblin.connman.Device')
 
-       properties = element.GetProperties()
+       properties = device.GetProperties()
 
-       if (properties["Type"] != "device"):
+       if (properties["Powered"] == dbus.Boolean(0)):
                continue
 
        print "[ %s ]" % (path)
 
-       element.Disable()
+       device.SetProperty("Powered", dbus.Boolean(0));
index 55bd1f1..e79b736 100755 (executable)
@@ -7,17 +7,17 @@ bus = dbus.SystemBus()
 manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"),
                                        'org.moblin.connman.Manager')
 
-elements = manager.ListElements()
+properties = manager.GetProperties()
 
-for path in elements:
-       element = dbus.Interface(bus.get_object('org.moblin.connman', path),
-                                               'org.moblin.connman.Element')
+for path in properties["Devices"]:
+       device = dbus.Interface(bus.get_object('org.moblin.connman', path),
+                                               'org.moblin.connman.Device')
 
-       properties = element.GetProperties()
+       properties = device.GetProperties()
 
-       if (properties["Type"] != "device"):
+       if (properties["Powered"] == dbus.Boolean(1)):
                continue
 
        print "[ %s ]" % (path)
 
-       element.Enable()
+       device.SetProperty("Powered", dbus.Boolean(1));