You could try using a python library like pybluez. In order to install it you must first install setuptools, a dependency. To do so run the following line:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
Now download the package from karulis/pybluez · GitHub and decompress it on your PC. Once that has finished copy the folder into your Edison. Now run the following commands:
cd pybluez-master python setup.py install
Now the install process should start. Once it’s finished, you can run the following example to make an inquiry and test that the library is actually working.
from subprocess import call import bluetooth print("unblocking bluetooth...") call(["rfkill", "unblock", "bluetooth"]) call(["sleep", "1"]) print("performing inquiry...") nearby_devices = bluetooth.discover_devices( duration=8, lookup_names=True, flush_cache=True, lookup_class=False) print("found %d devices" % len(nearby_devices)) for addr, name in nearby_devices: try: print(" %s - %s" % (addr, name)) except UnicodeEncodeError: print(" %s - %s" % (addr, name.encode('utf-8', 'replace')))
This is a slightly modified version of the example found in pybluez/inquiry.py at master · karulis/pybluez · GitHub it was only changed to add the lines that unblock Bluetooth.
You might also find some useful information in this book: An Introduction to Bluetooth Programming, I suggest you to read it.
Thank you Intel_Peter for your answer.
I found another link that could be useful as well. It uses pyserial and is quite simple to follow. Edison to Edison Bluetooth | Musings from Stephanie.
That's great to hear rana.helal, I'm glad that you were able to find a way to continue with your project. If you have any other doubt, don't hesitate to come back to the community.