bluez/test/exchange-business-cards
Preston Hunt 832412f5e3 test examples: fix python3 errors
These scripts have "#!/usr/bin/env python3" but have python2 syntax in
several places. Fixed by running the "2to3" utility.
2024-05-13 09:56:37 -04:00

21 lines
564 B
Python
Executable File

#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
import sys
import dbus
bus = dbus.SessionBus()
client = dbus.Interface(bus.get_object("org.bluez.obex", "/org/bluez/obex"),
"org.bluez.obex.Client")
if (len(sys.argv) < 4):
print("Usage: %s <device> <clientfile> <file>" % (sys.argv[0]))
sys.exit(1)
print("Creating Session")
path = client.CreateSession(sys.argv[1], { "Target": "OPP" })
opp = dbus.Interface(bus.get_object("org.bluez.obex", path),
"org.bluez.obex.ObjectPush")
opp.ExchangeBusinessCards(sys.argv[2], sys.argv[3])