summaryrefslogtreecommitdiff
path: root/test/pull-business-card
blob: b13968d65a074a11f4d58aeaae642b2ae6f0876d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python

import sys
import dbus
import gobject
import dbus.mainloop.glib

def success():
	mainloop.quit()
	return

def failure(error):
	print error
	mainloop.quit()
	return


if __name__ == '__main__':
	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

	mainloop = gobject.MainLoop()

	bus = dbus.SessionBus()
	client = dbus.Interface(bus.get_object("org.openobex.client", "/"),
							"org.openobex.Client")

	if (len(sys.argv) < 3):
		print "Usage: %s <device> <file>" % (sys.argv[0])
		sys.exit(1)

	client.PullBusinessCard({ "Destination": sys.argv[1] }, sys.argv[2],
				reply_handler=success, error_handler=failure)

	mainloop.run()