summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-05-21 12:51:48 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-05-21 12:51:48 +0000
commita849556fef64f864b5bb6cd2899696a55fbd33db (patch)
tree554ec1ddeac2079f09254f2d944f4a788d429ccf
parent101a0f5af55620c7108c39cd24c4f6962bfc1811 (diff)
Add test script for adding service records
-rw-r--r--daemon/Makefile.am2
-rwxr-xr-xdaemon/test-database48
2 files changed, 49 insertions, 1 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index fc2a92c1..e3fd75fe 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -50,6 +50,6 @@ AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@
INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/sdpd
-EXTRA_DIST = bluetooth.conf echo.service hal-namespace.txt
+EXTRA_DIST = bluetooth.conf echo.service test-database hal-namespace.txt
MAINTAINERCLEANFILES = Makefile.in
diff --git a/daemon/test-database b/daemon/test-database
new file mode 100755
index 00000000..853ae85b
--- /dev/null
+++ b/daemon/test-database
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+import time
+import dbus
+
+bus = dbus.SystemBus()
+
+xml = ' \
+<?xml version="1.0" encoding="UTF-8" ?> \
+<record> \
+ <attribute id="0x0001"> \
+ <sequence> \
+ <uuid value="0x1101"/> \
+ </sequence> \
+ </attribute> \
+ <attribute id="0x0004"> \
+ <sequence> \
+ <sequence> \
+ <uuid value="0x0100"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value="0x0003"/> \
+ <uint8 value="23" name="channel"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ <attribute id="0x0100"> \
+ <text value="COM5" name="name"/> \
+ </attribute> \
+</record> \
+'
+
+database = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
+ 'org.bluez.Database')
+
+handle = database.AddServiceRecordFromXML(xml)
+
+print "Service record with handle 0x%04x added" % (handle)
+
+print "Press CTRL-C to remove service record"
+
+try:
+ time.sleep(1000)
+ print "Terminating session"
+except:
+ pass
+
+database.RemoveServiceRecord(handle)