DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Finding A Bluetooth Device With Pybluez

  • submit to reddit
        Last time, I show how to use pys60 to discover
bluetooth devices. Here's another bluetooth
snippet, but this time it use pybluez (BT on Linux).
import bluetooth

target_name = "My Phone"
target_address = None

nearby_devices = bluetooth.discover_devices()

for bdaddr in nearby_devices:
    if target_name == bluetooth.lookup_name( bdaddr ):
        target_address = bdaddr

if target_address is not None:
    print "found target bluetooth device with address ", target_address
    print "could not find target bluetooth device nearby"
Taken from Albert Huang's exellent <a href=>pybluez tutorial</a>.    


Snippets Manager replied on Mon, 2009/05/04 - 9:01am

I am doing the same application ,that shows bluetooth devices around, Using flash lite.I am using kunerilite for bluetooth support.Could you please help me o this one? like if there is any tutorial. Thanks

Mrz Namez replied on Wed, 2009/04/22 - 12:09pm

Albert's Tutorial is missing... but it's not gone. Check here