Diff between 29b7375f5e6f63202b6186bd0e34e0ca925a4910 and 384f7e11a78e77bc2bd141810c955f3e39179aba

Changed Files

File Additions Deletions Status
Makefile.tools +2 -2 modified
test/test-profile +51 -0 added

Full Patch

diff --git a/Makefile.tools b/Makefile.tools
index d3b6f57..15fe4e2 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -209,7 +209,7 @@ EXTRA_DIST += test/sap_client.py test/hsplay test/hsmicro \
 		test/test-network test/simple-agent test/simple-service \
 		test/simple-endpoint test/test-audio test/test-input \
 		test/test-sap-server test/test-oob test/test-attrib \
-		test/test-proximity test/test-thermometer test/test-health \
-		test/test-health-sink test/service-record.dtd \
+		test/test-proximity test/test-thermometer test/test-profile \
+		test/test-health test/test-health-sink test/service-record.dtd \
 		test/service-did.xml test/service-spp.xml test/service-opp.xml \
 		test/service-ftp.xml test/simple-player test/test-nap
diff --git a/test/test-profile b/test/test-profile
new file mode 100755
index 0000000..455ef09
--- /dev/null
+++ b/test/test-profile
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from gi.repository import GObject
+
+import sys
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+from optparse import OptionParser, make_option
+
+class Profile(dbus.service.Object):
+	@dbus.service.method("org.bluez.Profile",
+					in_signature="", out_signature="")
+	def Release(self):
+		print("Release")
+		mainloop.quit()
+
+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")
+
+	option_list = [
+			make_option("-u", "--uuid", action="store",
+					type="string", dest="uuid"),
+			make_option("-p", "--path", action="store",
+					type="string", dest="path"),
+			]
+	parser = OptionParser(option_list=option_list)
+
+	(options, args) = parser.parse_args()
+
+	if not options.uuid:
+		options.uuid = "spp"
+
+	if not options.path:
+		options.path = "/foo/bar/profile"
+
+	profile = Profile(bus, options.path)
+
+	mainloop = GObject.MainLoop()
+
+	opts = { "Role" : "client" }
+
+	manager.RegisterProfile(options.path, options.uuid, opts)
+
+	mainloop.run()