summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-03-14 21:56:40 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-03-14 21:56:40 +0000
commit10364cafd89f5a3a5bb6c2ea732f8b04dc729d96 (patch)
tree0772c75b359bee69623a678a943fc039354f7070
parentd8edaa380cac107763805e3a9afcf5ac24879403 (diff)
Add script for testing adapter functions
-rw-r--r--hcid/Makefile.am2
-rwxr-xr-xhcid/test-adapter27
2 files changed, 28 insertions, 1 deletions
diff --git a/hcid/Makefile.am b/hcid/Makefile.am
index 9c3ee058..c2f2d5cb 100644
--- a/hcid/Makefile.am
+++ b/hcid/Makefile.am
@@ -58,7 +58,7 @@ AM_YFLAGS = -d
CLEANFILES = lexer.c parser.c parser.h
EXTRA_DIST = hcid.8 hcid.conf.5 hcid.conf dbus-api.txt \
- list-devices test-discovery test-device simple-agent \
+ list-devices test-discovery test-adapter test-device simple-agent \
service-record.dtd \
service-did.xml service-spp.xml service-opp.xml service-ftp.xml
diff --git a/hcid/test-adapter b/hcid/test-adapter
new file mode 100755
index 00000000..9887451e
--- /dev/null
+++ b/hcid/test-adapter
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('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 " requestmode <mode>"
+ sys.exit(1)
+
+if (len(sys.argv) < 3):
+ print "Need parameter"
+ sys.exit(1)
+
+if (sys.argv[1] == "requestmode"):
+ mode = sys.argv[2]
+ adapter.RequestMode(mode)
+ sys.exit(0)