stuck with PyOBEX

David Boddie david at boddie.org.uk
Thu Apr 30 03:07:17 CEST 2009


On Wednesday 29 April 2009 07:42, alejandro wrote:

> So I should connect trough pybluez and send with obex??

Yes, or you could try lightblue:

  http://lightblue.sourceforge.net/

I've updated PyOBEX to try and be a bit more flexible when it comes to
Bluetooth socket implementations, so you might want to give that a try:

  http://pypi.python.org/pypi/PyOBEX

If you use PyOBEX, you find devices with the bluetooth module (from PyBluez)
then connect and send using PyOBEX:

  # Find device addresses.
  devices = bluetooth.discover_devices()

  # List services provided by a device with the given address.
  bluetooth.find_service(address=device_address)

  # Find the port used for the file transfer service.
  port = bluetooth.find_service(uuid="E006",
                                address=device_address)[0]["port"]

  # List the files in the device's root directory.
  from PyOBEX.client import BrowserClient
  client = BrowserClient(device_address, port)
  client.connect()
  client.listdir()
  client.disconnect()

Good luck!

David



More information about the Python-list mailing list