From cf92b6dc9c0fe11ace1a9ca4e7d18cb411ba56ba Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 1 Sep 2008 22:34:04 +0200 Subject: Move test scripts into test directory --- test/simple-service | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 test/simple-service (limited to 'test/simple-service') diff --git a/test/simple-service b/test/simple-service new file mode 100755 index 00000000..5279a3a6 --- /dev/null +++ b/test/simple-service @@ -0,0 +1,127 @@ +#!/usr/bin/python + +import sys +import time +import dbus + +xml = ' \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +' + +bus = dbus.SystemBus() +manager = dbus.Interface(bus.get_object("org.bluez", "/"), + "org.bluez.Manager") + +if len(sys.argv) > 1: + path = manager.FindAdapter(sys.argv[1]) +else: + path = manager.DefaultAdapter() + +adapter = dbus.Interface(bus.get_object("org.bluez", path), + "org.bluez.Adapter") + +handle = adapter.AddServiceRecord(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 + +adapter.RemoveServiceRecord(dbus.UInt32(handle)) -- cgit