pybluez is a python bindings for the bluez application which enables you to interface with bluetooth devices on your computer.

Combined with the power of python dynamic typing, you will be able to do Rapid Application Development and test mobile bluetooth application quickly on your computer

Here's a snippets which combines pyosd and pybluez which scans for nearby bluetooth devices and display the result on screen :

PYTHON:
  1. import bluetooth
  2. import pyosd
  3. from time import sleep
  4. p = pyosd.osd()
  5. p.set_pos(pyosd.POS_MID)
  6. p.set_align(pyosd.ALIGN_CENTER)
  7. p.set_colour("green")
  8. p.display( "Scanning for bluetooth device")
  9. nearby_devices = bluetooth.discover_devices(duration=20, lookup_names = True)
  10. str= "found %d devices" % len(nearby_devices)
  11. print str
  12. p.display(str)
  13. sleep(2)
  14. for name, addr in nearby_devices:
  15. p.display( " %s - %s" % (addr, name))
  16. print (" %s - %s" % (addr,name))
  17. sleep(2)

Python enables Rapid Application Development on your computer without much fuss. Coupled with pygtk and wxPython acting as GUI, you can create a lot of bluetooth application to interface with your mobile devices, limited only by your imagination.

Coool!!

Source : Mobile Programming pit stop

0 comentários:

top