Add support for Powered property to test-adapter

This commit is contained in:
Johan Hedberg 2008-11-29 16:09:21 +02:00
parent c78f35d9bf
commit 8e7a46183e

View File

@ -16,6 +16,7 @@ if (len(sys.argv) < 2):
print ""
print " address"
print " name [name]"
print " powered [on/off]"
print " pairable [on/off]"
print " pairabletimeout [timeout]"
print " discoverable [on/off]"
@ -36,6 +37,20 @@ if (sys.argv[1] == "name"):
adapter.SetProperty("Name", sys.argv[2])
sys.exit(0)
if (sys.argv[1] == "powered"):
if (len(sys.argv) < 3):
properties = adapter.GetProperties()
print properties["Powered"]
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("Powered", value)
sys.exit(0)
if (sys.argv[1] == "pairable"):
if (len(sys.argv) < 3):
properties = adapter.GetProperties()