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的格式如下:
該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。
格式如下:
(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兩種,格式如下:
Interrupt IN和Interrupt OUT兩種,可以在任意時刻發送。
【中斷嘛】
5.其余各層對於HID的要求
HID與L2CAP的交互如下: