diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-05-21 12:51:48 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-05-21 12:51:48 +0000 |
commit | a849556fef64f864b5bb6cd2899696a55fbd33db (patch) | |
tree | 554ec1ddeac2079f09254f2d944f4a788d429ccf /daemon/test-database | |
parent | 101a0f5af55620c7108c39cd24c4f6962bfc1811 (diff) |
Add test script for adding service records
Diffstat (limited to 'daemon/test-database')
-rwxr-xr-x | daemon/test-database | 48 |
1 files changed, 48 insertions, 0 deletions
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) |