diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-03-14 23:21:14 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-03-14 23:21:14 +0000 |
commit | 6919f96ac5f419f9756157a02f9a0d391896243e (patch) | |
tree | 54d72b3831db5512d0796866da7a11a2a8835d40 /hcid | |
parent | 44b781c2d0553702ed830006a14d3bf4e3473b4c (diff) |
Add missing commands to adapter test script
Diffstat (limited to 'hcid')
-rwxr-xr-x | hcid/test-adapter | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/hcid/test-adapter b/hcid/test-adapter index 4e5c1e56..aab98dd2 100755 --- a/hcid/test-adapter +++ b/hcid/test-adapter @@ -5,23 +5,31 @@ import dbus bus = dbus.SystemBus() -manager = dbus.Interface(bus.get_object('org.bluez', '/'), 'org.bluez.Manager') +manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager") -adapter = dbus.Interface(bus.get_object('org.bluez', manager.DefaultAdapter()), - 'org.bluez.Adapter') +adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()), + "org.bluez.Adapter") if (len(sys.argv) < 2): print "Usage: %s <command>" % (sys.argv[0]) print "" + print " address" print " name [name]" print " mode [mode]" print " requestmode <mode>" + print " discoverabletimeout [timeout]" + print " periodicdiscovery [on/off]" sys.exit(1) +if (sys.argv[1] == "address"): + properties = adapter.GetProperties() + print properties["Address"] + sys.exit(0) + if (sys.argv[1] == "name"): if (len(sys.argv) < 3): properties = adapter.GetProperties() - print properties['Name'] + print properties["Name"] else: adapter.SetProperty("Name", sys.argv[2]) sys.exit(0) @@ -29,7 +37,7 @@ if (sys.argv[1] == "name"): if (sys.argv[1] == "mode"): if (len(sys.argv) < 3): properties = adapter.GetProperties() - print properties['Mode'] + print properties["Mode"] else: adapter.SetProperty("Mode", sys.argv[2]) sys.exit(0) @@ -40,3 +48,25 @@ if (sys.argv[1] == "requestmode"): else: adapter.RequestMode(sys.argv[2]) sys.exit(0) + +if (sys.argv[1] == "discoverabletimeout"): + if (len(sys.argv) < 3): + properties = adapter.GetProperties() + print properties["DiscoverableTimeout"] + else: + adapter.SetProperty("DiscoverableTimeout", sys.argv[2]) + sys.exit(0) + +if (sys.argv[1] == "periodicdiscovery"): + if (len(sys.argv) < 3): + properties = adapter.GetProperties() + print properties["PeriodicDiscovery"] + else: + if (sys.argv[2] == "on"): + value = dbus.Boolean(1) + elif (sys.argv[2] == "off"): + value = dbus.Boolean(0) + else: + value = dbus.Boolean(sys.argv[2]) + adapter.SetProperty("PeriodicDiscovery", value) + sys.exit(0) |