The author's blog address: http://blog.sina.com.cn/samzhen1977
By Sam (zhufeng)
Sam_code@hotmail.com
We have discussed how to use IOCTL to send HCI command. But HCI
Protocol also has some commands, such as inquiry, which do not need to be sent using IOCTL. Bluez
Support is provided directly, although they are all implemented in the same way.
In the ApplicationProgramMedium:
Hci_inquiry (dev_id, length, num_rsp, null, & info,
Flags );
The following figure shows how to include the bluez header file:
# Include // btproto_hci
# Include // struct hci_dev_info
# Include // hci_devid ()
# Include // L2CAP
# Include // hidp
Hci_inquiry () is implemented in bluez-Lib-xxx/lib/src/HCI. C.
Haha, I found that it was actually used:
IOCTL (DD, hciinquiry, (unsigned long) BUF );
In this way, it corresponds to the previous article. All HCI commands are finally sent using IOCTL.