summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-08-23 11:06:05 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-08-23 11:06:05 +0000
commit2d5a57de38634f451a1c1982827e477c3751d9cb (patch)
tree6037eefe37eba69ff9a1f6ca615f2aa11da1b10a /hcid
parent2d6f782811c78522ae2efab63d9b482d87813182 (diff)
Add test-device script
Diffstat (limited to 'hcid')
-rw-r--r--hcid/Makefile.am2
-rwxr-xr-xhcid/test-device43
2 files changed, 44 insertions, 1 deletions
diff --git a/hcid/Makefile.am b/hcid/Makefile.am
index 4967c25a..1fc640f1 100644
--- a/hcid/Makefile.am
+++ b/hcid/Makefile.am
@@ -53,7 +53,7 @@ AM_YFLAGS = -d
CLEANFILES = lexer.c parser.c parser.h
-EXTRA_DIST = hcid.8 hcid.conf.5 hcid.conf dbus-api.txt \
+EXTRA_DIST = hcid.8 hcid.conf.5 hcid.conf dbus-api.txt test-device \
service-record.dtd service-did.xml service-spp.xml \
service-opp.xml service-ftp.xml
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)