蓝牙设备类型cod(蓝牙class of device介绍)

您所在的位置:网站首页 键盘类型分几种 蓝牙设备类型cod(蓝牙class of device介绍)

蓝牙设备类型cod(蓝牙class of device介绍)

2024-07-11 15:02| 来源: 网络整理| 查看: 265

零. 概述

本文章主要讲下蓝牙设备类型class of device的概念,service class ,major device,minor device类型以及举例说明下某一个cod的解析。

一. 声明

本专栏文章我们会以连载的方式持续更新,本专栏计划更新内容如下:

第一篇:蓝牙综合介绍 ,主要介绍蓝牙的一些概念,产生背景,发展轨迹,市面蓝牙介绍,以及蓝牙开发板介绍。

第二篇:Transport层介绍,主要介绍蓝牙协议栈跟蓝牙芯片之前的硬件传输协议,比如基于UART的H4,H5,BCSP,基于USB的H2等

第三篇:传统蓝牙controller介绍,主要介绍传统蓝牙芯片的介绍,包括射频层(RF),基带层(baseband),链路管理层(LMP)等

第四篇:传统蓝牙host介绍,主要介绍传统蓝牙的协议栈,比如HCI,L2CAP,SDP,RFCOMM,HFP,SPP,HID,AVDTP,AVCTP,A2DP,AVRCP,OBEX,PBAP,MAP等等一系列的协议吧。

第五篇:低功耗蓝牙controller介绍,主要介绍低功耗蓝牙芯片,包括物理层(PHY),链路层(LL)

第六篇:低功耗蓝牙host介绍,低功耗蓝牙协议栈的介绍,包括HCI,L2CAP,ATT,GATT,SM等

第七篇:蓝牙芯片介绍,主要介绍一些蓝牙芯片的初始化流程,基于HCI vendor command的扩展

第八篇:附录,主要介绍以上常用名词的介绍以及一些特殊流程的介绍等。

另外,开发板如下所示,对于想学习蓝牙协议栈的最好人手一套。以便更好的学习蓝牙协议栈,相信我,学完这一套视频你将拥有修改任何协议栈的能力(比如Linux下的bluez,Android下的bluedroid)。

-------------------------------------------------------------------------------------------------------------------------

CSDN学院链接(进入选择你想要学习的课程):https://edu.csdn.net/lecturer/5352?spm=1002.2001.3001.4144

蓝牙交流扣扣群:970324688

Github代码:https://github.com/sj15712795029/bluetooth_stack

入手开发板:https://item.taobao.com/item.htm?spm=a1z10.1-c-s.w4004-22329603896.18.5aeb41f973iStr&id=622836061708

蓝牙学习目录:https://blog.csdn.net/XiaoXiaoPengBo/article/details/107727900

--------------------------------------------------------------------------------------------------------------------------

二.蓝牙设备类型Cod(class of device)概念

cod就是设备类型(class of device),设备在蓝牙初始化的时候就要声明自己的设备类型,对方inquiry的时候会扫描到你的设备类型,并做对应的显示,典型的应用如android手机的搜索前面显示的小图标,如图前面的这排图标都是根据cod来显示的。

另外,需要注意的是,协议一定要跟cod匹配,比如你想做一个蓝牙键盘,不能注册audio的cod,否则很有可能出现奇奇怪怪的问题,此部分尤其注意。

Cod参照文章: https://www.bluetooth.com/specifications/assigned-numbers/baseband/

三.Cod结构以及子项

Cod的结构如上图,一共有3个byte,其中一共分为4个部分

