From a849556fef64f864b5bb6cd2899696a55fbd33db Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 21 May 2007 12:51:48 +0000 Subject: Add test script for adding service records --- daemon/Makefile.am | 2 +- daemon/test-database | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 daemon/test-database 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 = ' \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +' + +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) -- cgit