summaryrefslogtreecommitdiff
path: root/test/bt-handover
diff options
context:
space:
mode:
authorTimo Mueller <timo.mueller@bmw-carit.de>2013-12-06 08:58:39 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-12-07 02:27:09 +0100
commit411678d2210565ed061f709470c3a7097c0a8c06 (patch)
treec3a855e2ca42bd1fc5d6da8b88c625f2fc2ea7e1 /test/bt-handover
parent3ce73c1552cee7b7ad8307e01368cc2655d94d6c (diff)
downloadneard-411678d2210565ed061f709470c3a7097c0a8c06.tar.gz
neard-411678d2210565ed061f709470c3a7097c0a8c06.tar.bz2
neard-411678d2210565ed061f709470c3a7097c0a8c06.zip
test: Move paired device removal to separate method
To prepare the test script for the integration with BlueZ5 the code specific to BlueZ has been refactored into a separate method.
Diffstat (limited to 'test/bt-handover')
-rwxr-xr-xtest/bt-handover23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/bt-handover b/test/bt-handover
index 980f812..b4ead09 100755
--- a/test/bt-handover
+++ b/test/bt-handover
@@ -28,25 +28,28 @@ def device_removed(path, interfaces):
mainloop.quit()
break
-if __name__ == '__main__':
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+def remove_paired_devices():
+ bluez_manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+ "org.bluez.Manager")
- bus = dbus.SystemBus()
-
- bluez_manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-
bluez_adapter_path = bluez_manager.DefaultAdapter()
+ bluez_adapter = dbus.Interface(bus.get_object("org.bluez",
+ bluez_adapter_path),
+ "org.bluez.Adapter")
- bluez_adapter = dbus.Interface(bus.get_object("org.bluez", bluez_adapter_path),
- "org.bluez.Adapter")
+ print("Using %s" % bluez_adapter.object_path)
for bluez_path in bluez_adapter.ListDevices():
print("Removing %s" % (bluez_path))
bluez_adapter.RemoveDevice(bluez_path)
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
adapter_path = neardutils.find_adapter().object_path
- print("Adapter path %s" % (adapter_path))
+ print("Adapter path %s" % (adapter_path))
adapter = dbus.Interface(bus.get_object("org.neard", adapter_path),
"org.neard.Adapter")
@@ -56,6 +59,8 @@ if __name__ == '__main__':
if (powered == dbus.Boolean(0)):
adapter_props.Set("org.neard.Adapter", "Powered", dbus.Boolean(1))
+ remove_paired_devices()
+
polling = adapter_props.Get("org.neard.Adapter", "Polling")
if (polling == dbus.Boolean(0)):
adapter.StartPollLoop("Initiator")