I'm developing a C application on C.H.I.P. board (Debian Jessie on it) ; while I was able to scan for classic and BLE devices using the source code of hcitool scan
and hcitool lescan
that we can find in /tools/hcitool.c of bluez package, I can't pair with devices without interact with the prompt given by hcitool auth XX:XX:XX:XX:XX:XX
or rfcomm bind "MY DEVICE" XX:XX:XX:XX:XX:XX
. I need to bypass the prompt given by these function without having interaction with it. I tried to find which function call the prompt and it seems to be the IOCTL, but i can't understand how to avoid this step. Can anyone could help me?
Asked
Active
Viewed 595 times
0

Lubron
- 35
- 2
- 15
-
If you wish to use the DBus interface provided by BlueZ, you can register your agent using AgentManager1 interface to auto reply or bypass the manual interaction for pairing. But I am not sure about the direct HCI interface for the same. – Parthiban Oct 17 '16 at 08:42
-
Thanks for the answer, but while I was able to include the code from hcitool, it's quite difficult for me to do the same with the source code of bluetoothctl ; have you an idea how to include all the functions from gdbus folder and the ones from client folder too?? – Lubron Oct 24 '16 at 14:16
-
Am not sure about using the same code. I think the code in client and gdbus directory is tightly bound to other parts of bluez (like monitor). So its hard to pull the whole directory out of the tree as separate library API's. AFAIK, using DBUS API's directly from application is hardly not recommended. AgentManager1 using GDBus may help you. https://developer.gnome.org/gio/stable/gdbus-convenience.html – Parthiban Oct 24 '16 at 14:44