#!/usr/bin/python import time import dbus bus = dbus.SystemBus() xml = ' \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ' adapter = dbus.Interface(bus.get_object('org.bluez', '/'), '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))