• 蓝牙HID协议笔记【转】


    蓝牙HID协议笔记

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

    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的交互如下:
  • 相关阅读:
    多线程----Thread类,Runnable接口,线程池,Callable接口,线程安全
    PHP-数据类型
    MySQL-数据与事务控制语言
    数据库查询练习题
    MySQL-数据操作语言(DML)
    MySQL-表操作
    MySQL-数据类型
    MySQL-数据库相关操作
    js Dom简单练习题
    js中的Dom操作
  • 原文地址:https://www.cnblogs.com/sky-heaven/p/4439655.html
Copyright © 2020-2023  润新知