I posted discussions on this a long time ago and never got any help. I'm hoping someone can give me a helping hand on this. My project does not have the ability to access the Linux command line so everything has to be automated. I previously got help with the ability to connect to auto pair a device via Bluetooth and have my software communicating with it via RFCOMM... Now what I'm hoping to do is to get the Edison to connect via Bluetooth and offer a SPP profile. All the documentation I have found previously and currently seems to require interaction via the Linux command line... I'm hoping someone has figured out how to automate this process.
What exactly do you want to connect to your Edison? Will it be a single device (like your phone, a mouse, a keyboard, etc)? Or do you need it to connect to any device (like someone else's phone, a random device you don't have access to, etc)?
I'd like to know this before I answer you, because my answer could be very different depending on the case.
Let us know a little bit more about your project. What does it do? How does it do it?
The device is going to connect to a PC or an Android device either a tablet or a phone. Like I said I was able to get, with the help from some people from this forum, to connect to these devices and handle autopairing which allowed me to communicate with my stuff via RFCOMM. This device that I would be connecting to is not some ones device I have access to.
As for an overview of the project the simplest way to describe it is I took a PC application and separated into two different parts a Client and a Server design. The Client is the original UI side and the Server contains all of the original working IP. This allows me to write a dumb client application that can run on any device: PC, iOS, Android, ect... Like I said the design and software (client/server) is up and running on the Edison and I've gotten communication to work with USB-RNDIS, WiFi-AP, and BT RFCOMM. The only thing left is to try and see if I can get this to connect to a device that could run my client via a SPP connection as we've found that some portable platforms like Xamarin doesn't seem to easily allow for RFCOMM communication.
In all honesty I would love to be able to allow a device to connect to the Edison via SPP, but on the Edison side my code looks at it as a RFCOMM communication. Because as you can see what I've implemented is a TCP/IP code design and it's the same as it is for RFCOMM so I don't have to do any code changes. I don't know if this is possible though, but it would be nice if I could just expose a SPP profile to connect to it, but on the Edison it's viewed as a RFCOMM communication.
Hope that helps. In the past I have posted information on this but have not received an answer so I figured after a few months of not posting I would give it a try again. Like I said previous I had a simple-agent given to me on the forum to help with the autopairing of devices that allowed for me to connect to devices via Bluetooth and then a connection can be made via RFCOMM.
I've gotten this application ported to other Embedded devices other than the Edison and for the most part have solved everything and I'm just trying to finalize the Edison design if possible.
First of all, sorry for the delay.
So, let me see if I got everything straight. Right now, you are able to auto pair a device to your Edison but in your current project you won't need to connect to any device; you will have an specific device, right? Will this device be paired already when you try to automatically stablish the SPP connection?
Did I get any of that wrong?
If your device is already paired, then this shouldn't be that hard, you should be able to set everything you need and actually start the SPP application, script, etc. from a system service.
Are you able to make your project run from the Edison terminal? How do you it?
Just out of curiosity, how are you auto pairing devices to your Edison?
I can pair to any device now, but I do not have SPP connection. I can only get RFCOMM communications to work between my application on the Edison and software I have running on other devices that are paired to the Edison (Windows and Android). I do not know how to setup a SPP connection when a connection is made, or how you are suppose to do it. I do not have access to my Edison Terminal at all, it's basically runs as an appliance. I've created scripts that run on boot that launch my application and also launch the bluetooth simple-agent that a person on this forum gave me before (search previous posts I'm in for bluetooth and you will come across it).
I was able to connect to and Android phone and establish a SPP connection using SPP-loopback.py (which can be found in http://www.intel.com/support/edison/sb/CS-035381.htm Intel® Edison Boards — Bluetooth® User Guide) without using having to interact with Linux in any way. The only comment in this is that I did it to a phone that was already paired and trusted. You may be able to adapt this to your project. This is the shell script that I used:
rfkill unblock bluetooth
bluetoothctl << EOF
bluetoothctl << EOF
python /home/root/SPP-loopback.py -C 22
And this is the service I created:
Description=Sets BT and starts the SPPloopback.py script
Try them and let us know how it goes.
It looks like I need to know address the of the actual device that I've connected to... My issue is I give this device to a user. Then a guy will take some device and pair to it... So how do I then know every time I launch the Edison what address is suppose to be inserted into the script to allow for SPP connection? You showed a way to do this without terminal interaction, but in a way you still have terminal interaction because I have to find a way to extract a specific address and insert it into a script that runs every time on start up. Do you know how to do that automatically, or is there a way to do that with out the connect command?
In that case, you should combine this service with the scripts mentioned in . This way you will be able to pair any device to your board, then you will be able to take the connected device's MAC address and run a similar script to the one above. This will allow you to pair and connect to any device and then start an SPP connection. This may prove a little challenging, but it is a great project to work on.