Linux下Bluetooth HCI Command的实现
来源:互联网 发布:js节点名称 编辑:程序博客网 时间:2024/04/29 23:38
Linux下写Bluetooth程序,首先接触到的就是使用HCI Command来设置Bluetooth Modules(USB Bluetooth dongle)。那这些HCI command在blueZ中是如何实现的呢?举例说明。
if ((ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI))
在此之前,因为hci_sock.c已经被built-in.所以hci_sock_init()已经被执行。
另外,因为hci usb driver也已经insmod。所以hci_usb_init()被执行,这个driver指出,当USB Bluetooth Dongle插入时,调用hci_usb_probe()。这时,就会指出open为hci_usb_open()
hci_usb_open()中则设置hci_dev->flag=HCI_RUNNING.
并向USB Core提交一个中断URB。当有中断URB被USB Core出来完毕后,调用hci_usb_rx_complete()。它则调用__recv_frame()。它处理所有USB Dongle通过中断URB送来的数据。
利用hci_init_req()发送request.
hci_init_req()调用hci_send_cmd()发送命令。
hci_send_cmd() 则调用skb_queue_tail()将命令skb添加到发送队列。再调用hci_sched_cmd()去调用发送命令去发送。发送命令为:hci_cmd_task()
hci_cmd_task()-〉hci_send_frame()-〉hci_send_frame()-〉hdev->send(skb);=hci_usb_send_frame();发送命令给USB bluetooth dongle.
HCI就是通过这个途径发送Command到Dongle的。所以HCI Socket其实就是PC和Dongle之间的一个通道。注意,不是PC和远端bluetooth 设备的通道,而是本地Dongle。
- Linux下Bluetooth HCI Command的实现
- Linux下 Bluetooth HCI Command的实现
- Linux下Bluetooth HCI Command的实现
- Linux下Bluetooth HCI Command的实现
- Linux下Bluetooth HCI Command的实现
- linux下bluetooth编程(三)HCI层编程
- linux下bluetooth编程(三)HCI层编程
- linux下bluetooth编程(三)HCI层编程
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI
- Linux Bluetooth编程 HCI层编程
- Linux 下的Bluetooth 架构
- Linux 下的Bluetooth 架构
- 约瑟夫环
- 正则表达式,轻松查看项目源代码行数
- eclipse中安装CDT遇到问题 --已解决
- Adobe CS4 大师版 Adobe Creative Suite 4 Master Collection MAC版和Windows版
- tar打包命令
- Linux下Bluetooth HCI Command的实现
- TCP/IP学习之一(TCP/IP的分层)
- Linux BlueZ 下 Inquiry的实现
- 在VMWare上安装Win3.2
- Bluetooth HCI Event的处理
- Visual Studio 2008正式版序列号及把90天试用版改为正式版的二种方法
- SQL LIKE 通配符
- 查看sql server lock
- 基于bluez程序编译时注意事项