Bluetooth programming in python [closed]

Closed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago .

Are there any nice Python libraries for Bluetooth programming? I tried PyBluez, but Eclipse doesn't recognize the module Bluetooth. Can anyone suggest tutorials for Python and Bluetooth?

1,094 7 7 gold badges 30 30 silver badges 61 61 bronze badges asked Jul 13, 2010 at 15:10 614 2 2 gold badges 12 12 silver badges 33 33 bronze badges can you import bluetooth from the regular interpreter? Commented Jul 13, 2010 at 17:49

Now i have found a good python bluetooth library lightblue. But when i try to sent file to my nokia 5310, it shows operation failed. Sometimes when programmed with interpreter it works fine. But when run as a .py file it wont. Anyone plz help me with this. Thanx in advance.

Commented Jan 24, 2011 at 18:05

@jvc, do you mean that the sending of the file failed, or that it succeeded but the import failed, or that something else failed. If the latter, add some prints or use the debugger. Either say, sounds like a new question, about Python on nokia 5310.

Commented Jul 3, 2011 at 23:53

6 Answers 6

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

Python 3.3 and above has inbuilt support for Bluetooth though sockets. While there is native support, many features of PyBluez are not available in native Python 3 sockets. For example, you cannot use inquiry scans or SDP.

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

answered Apr 21, 2013 at 9:20 4,118 4 4 gold badges 48 48 silver badges 69 69 bronze badges

I am currently experimenting with scapy in python. I have worked out how to send a packet via srbt1 command and i am currently fuzzing the protocol.

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

Explanation

I hope this helps someone out.

answered Jun 14, 2014 at 13:07 Red Dragon Red Dragon 21 2 2 bronze badges

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

answered Sep 2, 2011 at 6:32 1,972 1 1 gold badge 13 13 silver badges 13 13 bronze badges From their site: This project is no longer maintained. Commented Mar 11, 2013 at 18:23

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

The examples page (which i cant link directly for some reason) contains an example for using PySerial over bluetooth.

answered Sep 2, 2011 at 9:13 708 6 6 silver badges 15 15 bronze badges

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

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

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

1 1 1 silver badge answered Dec 2, 2016 at 3:49 21 1 1 bronze badge

Link-only answers are highly discouraged here because the links may become dead in the future. I suggest you edit your answer with quotes from the sources you cite.

Commented Dec 2, 2016 at 4:13

If the interactive mode of gatttool (part of Bluez) works for you then Pygatt is a nice wrapper around this tool. Well maintained. Uses pexpect to interact with gatttool. Also wraps "hcitool lescan" to scan for 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) 
answered Jan 26, 2016 at 18:53 Keptenkurk Keptenkurk 81 4 4 bronze badges

Linked

Related

Hot Network Questions

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.9.4.14806