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 :
- import bluetooth
- import pyosd
- from time import sleep
-
- p = pyosd.osd()
-
- p.set_pos(pyosd.POS_MID)
- p.set_align(pyosd.ALIGN_CENTER)
- p.set_colour("green")
-
- p.display( "Scanning for bluetooth device")
-
- nearby_devices = bluetooth.discover_devices(duration=20, lookup_names = True)
-
- str= "found %d devices" % len(nearby_devices)
- print str
- p.display(str)
- sleep(2)
-
- for name, addr in nearby_devices:
- p.display( " %s - %s" % (addr, name))
- print (" %s - %s" % (addr,name))
- 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:
Postar um comentário