首页 > 编程知识 正文

蓝牙 HID 剖析(一)

时间:2023-05-06 16:27:29 阅读:206533 作者:1196

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                1.概述     The Human Interface Device (HID)定义了蓝牙在人机接口设备中的协议、特征和使用规程。典型的应用包括蓝牙鼠标、蓝牙键盘、蓝牙游戏手柄等。该协议改编自USB HID Protocol。      2.一些概念 (1)HID Reports:Bluetooth HID devices支持三种Report:Input, Output, and Feature。 (2)HID建立Control Channel和Interrupt Channel两个通道,report可以在这两条channel上传输,在Control channel上传输的report称为synchronous reports ;在Interrupt channel上传输的report称为asynchronous reports。 (3)Feature reports are always transferred synchronously using GET_REPORT or SET_REPORT requests。 (4)Report Protocol Mode和Boot Protocol Mode。Bluetooth HID Hosts至少支持一种,Bluetooth HID Device则需要支持Report Protocol Mode,并且Report Protocol Mode是Bluetooth HID Device的默认Mode。 
3.Bluetooth HID Protocol Messages 这些message不能超过L2CAP的MTU,大小超过MTU的message将被忽略。 Message Header的格式如下:

(1)HANDSHAKE 该Message用来acknowledgeSET_REPORT, SET_IDLE and SET_PROTOCOL等request。只在Control Channel上传输,只由Bluetooth HID device。 Parameter部分定义如下:

(2)HID_CONTROL 控制Bluetooth HID device改变状态。 Parameter部分定义如下:

(3)GET_REPORT Bluetooth HID Host用来请求Bluetooth HID device的传输。 定义如下:

(4)SET_REPORT Bluetooth HID Host用来向Bluetooth HID device发起传输。 格式如下:


(5)GET_PROTOCOL 用来获取Bluetooth HID device的Protocol Mode,然后Bluetooth HID device response一个DATA payload说明当前的Protocol Mode。 格式如下:
GET_PROTOCOL Data Definition格式如下:

(6)SET_PROTOCOL 用来设置Bluetooth HID device的Bluetooth HID device。格式如下:

(7)DATA 代表一个a HID payload。格式如下:

4.Transfers 以HID Protocol messages的形式传输。 (1)Control Channel Transfers 分为Acknowledged和Unacknowledged两种,格式如下:
(2)Interrupt Channel Transfers Interrupt IN和Interrupt OUT两种,可以在任意时刻发送。【中断嘛】
5.其余各层对于HID的要求 HID与L2CAP的交互如下:

本文转载自:http://blog.sina.com.cn/s/blog_69b5d2a50101emll.html            

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。