HCI Command packet

HCI Command是有方向性的,從Host發給Controller。是2個字節的長度,OPCODE 其中,分爲兩部分,OCF和OGF,OGF,是上面的6bits,剩餘的10個bit位是OCF。

The OGF values are defined by the Bluetooth (BT) Core specification. The LE specification has its own OGF value. Also, there is an escape OGF value so that vendor specific OCF codes can be used. The following OGF values are valid for BLE:

# Link Control Commands: 1  即。OGF :1*1024 =0x0400

# Link Policy Commands: 2  即。OGF:2*1024 =0x0800

# Controller and Baseband Commands: 3 即。OGF:3*1024 =0x0C00

# Informational Parameters: 4 即。OGF:4*1024 = 0x1000

# Status Parameters: 5.。即,OGF 5*1024 =0x1400

# Testing Commands: 6  即,OGF 6*1024 =0x1800

# LE Only Commands: 8 即,OGF 8*1024 =0x2000

# Vendor Specific Commands: 63

所以,OGF+OCF=OPCODE 即,OGF*1024+OCF=OPCODE 

../_images/hci-command-opcode.png

LE Commands OGF OCF Opcdoe
LE Set Event Mask 8 1 0x2001
LE Read Buffer Size 8 2 0x2002
LE Read Local Supported Features 8 3 0x2003
LE Set Random Address 8 5 0x2005
LE Set Advertising Parameters 8 6 0x2006
LE Read Advertising Channel TX Power 8 7 0x2007
LE Set Advertising Data 8 8 0x2008
LE Set Scan Response Data 8 9 0x2009
LE Set Advertise Enable 8 10 0x200A
LE Set Scan Parameters 8 11 0x200B
LE Set Scan Enable 8 12 0x200C
LE Create Connection 8 13 0x200D
LE Create Connection Cancel 8 14 0x200E
LE Read White List Size 8 15 0x200F
LE Clear White Lis 8 16 0x2010
LE Add Device To White List 8 17 0x2011
LE Remove Device From White List 8 18 0x2012
LE Connection Update 8 19 0x2013
LE Set Host Channel Classification 8 20 0x2014
LE Read Channel Map 8 21 0x2015
LE Read Remote Used Features 8 22 0x2016
LE Encrypt 8 23 0x2017
LE Rand 8 24 0x2018
LE Start Encryption 8 25 0x2019
LE Long Term Key Requested Reply 8 26 0x201A
LE Long Term Key Requested Negative Reply 8 27 0x201B
LE Read Supported States 8 28 0x201C
LE Receiver Test 8 29 0x201D
LE Transmitter Test 8 30 0x201E
LE Test End Command 8 31 0x201F
LE Remote Connection Parameter Request Reply 8 32 0x2020
LE Remote Connection Parameter Request Negative Reply 8 33 0x2021
LE Set Data Length 8 34 0x2022
LE Read Suggested Default Data Length 8 35 0x2023
LE Write Suggested Default Data Length 8 36 0x2024
LE Read Local P256 Public Key 37 0x2025 LE Generate DHKey 8 38 0x2026
LE Add Device to Resolving List 8 39 0x2027
LE Remove Device from Resolving List 8 40 0x2028
LE Clear Resolving List 8 41 0x2029
LE Read Resolving List Size 8 42 0x202A
LE Read Peer Resolvable Address 8 43 0x202B
LE Read Local Resolvable Address 8 44 0x202C
LE Set Address Resolution Enable 8 45 0x202D
LE Set Resolvable Private Address Timeout 8 46 0x202E
LE Read Maximum Data Length 8 47 0x202F
BT Commands for LE OGF OCF Opcode
Disconnect 1 6 0x0406
Read Remote Version Information 1 29 0x041D
Set Event Mask 3 1 0x0C01
Reset 3 3 0x0C03
Read Transmit Power Level 3 45 0x0C2D
Set Controller To Host Flow Control (optional) 3 49 0x0C31
Host Buffer Size (optional) 3 51 0x0C33
Host Number Of Completed Packets (optional) 3 53 0x0C35
Set Event Mask Page 3 63 0x0C63
Read Authenticated Payload Timeout 4 123 0x0C7B
Write Authenticated Payload Timeout 4 124 0x0C7C
Read Local Version Information 4 1 0x1001
Read Local Supported Commands (optional) 4 2 0x1002
Read Local Supported Features 4 3 0x1003
Read BD_ADDR 4 9 0x1009
Read RSSI 5 5 0x1405

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章