7 sys.setdefaultencoding('utf8')
9 bus = dbus.SessionBus()
11 client = dbus.Interface(bus.get_object("org.openobex.client", "/"),
12 "org.openobex.Client")
14 print "Creating Session"
15 session_path = client.CreateSession({"Destination": sys.argv[1], "Target": "PBAP"})
16 pbap = dbus.Interface(bus.get_object("org.openobex.client", session_path),
17 "org.openobex.PhonebookAccess")
18 session = dbus.Interface(bus.get_object("org.openobex.client", session_path),
19 "org.openobex.Session")
21 paths = ["PB", "ICH", "OCH", "MCH", "CCH"]
24 print "\n--- Select Phonebook %s ---\n" % (path)
25 pbap.Select("int", path)
27 print "\n--- GetSize ---\n"
29 print "Size = %d\n" % (ret)
31 print "\n--- List vCard ---\n"
34 print "%s : %s" % (item[0], item[1])
35 pbap.SetFormat("vcard30")
36 pbap.SetFilter(["VERSION", "FN", "TEL"]);
37 ret = pbap.Pull(item[0])
40 print "\n--- PullAll ---\n"
41 pbap.SetFormat("vcard30")
42 pbap.SetFilter(["VERSION", "FN", "TEL"]);
44 print "%s" % (ret.encode('utf8'))