All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCHv3 4/7] Add simple-oobprovider for testing.
Date: Tue, 16 Nov 2010 16:44:04 +0100	[thread overview]
Message-ID: <1289922247-20712-5-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1289922247-20712-1-git-send-email-szymon.janc@tieto.com>

---
 test/simple-oobprovider |   61 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 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..4a1ebd8
--- /dev/null
+++ b/test/simple-oobprovider
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+# Copyright (C) 2010  ST-Ericsson SA
+# Author: Szymon Janc <szymon.janc@tieto.com> for ST-Ericsson
+
+import gobject
+
+import sys
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+
+class NoOobData(dbus.DBusException):
+        _dbus_error_name = "org.bluez.Error.NoData"
+
+
+class Provider(dbus.service.Object):
+
+	remotedata = None
+
+	@dbus.service.method("org.bluez.OOB",
+					in_signature="s", out_signature="ayay")
+
+	def RequestRemoteOobData(self, device):
+		print "RequestRemoteOobData for %s" % (device)
+		if (self.remotedata != None):
+			return self.remotedata
+		raise NoOobData("No OOB data present")
+
+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_path = manager.DefaultAdapter()
+	adapter = dbus.Interface(bus.get_object("org.bluez",
+			adapter_path), "org.bluez.Adapter")
+
+	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:" % (adapter_path)
+	print oob.ReadLocalOobData(adapter_path)
+
+	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


  parent reply	other threads:[~2010-11-16 15:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 15:44 [PATCHv3 0/7] Support for out of band association model Szymon Janc
2010-11-16 15:44 ` [PATCHv3 1/7] Add support for Out of Band (OOB) " Szymon Janc
2010-11-16 16:16   ` Johan Hedberg
2010-11-16 15:44 ` [PATCHv3 2/7] Add DBus OOB plugin Szymon Janc
2010-11-16 16:30   ` Johan Hedberg
2010-11-16 15:44 ` [PATCHv3 3/7] Add DBus OOB API documentation Szymon Janc
2010-11-16 16:37   ` Johan Hedberg
2010-11-17 12:49     ` Szymon Janc
2010-11-18 10:51       ` Szymon Janc
2010-11-18 13:45         ` Johan Hedberg
2010-11-16 15:44 ` Szymon Janc [this message]
2010-11-16 15:44 ` [PATCHv3 5/7] Add approval request for incoming pairing requests with OOB mechanism Szymon Janc
2010-11-16 16:24   ` Johan Hedberg
2010-11-17 16:03     ` Szymon Janc
2010-11-16 15:44 ` [PATCHv3 6/7] Update DBus OOB API with RequestApproval method Szymon Janc
2010-11-16 15:44 ` [PATCHv3 7/7] simple-agent - add RequestApproval method for OOB pairing Szymon Janc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289922247-20712-5-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.