I am new to Edison, i am currently working on a project which requires data transfer from Edison to Mac/Linux. I am currently using Eclipse IDE to write code in C.
1.How to identify devices that are close to Edison by 1-2 meters?
2.How to transfer simple textual data (MAC Address and device name) of devices that are close by 1-2 meters to MAC/Linux PC over BLE.?
My first suggestion would be that you try sending the data directly from the Edison's Linux console to your target (either on OSX or Linux) before trying to write the code for it.
Do you have to use BLE or can you use traditional Bluetooth? If you must use BLE you should install GattTool, you can learn how to do it in https://software.intel.com/en-us/articles/using-the-generic-attribute-profile-gatt-in-bluetooth-low-... Using the Generic Attribute Profile. I would suggest you to read https://github.com/tigoe/BLEDocs/wiki/Introduction-to-Bluetooth-LE Introduction to Bluetooth LE, that document is very informative and might help you understand how BLE works. Also, http://www.jaredwolff.com/blog/get-started-with-bluetooth-low-energy/ Get started with Bluetooth Low Energy might be of help for you to get started with GattTool.
You might also be interested in reading the http://www.intel.com/support/edison/sb/CS-035381.htm Edison's Bluetooth User Guide, it contains a lot of information about the Edison's Bluetooth capabilities. I hope this information gives you a hint on where to start with your project.
Thanks Peter. I have to use BLE in my project. I tried installing Gatttool as mentioned in link: https://software.intel.com/en-us/articles/using-the-generic-attribute-profile-gatt-in-bluetooth-low-... https://software.intel.com/en-us/articles/using-the-generic-attribute-profile-gatt-in-bluetooth-low-.... I am able to scan and discover BLE devices using bluetoothctl command but not using hcitool lescan.
hcitool lescan command does not detect my Iphone6 in the discovered devices. what could be the reason? Also, I am unable to connect using gatttool. Following is the error.
root@edison:~# export PATH=$PATH:~/bluez-5.24/attrib/
root@edison:~# gatttool -b 4C:7C:5F:35:8B:9F -I
Attempting to connect to 4C:7C:5F:35:8B:9F
Error: connect error: Connection refused (111)
That's because you are searching for LE devices, an iPhone will not be found as a LE device even though it is compatible with them, you will be able to find your iPhone if you run the command hcitool scan.
when I run the hcitool lescan command it does not detect/list Iphone6. Do I need to load the image on Edison? I have installed integrated MAC OS installer and not the image. Please let me know how to go further to connect using gatttool and make hcitool lescan work.
Thanks in advance.
hcitool lescan is for BLE only, as I mentioned above an iPhone will not be recognized as a BLE device even though it is compatible with Bluetooth 4.0. If you would like to find your iPhone you will have to use the command hcitool scan.
Also, you mentioned that you haven't flashed the latest image onto your Edison, I'd suggest you to do it since in recent versions of the image there has been updates to the Edison's Bluetooth features.
Thanks Peter. Can the Mac Book Pro which is compatible with Bluetooth 4.0 be detected as a BLE device by the Edison? I need to send the string (MAC address and device name) to the laptop over BLE from Edison to laptop. Please let me know which profile is best suited to transfer textual data over BLE?
I have tried the following code from links: http://people.csail.mit.edu/albert/bluez-intro/c404.html simplescan.c and http://people.csail.mit.edu/albert/bluez-intro/x502.html rfcomm-client.c. I am not sure if this code works for BLE as it worked fine for Classic Bluetooth.
I went through http://www.intel.com/content/www/us/en/support/boards-and-kits/000005743.html Bluetooth® User Guide, but kind of confused as to which profile to choose for BLE.
Also, how to scan for BLE devices that are close to edison by 2-3 meters and not beyond in an open area . Is there any specific way to do this? Your inputs will be highly valued.
What happens is that your Edison (a computer) would be connecting to your MAC (another computer), and BLE usually requires "slave" devices such as sensors, beacons, etc. to "advertise" the data that will be transferred/received. I have never tried to communicate over BLE using an OSX device but I would suggest you to try to set it up manually (from console) if possible. Anyway, I would recommend you to read the documentation found in https://developer.apple.com/bluetooth/ Bluetooth for Developers - Apple Developer and to contact https://developer.apple.com/contact/ Apple in case you have issues interacting through BLE with your Mac.
I believe you could detect how close a BLE device is to your Edison based on the signal strength. You might be interested in this: http://stackoverflow.com/questions/24417017/bluetooth-le-signal-strength-linux http://stackoverflow.com/questions/24417017/bluetooth-le-signal-strength-linux.