summaryrefslogtreecommitdiffstats
path: root/test/test-service
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-11-01 01:25:46 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-11-01 01:25:46 +0100
commit330092231a0223b254287b65bfaccb63adbd42d2 (patch)
tree0fab5167e6feef285ba91fbadd035cfb10f95182 /test/test-service
parent063167c27c3e2cf9ac647a617abf345451de0787 (diff)
Add new service test script and fix adapter script
Diffstat (limited to 'test/test-service')
-rwxr-xr-xtest/test-service33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test-service b/test/test-service
new file mode 100755
index 00000000..e0052013
--- /dev/null
+++ b/test/test-service
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+import time
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
+
+adapter = dbus.Interface(bus.get_object("org.bluez", manager.FindAdapter("any")),
+ "org.bluez.Service")
+
+if (len(sys.argv) < 2):
+ print "Usage: %s <command>" % (sys.argv[0])
+ print ""
+ print " addrecord <file>"
+ sys.exit(1)
+
+if (sys.argv[1] == "addrecord"):
+ if (len(sys.argv) < 3):
+ print "Need file parameter"
+ else:
+ f = open(sys.argv[2])
+ record = f.read()
+ f.close()
+ handle = adapter.AddRecord(record)
+ print "0x%x" % (handle)
+ time.sleep(120)
+ sys.exit(0)
+
+print "Unknown command"
+sys.exit(1)