3.1 Service class:设备类型 Bit No.Major Service Class13Limited Discoverable Mode [Ref #1]14(reserved)15(reserved)16Positioning (Location identification)17Networking (LAN, Ad hoc, …)18Rendering (Printing, Speakers, …)19Capturing (Scanner, Microphone, …)20Object Transfer (v-Inbox, v-Folder, …)21Audio (Speaker, Microphone, Headset service, …)22Telephony (Cordless telephony, Modem, Headset service, …)23Information (WEB-server, WAP-server, …) 3.2 Major device class主要是设备的主要类型

有如下几种值: 

12111098Major Device Class00000Miscellaneous [Ref #2]00001Computer (desktop, notebook, PDA, organizer, … )00010Phone (cellular, cordless, pay phone, modem, …)00011LAN /Network Access point00100Audio/Video (headset, speaker, stereo, video display, VCR, …00101Peripheral (mouse, joystick, keyboard, … )00110Imaging (printer, scanner, camera, display, …)00111Wearable01000Toy01001Health11111Uncategorized: device code not specifiedXXXXXAll other values reserved 3.3 Minor device class是对应于每种major下面的子类

如以下

Minor Device Class field – Computer Major Class 765432Minor Device Class bit no. of CoD000000Uncategorized, code for device not assigned000001Desktop workstation000010Server-class computer000011Laptop000100Handheld PC/PDA (clamshell)000101Palm-size PC/PDA000110Wearable computer (watch size)000111TabletXXXXXXAll other values reserved Minor Device Class field – Phone Major Class 765432Minor Device Class bit no. of CoD000000Uncategorized, code for device not assigned000001Cellular000010Cordless000011Smartphone000100Wired modem or voice gateway000101Common ISDN accessXXXXXXAll other values reserved Minor Device Class field – LAN/Network Access Point Major Class 765Minor Device Class bit no. of CoD000Fully available0011% to 17% utilized01017% to 33% utilized01133% to 50% utilized10050% to 67% utilized10167% to 83% utilized11083% to 99% utilized111No service availableXXXAll other values reserved

Table 6: The LAN/Network Access Point Load Factor field

The exact loading formula is not standardized. It is up to each LAN/Network Access Point implementation to determine what internal conditions to report as a utilization percentage. The only requirement is for the number to reflect an ever-increasing utilization of communication resources within the box. As a recommendation: a client locating multiple LAN/Network Access Points should attempt to connect to the one reporting the lowest load.

432Minor Device Class bit no. of CoD000Uncategorized (use this value if no others apply)XXXAll other values reserved

Table 7: Reserved sub-field for the LAN/Network Access Point

Minor Device Class field – Audio/Video Major Class 765432Minor Device Class bit no. of CoD000000Uncategorized, code not assigned000001Wearable Headset Device000010Hands-free Device000011(Reserved)000100Microphone000101Loudspeaker000110Headphones000111Portable Audio001000Car audio001001Set-top box001010HiFi Audio Device001011VCR001100Video Camera001101Camcorder001110Video Monitor001111Video Display and Loudspeaker010000Video Conferencing010001(Reserved)010010Gaming/ToyXXXXXXAll other values reserved Minor Device Class field – Peripheral Major Class 76Minor Device Class bit no. of CoD00Not Keyboard / Not Pointing Device01Keyboard10Pointing device11Combo keyboard/pointing device

Table 9: The Peripheral Major Class keyboard/pointing device field

Bits six and seven independently specify mouse, keyboard or combo mouse/keyboard devices. These may be combined with the lower bits in a multifunctional device.

5432Minor Device Class bit no. of CoD0000Uncategorized device0001Joystick0010Gamepad0011Remote control0100Sensing device0101Digitizer tablet0110Card Reader (e.g. SIM Card Reader)0111Digital Pen1000Handheld scanner for bar-codes, RFID, etc.1001Handheld gestural input device (e.g., “wand” form factor)XXXXAll other values reserved Minor Device Class field – Imaging Major Class 7654Minor Device Class bit no. of CoDXXX1DisplayXX1XCameraX1XXScanner1XXXPrinterXXXXAll other values reserved

Table 11: The Imaging Major Class bits four to seven

Bits four to seven independently specify display, camera, scanner or printer. These may be combined in a multifunctional device.

32Minor Device Class bit no. of CoD00Uncategorized, defaultXXAll other values reserved Minor Device Class field – Wearable Major Class

The Minor Class segment is the lowest level of granularity for defining a Bluetooth Device. There are 64 different possible minor classes.

765432Minor Device Class bit no. of CoD000001Wristwatch000010Pager000011Jacket000100Helmet000101GlassesXXXXXXAll other values reserved Minor Device Class field – Toy Major Class 765432Minor Device Class bit no. of CoD000001Robot000010Vehicle000011Doll / Action figure000100Controller000101GameXXXXXXAll other values reserved Minor Device Class field – Health 765432Minor Device Class bit no. of CoD000000Undefined000001Blood Pressure Monitor000010Thermometer000011Weighing Scale000100Glucose Meter000101Pulse Oximeter000110Heart/Pulse Rate Monitor000111Health Data Display001000Step Counter001001Body Composition Analyzer001010Peak Flow Monitor001011Medication Monitor001100Knee Prosthesis001101Ankle Prosthesis001110Generic Health Manager001111Personal Mobility DeviceXXXXXXAll other values reserved

Type:一般是00用于后11bit service class做掩码用

四.举例分析一个蓝牙设备的cod

下面我们来举几个例子来说明下(在举例子之前推荐一个文章可以生成cod)

http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html

拿一个0x340404来说明下

0x340404=001101000000010000000100b

Service class = 00110100000

对应的是

Major device class = 00100 ,如下图

然后minor device class=000001b,然后我们找到Audio/Video的minor device class对应如下

我们来看个btsnoop对应下看看我们分析的对不对

我们也来用我上面给的连接生成下看看是否跟我们一样,来加深下印象



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3