summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)