--- test/simple-oobprovider | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) create mode 100755 test/simple-oobprovider diff --git a/test/simple-oobprovider b/test/simple-oobprovider new file mode 100755 index 0000000..135f0f7 --- /dev/null +++ b/test/simple-oobprovider @@ -0,0 +1,54 @@ +#!/usr/bin/python +# Copyright (C) 2010 ST-Ericsson SA +# Author: Szymon Janc <szymon.janc@xxxxxxxxx> for ST-Ericsson + +import gobject + +import sys +import dbus +import dbus.service +import dbus.mainloop.glib + +class Provider(dbus.service.Object): + + remotedata = None + + @dbus.service.method("org.bluez.OOB", + in_signature="s", out_signature="ayay") + + def RequestRemoteOobData(self, address): + print "RequestRemoteOobData for %s" % (address) + return self.remotedata + +if __name__ == '__main__': + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + + manager = dbus.Interface(bus.get_object("org.bluez", "/"), + "org.bluez.Manager") + adapter = dbus.Interface(bus.get_object("org.bluez", + manager.DefaultAdapter()), "org.bluez.Adapter") + adr = adapter.GetProperties()['Address'] + + oob = dbus.Interface(bus.get_object("org.bluez", "/org/bluez"), + "org.bluez.OOB") + + path = "/test/oobprovider" + provider = Provider(bus, path) + + mainloop = gobject.MainLoop() + + oob.RegisterProvider(path) + + print "Local data for %s:" % (adr) + print oob.UpdateLocalOobData(adr) + + provider.remotedata = input("Provide remote data (in python syntax):\n") + + print "You may try pairing now" + + mainloop.run() + + #adapter.UnregisterProvider(path) + #print "Provider unregistered" -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html