蓝⽛设备类型cod(蓝⽛classofdevice介绍)
零.概述
本⽂章主要讲下蓝⽛设备类型classofdevice的概念,rviceclass,majordevice,minordevice类型以及举例说明下某⼀个cod的解
析。
⼀.声明
本专栏⽂章我们会以连载的⽅式持续更新,本专栏计划更新内容如下:
第⼀篇:蓝⽛综合介绍,主要介绍蓝⽛的⼀些概念,产⽣背景,发展轨迹,市⾯蓝⽛介绍,以及蓝⽛开发板介绍。
第⼆篇:Transport层介绍,主要介绍蓝⽛协议栈跟蓝⽛芯⽚之前的硬件传输协议,⽐如基于UART的H4,H5,BCSP,基于USB的H2等
第三篇:传统蓝⽛controller介绍,主要介绍传统蓝⽛芯⽚的介绍,包括射频层(RF),基带层(baband),链路管理层(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等
第七篇:蓝⽛芯⽚介绍,主要介绍⼀些蓝⽛芯⽚的初始化流程,基于HCIvendorcommand的扩展
第⼋篇:附录,主要介绍以上常⽤名词的介绍以及⼀些特殊流程的介绍等。
另外,开发板如下所⽰,对于想学习蓝⽛协议栈的最好⼈⼿⼀套。以便更好的学习蓝⽛协议栈,相信我,学完这⼀套视频你将拥有修改任何
协议栈的能⼒(⽐如Linux下的bluez,Android下的bluedroid)。
-------------------------------------------------------------------------------------------------------------------------
蓝⽛交流扣扣群:970324688
--------------------------------------------------------------------------------------------------------------------------
⼆.蓝⽛设备类型Cod(classofdevice)概念
cod就是设备类型(classofdevice),设备在蓝⽛初始化的时候就要声明⾃⼰的设备类型,对⽅inquiry的时候会扫描到你的设备类型,
并做对应的显⽰,典型的应⽤如android⼿机的搜索前⾯显⽰的⼩图标,如图前⾯的这排图标都是根据cod来显⽰的。
另外,需要注意的是,协议⼀定要跟cod匹配,⽐如你想做⼀个蓝⽛键盘,不能注册audio的cod,否则很有可能出现奇奇怪怪的问题,此
部分尤其注意。
三.Cod结构以及⼦项
Cod的结构如上图,⼀共有3个byte,其中⼀共分为4个部分
3.1Serviceclass:设备类型
erviceClass
13LimitedDiscoverableMode[Ref#1]
14(rerved)
15(rerved)
16Positioning(Locationidentification)
17Networking(LAN,Adhoc,…)
18Rendering(Printing,Speakers,…)
19Capturing(Scanner,Microphone,…)
20ObjectTransfer(v-Inbox,v-Folder,…)
21Audio(Speaker,Microphone,Headtrvice,…)
22Telephony(Cordlesstelephony,Modem,Headtrvice,…)
23Information(WEB-rver,WAP-rver,…)
3.2Majordeviceclass主要是设备的主要类型
有如下⼏种值:
12111098MajorDeviceClass
00000Miscellaneous[Ref#2]
00001Computer(desktop,notebook,PDA,organizer,…)
00010Phone(cellular,cordless,payphone,modem,…)
00011LAN/NetworkAccesspoint
00100Audio/Video(headt,speaker,stereo,videodisplay,VCR,…
00101Peripheral(mou,joystick,keyboard,…)
00110Imaging(printer,scanner,camera,display,…)
00111Wearable
01000Toy
01001Health
11111Uncategorized:devicecodenotspecified
XXXXXAllothervaluesrerved
3.3Minordeviceclass是对应于每种major下⾯的⼦类
如以下
MinorDeviceClassfield–ComputerMajorClass
000000Uncategorized,codefordevicenotassigned
000001Desktopworkstation
000010Server-classcomputer
000011Laptop
000100HandheldPC/PDA(clamshell)
000101Palm-sizePC/PDA
000110Wearablecomputer(watchsize)
000111Tablet
XXXXXXAllothervaluesrerved
MinorDeviceClassfield–PhoneMajorClass
000000Uncategorized,codefordevicenotassigned
000001Cellular
000010Cordless
000011Smartphone
000100Wiredmodemorvoicegateway
000101CommonISDNaccess
XXXXXXAllothervaluesrerved
MinorDeviceClassfield–LAN/NetworkAccessPointMajorClass
000Fullyavailable
0011%to17%utilized
01017%to33%utilized
01133%to50%utilized
10050%to67%utilized
10167%to83%utilized
11083%to99%utilized
111Norviceavailable
XXXAllothervaluesrerved
Table6:TheLAN/NetworkAccessPointLoadFactorfield
toeachLAN/NetworkAccessPointimplementationtodeterminewhat
yrequirementisforthenumbertoreflectanever-increasing
ommendation:aclientlocatingmultipleLAN/NetworkAccess
Pointsshouldattempttoconnecttotheonereportingthelowestload.
000Uncategorized(uthisvalueifnoothersapply)
XXXAllothervaluesrerved
Table7:Rervedsub-fieldfortheLAN/NetworkAccessPoint
MinorDeviceClassfield–Audio/VideoMajorClass
000000Uncategorized,codenotassigned
000001WearableHeadtDevice
000010Hands-freeDevice
000011(Rerved)
000100Microphone
000101Loudspeaker
000110Headphones
000111PortableAudio
001000Caraudio
001001Set-topbox
001010HiFiAudioDevice
001011VCR
001100VideoCamera
001101Camcorder
001110VideoMonitor
001111VideoDisplayandLoudspeaker
010000VideoConferencing
010001(Rerved)
010010Gaming/Toy
XXXXXXAllothervaluesrerved
MinorDeviceClassfield–PeripheralMajorClass
00NotKeyboard/NotPointingDevice
01Keyboard
10Pointingdevice
11Combokeyboard/pointingdevice
Table9:ThePeripheralMajorClasskeyboard/pointingdevicefield
Bitssixandvenindependentlyspecifymou,keyboardorcombomou/aybecombinedwith
thelowerbitsinamultifunctionaldevice.
0000Uncategorizeddevice
0001Joystick
0010Gamepad
0011Remotecontrol
0100Sensingdevice
0101Digitizertablet
0110CardReader(dReader)
0111DigitalPen
1000Handheldscannerforbar-codes,RFID,etc.
1001Handheldgesturalinputdevice(e.g.,“wand”formfactor)
XXXXAllothervaluesrerved
MinorDeviceClassfield–ImagingMajorClass
XXX1Display
XX1XCamera
X1XXScanner
1XXXPrinter
XXXXAllothervaluesrerved
Table11:TheImagingMajorClassbitsfourtoven
Bitsfourtovenindependentlyspecifydisplay,camera,aybecombinedinamultifunctional
device.
00Uncategorized,default
XXAllothervaluesrerved
MinorDeviceClassfield–WearableMajorClass
TheMinorClassre64differentpossible
minorclass.
000001Wristwatch
000010Pager
000011Jacket
000100Helmet
000101Glass
XXXXXXAllothervaluesrerved
MinorDeviceClassfield–ToyMajorClass
000001Robot
000010Vehicle
000011Doll/Actionfigure
000100Controller
000101Game
XXXXXXAllothervaluesrerved
MinorDeviceClassfield–Health
000000Undefined
000001BloodPressureMonitor
000010Thermometer
000011WeighingScale
000100GlucoMeter
000101PulOximeter
000110Heart/PulRateMonitor
000111HealthDataDisplay
001000StepCounter
001001BodyCompositionAnalyzer
001010PeakFlowMonitor
001011MedicationMonitor
001100KneeProsthesis
001101AnkleProsthesis
001110GenericHealthManager
001111PersonalMobilityDevice
XXXXXXAllothervaluesrerved
Type:⼀般是00⽤于后11bitrviceclass做掩码⽤
四.举例分析⼀个蓝⽛设备的cod
下⾯我们来举⼏个例⼦来说明下(在举例⼦之前推荐⼀个⽂章可以⽣成cod)
拿⼀个0x340404来说明下
0x340404=b
Serviceclass=
对应的是
Majordeviceclass=00100,如下图
然后minordeviceclass=000001b,然后我们找到Audio/Video的minordeviceclass对应如下
我们来看个btsnoop对应下看看我们分析的对不对
我们也来⽤我上⾯给的连接⽣成下看看是否跟我们⼀样,来加深下印象
本文发布于:2022-12-02 19:44:27,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/88/39876.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |