Showing posts with label bluetooth. Show all posts
Showing posts with label bluetooth. Show all posts

Thursday, November 3, 2011

pybluez bluetooth inquiry

In my yesterday's blog i was talking about pyserial module . today's post i wanted to share a test code for pybluez module which is a python wrapper around the Bluetooth stack. in this sample code below , we will perform a inquiry of all the Bluetooth devices nearby and list them.

from bluetooth import *
print "performing inquiry..."
nearby_devices = discover_devices(lookup_names = True)
print "found %d devices" % len(nearby_devices)
for name, addr in nearby_devices:
print " %s - %s" % (addr, name)


don't forget to download the pybluez module before you try this. this will be an important step.
you will end up getting errors that the bluetooth module is not available if you try to run the program as is.

happy testing!

Wednesday, July 13, 2011

pybluez - bluetooth

For all who have been using python or who wanted to use python,
we can access RFCOMM profile via pybluez.
pybluez is the software supplied at code.google.com is a python wraper for bluetooth testing.
for now all the profiles are not supported ( read bluetooth related books/ postings for you to understand what profiles mean) . it supports only RFCOMM and L2CAP.
you can download it from the below.

http://code.google.com/p/pybluez