I have never tried to interface with Bluetooth using C, however as you mention, it is indeed possible. For example, I was able to find several Bluetooth devices with the sample code of simplescan found in https://people.csail.mit.edu/albert/bluez-intro/c404.html.
I'd suggest you to read that document and the rest of the book, it should be of much help for what you're trying to achieve.
I've looked at that code and read that book before I posted my question. The the book is incomplete, because it doesn't show you how to take an inquiry and turn it into the ability to authenticate with out requiring a PIN and trusting the device.
When you run their code or any code on the website and then try and pair the Edison to a PC it will immediately fail authentication... And I would assume if you got past that you still need to bypass the pin request. So no where is any of that found. None of the rest of the code in that book matters since you can not successfully pair with a device...........
When you look at the book and then look at the monster amount of sample code provided to you via the BlueZ Util file from their website it seems like you have to make a the same agent you do in python 'simple-agent.py', but in actually C code so that when an object sets up the connection to pair the correct agent functions fire off... Plus you need to setup the UUID for what services are supported like 'SPP' where as the example given in the intel edison example, doesn't show that the connected BT Edison supports the SPP service, because it was never setup...
The BlueZ examples seem to have the code, but it not documented at all even though BlueZ points you to the code base for documentation...
I understand, in that case, you could use as a workaround the method of pairing mentioned in https://communities.intel.com/message/292975#292975.
Let me know if that helps you, I'll be glad to help you if otherwise.
That pairing code worked from the get go two years ago, but that's not what my question is about. My question is how does one do that with the C library code for BlueZ and handle all BT stuff with the C library.
Why don't you try to pair the device with a shell script and then handle the rest of the actions in C? For example I paired my phone with this script:
rfkill unblock bluetooth
hciconfig hci0 sspmode 1
hciconfig hci0 sspmode
hciconfig hci0 piscan
sdptool add SP
#I found the phone’s MAC manually and entered it
hcitool cc 50:XX:27:XX:6B:XX
rfcomm connect /dev/rfcomm0 50:XX:27:XX:6B:XX 4 &
hcitool auth 50:XX:27:XX:6B:XX
As you can see I found the MAC address of the phone and entered it manually, however you can modify the script to automatically find the Bluetooth devices and let you choose manually whichever you want.
After this I entered my phone's Bluetooth configuration and I simply tapped the Edison icon and it was successfully paired.
For example you can handle a command’s output in a similar way to this: http://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-bash-assign-variable-command-output/. This approach might require some work but could prove easier.
Do you think that an approach like this might work for you? You can add a line in the end of the shell script that starts the C script that does the rest of the work.
So I'm assuming you don't know how to implement pairing and agent code via BlueZ C.
As I mentioned in my first post, I've never tried to interface with Bluetooth using C before. So, If you would like a more detailed answer I suggest you to contact BlueZ (http://www.bluez.org/contact/), so they can help you with this question about their API.