diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-08-23 11:06:05 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-08-23 11:06:05 +0000 |
commit | 2d5a57de38634f451a1c1982827e477c3751d9cb (patch) | |
tree | 6037eefe37eba69ff9a1f6ca615f2aa11da1b10a /hcid/test-device | |
parent | 2d6f782811c78522ae2efab63d9b482d87813182 (diff) |
Add test-device script
Diffstat (limited to 'hcid/test-device')
-rwxr-xr-x | hcid/test-device | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/hcid/test-device b/hcid/test-device new file mode 100755 index 00000000..034a9c6f --- /dev/null +++ b/hcid/test-device @@ -0,0 +1,43 @@ +#!/usr/bin/python + +import sys +import dbus + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), + 'org.bluez.Manager') + +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 " create <address>" + print " remove <path>" + print " list" + sys.exit(1) + +if (sys.argv[1] == "list"): + list = adapter.ListDevices() + print list + sys.exit(0) + +if (len(sys.argv) < 3): + print "Need parameter" + sys.exit(1) + +if (sys.argv[1] == "create"): + address = sys.argv[2] + device = adapter.CreateDevice(address) + print device + sys.exit(0) + +if (sys.argv[1] == "remove"): + path = sys.argv[2] + adapter.RemoveDevice(path) + sys.exit(0) + +print "Unknown command" +sys.exit(1) |