Bluetooth programming in python

Are there any beautiful Python libraries for Bluetooth programming? I tried PyBluez, but Eclipse does not recognize the Bluetooth module. Can anyone suggest tutorials for Python and Bluetooth?

+5
source share
6 answers

I have not tried this personally, but I hope to try this cross platform bluetooth python api: Lightblue

+1
source

PyBluez now supports Python 3, so now it can work for you.

Python 3.3 and above have built-in support for Bluetooth, although sockets . Although there is built-in support, many PyBluez features are not available in native Python 3 sockets. For example, you cannot use query scanning or SDP.

I created a tutorial describing the differences between using PyBluez and Python 3 sockets for a simple Bluetooth application.

+6
source

I am currently experimenting with scapy in python. I have developed how to send a packet using the srbt1 command, and I'm currently messing up the protocol.

packet = fuzz(L2CAP_Hdr('1111111111111111111111111111111')) srbt1("20:21:A5:82:44:01",packet,0) 

Explanation

  • srbt1 <sends the BT packet.
  • "20: 21: A5: 82: 44: 01" <defines the device you want to connect to
  • packet <defines payload
  • 0 <defines my BT card.

Hope this helps someone.

+2
source

Since you mention your Nokia phone, you might like this book: http://www.mobilepythonbook.org/

The examples page (for some reason I can’t link directly) contains an example of using PySerial over Bluetooth.

+1
source

If the gatttool interactive mode (part of Bluez) works for you, then Pygatt is a good cover around this tool. In a good condition. Uses pexpect to interact with gatttool. Also wraps "hcitool lescan" for scanning Bluetooth devices. Basic usage example:

 import pygatt.backend adapter = pygatt.backends.GATTToolBackend() adapter.start() device = adapter.connect('xx:xx:xx:xx:xx:xx', 5, 'random') device.char_write_handle(0x23,[0x20, 0x21]) device.subscribe('00008a22-0000-1000-8000-00805f9b34fb',callback = mycallback, indication=True) 
0
source

I used Pybluez recently with good results, here you can find git. https://github.com/karulis/pybluez

And you can find a neat and useful tutorial here a neat tutorial here. https://people.csail.mit.edu/albert/bluez-intro/c212.html

If you are using Windows, you need to have Visual C ++, more details on the git page.

0
source

All Articles