與其他無線通信一樣,藍牙設(shè)備通信中也是通過消息交互進行信息交流;以下是Wiershark對設(shè)備發(fā)送和接收內(nèi)容進行抓包過濾后的結(jié)果:Kangguoying2021
這35步消息的詳細內(nèi)容(Bluetooth HCI H4)分別如下:Kangguoying2021
(1) Command Inquiry
[Direction: Sent (0x00)]
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - InquiryKangguoying2021
Command Opcode: Inquiry (0x0401)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 0001 = ocf: 0x0001Kangguoying2021Kangguoying2021
Parameter Total Length: 5
LAP: 0x9e8b33Kangguoying2021
Inquiry Length: 16
Num Responses: 0
(2) Command Status (Inquiry)
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4Kangguoying2021
Status: Pending (0x00)Kangguoying2021
Number of Allowed Command Packets: 1
Command Opcode: Inquiry (0x0401)
(3) Inquiry Result
Bluetooth HCI H4
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Inquiry Result
Event Code: Inquiry Result (0x02)
Parameter Total Length: 15
Number of responses: 1
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Page Scan Repetition Mode: R1 (0x01)Kangguoying2021Kangguoying2021
Page Scan Period Mode: P0 (0x00)
Page Scan Mode: Mandatory Page Scan Mode (0x00)
Class of Device: 0x420204 (Phone - services: Telephony, Networking)
.100 0010 1101 1101 = Clock Offset: 0x42dd
(4) Inquiry Complete
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Inquiry Complete
Event Code: Inquiry Complete (0x01)
Parameter Total Length: 1Kangguoying2021
Status: Success (0x00)
(5) Remote Name Request
[Direction: Sent (0x00)]Kangguoying2021
HCI Packet Type: HCI Command (0x01)Kangguoying2021
Bluetooth HCI Command - Remote Name Request
Command Opcode: Remote Name Request (0x0419)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0001 1001 = ocf: 0x0019
Parameter Total Length: 10Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Page Scan Repetition Mode: R1 (0x01)Kangguoying2021
Page Scan Mode: Mandatory Page Scan Mode (0x00)
.000 0000 0000 0000 = Clock Offset: 0x0000 (0 ms)
0... .... .... .... = Clock_Offset_Valid_Flag: false (0)
(6) Command Status (Remote Name Request)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4
Status: Pending (0x00)
Number of Allowed Command Packets: 1
Command Opcode: Remote Name Request (0x0419)
(7) Remote Name Req Complete
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Remote Name Req Complete
Event Code: Remote Name Req Complete (0x07)
Parameter Total Length: 255Kangguoying2021
Status: Page Timeout (0x04)Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Remote Name:
(8) Connect Request
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Connect RequestKangguoying2021
Event Code: Connect Request (0x04)
Parameter Total Length: 10Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Class of Device: 0x6a0204 (Phone - services: Telephony, Audio, Capturing, Networking)
Link Type: ACL connection (Data Channels) (0x01)
(9) Accept Connection Request
[Direction: Sent (0x00)]Kangguoying2021
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - Accept Connection Request
Command Opcode: Accept Connection Request (0x0409)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1001 = ocf: 0x0009
Parameter Total Length: 7Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Role: Remain Slave (0x01)
(10) Command Status (Accept Connection Request)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4
Status: Pending (0x00)Kangguoying2021
Number of Allowed Command Packets: 1
Command Opcode: Accept Connection Request (0x0409)
(11) PIN Code Request
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - PIN Code Request
Event Code: PIN Code Request (0x16)Kangguoying2021
Parameter Total Length: 6
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
(12) PIN Code Request Reply
[Direction: Sent (0x00)]
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - PIN Code Request Reply
Command Opcode: PIN Code Request Reply (0x040d)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1101 = ocf: 0x000d
Parameter Total Length: 23
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
PIN Code Length: 4
PIN Code: 1234
(13) Command Complete (PIN Code Request Reply)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Complete
Event Code: Command Complete (0x0e)
Parameter Total Length: 10Kangguoying2021
Number of Allowed Command Packets: 1
Command Opcode: PIN Code Request Reply (0x040d)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1101 = ocf: 0x000d
Status: Success (0x00)Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
(14) Connect Complete
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)Kangguoying2021
Bluetooth HCI Event - Connect Complete
Event Code: Connect Complete (0x03)
Parameter Total Length: 11Kangguoying2021
Status: Authentication Failure (0x05)
Connection Handle: 0x0029
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Link Type: ACL connection (Data Channels) (0x01)
Encryption Mode: Encryption Disabled (0x00)
(15) Connect Request
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Connect RequestKangguoying2021
Event Code: Connect Request (0x04)
Parameter Total Length: 10
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Class of Device: 0x6a0204 (Phone - services: Telephony, Audio, Capturing, Networking)
Link Type: ACL connection (Data Channels) (0x01)
(16) Accept Connection Request
[Direction: Sent (0x00)]
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - Accept Connection Request
Command Opcode: Accept Connection Request (0x0409)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1001 = ocf: 0x0009Kangguoying2021
Parameter Total Length: 7
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Role: Remain Slave (0x01)
(17) Command Status (Accept Connection Request)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)Kangguoying2021
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4Kangguoying2021
Status: Pending (0x00)Kangguoying2021
Number of Allowed Command Packets: 1
Command Opcode: Accept Connection Request (0x0409)
(18) PIN Code Request
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)Kangguoying2021
Bluetooth HCI Event - PIN Code Request
Event Code: PIN Code Request (0x16)
Parameter Total Length: 6Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
(19) PIN Code Request Reply
[Direction: Sent (0x00)]Kangguoying2021
HCI Packet Type: HCI Command (0x01)Kangguoying2021
Bluetooth HCI Command - PIN Code Request Reply
Command Opcode: PIN Code Request Reply (0x040d)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1101 = ocf: 0x000d
Parameter Total Length: 23Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
PIN Code Length: 4
PIN Code: 1234
(20) Command Complete (PIN Code Request Reply)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Complete
Event Code: Command Complete (0x0e)
Parameter Total Length: 10
Number of Allowed Command Packets: 1
Command Opcode: PIN Code Request Reply (0x040d)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1101 = ocf: 0x000dKangguoying2021
Status: Success (0x00)
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
(21) Link Key Notification
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Link Key NotificationKangguoying2021
Event Code: Link Key Notification (0x18)
Parameter Total Length: 23Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Link Key: ec596f3306bba9e53d7b72de47c1404a
Key Type: Combination Key (0x00)
(22) Connect Complete
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)Kangguoying2021
Bluetooth HCI Event - Connect Complete
Event Code: Connect Complete (0x03)
Parameter Total Length: 11Kangguoying2021
Status: Success (0x00)
Connection Handle: 0x002aKangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Link Type: ACL connection (Data Channels) (0x01)
Encryption Mode: Encryption only for point-to-point packets (0x01)
(23) Write Link Policy Settings
[Direction: Sent (0x00)]
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - Write Link Policy Settings
Command Opcode: Write Link Policy Settings (0x080d)
0000 10.. .... .... = ogf: Link Policy Commands (0x0002)
.... ..00 0000 1101 = ocf: 0x000dKangguoying2021
Parameter Total Length: 4
Connection Handle: 0x002aKangguoying2021
.... .... .... ...1 = Enable Master Slave Switch: true (1)
.... .... .... ..1. = Enable Hold Mode: true (1)
.... .... .... .1.. = Enable Sniff Mode: true (1)
.... .... .... 1... = Enable Park Mode: true (1)
(24) Page Scan Repetition Mode Change
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Page Scan Repetition Mode Change
Event Code: Page Scan Repetition Mode Change (0x20)
Parameter Total Length: 7Kangguoying2021
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Page Scan Repetition Mode: R1 (0x01)
(25) Command Complete (Write Link Policy Settings)
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Complete
Event Code: Command Complete (0x0e)
Parameter Total Length: 6Kangguoying2021
Number of Allowed Command Packets: 1
Command Opcode: Write Link Policy Settings (0x080d)
0000 10.. .... .... = ogf: Link Policy Commands (0x0002)
.... ..00 0000 1101 = ocf: 0x000dKangguoying2021
Status: Success (0x00)
Connection Handle: 0x002a
(26) Change Connection Packet Type
[Direction: Sent (0x00)]
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - Change Connection Packet Type
Command Opcode: Change Connection Packet Type (0x040f)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0000 1111 = ocf: 0x000f
Parameter Total Length: 4
Connection Handle: 0x002a
.... .... .... ..0. = Packet Type 2-DH1: false (0)
.... .... .... .0.. = Packet Type 3-DH1: false (0)
.... .... .... 1... = Packet Type DM1: true (1)Kangguoying2021
.... .... ...1 .... = Packet Type DH1: true (1)
.... ...0 .... .... = Packet Type 2-DH3: false (0)
.... ..0. .... .... = Packet Type 3-DH3: false (0)
.... .1.. .... .... = Packet Type DM3: true (1)
.... 1... .... .... = Packet Type DH3: true (1)
...0 .... .... .... = Packet Type 2-DH5: false (0)
..0. .... .... .... = Packet Type 3-DH5: false (0)
.1.. .... .... .... = Packet Type DM5: true (1)
1... .... .... .... = Packet Type DH5: true (1)
(27) Max Slots Change
[Direction: Rcvd (0x01)]Kangguoying2021
HCI Packet Type: HCI Event (0x04)Kangguoying2021
Bluetooth HCI Event - Max Slots Change
Event Code: Max Slots Change (0x1b)
Parameter Total Length: 3Kangguoying2021
Connection Handle: 0x002aKangguoying2021
Maximum Number of Slots: 5
(28) Command Status (Change Connection Packet Type)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4
Status: Pending (0x00)
Number of Allowed Command Packets: 1
Command Opcode: Change Connection Packet Type (0x040f)
(29) Remote Name Request
[Direction: Sent (0x00)]
HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - Remote Name Request
Command Opcode: Remote Name Request (0x0419)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0001 1001 = ocf: 0x0019
Parameter Total Length: 10
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Page Scan Repetition Mode: R1 (0x01)Kangguoying20210209
Page Scan Mode: Mandatory Page Scan Mode (0x00)
.000 0000 0000 0000 = Clock Offset: 0x0000 (0 ms)
0... .... .... .... = Clock_Offset_Valid_Flag: false (0)
(30) Connection Packet Type Changed
[Direction: Rcvd (0x01)]Kangguoying20210209
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Connection Packet Type Changed
Event Code: Connection Packet Type Changed (0x1d)
Parameter Total Length: 5
Status: Success (0x00)Kangguoying20210209
Connection Handle: 0x002a
Usable packet types: DM1 HV1 2-DH1Kangguoying20210209
.... .... .... ..0. = ACL Link Type 2-DH1: False (0)
.... .... .... .0.. = ACL Link Type 3-DH1: False (0)
.... .... .... 1... = ACL Link Type DM1: True (1)
.... .... ...1 .... = ACL Link Type DH1: True (1)
.... ...0 .... .... = ACL Link Type 2-DH3: False (0)
.... ..0. .... .... = ACL Link Type 3-DH3: False (0)
.... .1.. .... .... = ACL Link Type DM3: True (1)
.... 1... .... .... = ACL Link Type DH3: True (1)Kangguoying20210209
...0 .... .... .... = ACL Link Type 2-DH5: False (0)
..0. .... .... .... = ACL Link Type 3-DH5: False (0)
.1.. .... .... .... = ACL Link Type DM5: True (1)
1... .... .... .... = ACL Link Type DH5: True (1)
.... .... ..0. .... = SCO Link Type HV1: False (0)
.... .... .0.. .... = SCO Link Type HV2: False (0)
.... .... 0... .... = SCO Link Type HV3: False (0)
(31) Command Status (Remote Name Request)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)Kangguoying20210209
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4Kangguoying20210209
Status: Pending (0x00)Kangguoying20210209
Number of Allowed Command Packets: 1
Command Opcode: Remote Name Request (0x0419)
(32) Remote Name Request
[Direction: Sent (0x00)]Kangguoying20210209
HCI Packet Type: HCI Command (0x01)Kangguoying20210209
Bluetooth HCI Command - Remote Name Request
Command Opcode: Remote Name Request (0x0419)
0000 01.. .... .... = ogf: Link Control Commands (0x0001)
.... ..00 0001 1001 = ocf: 0x0019Kangguoying20210209
Parameter Total Length: 10
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Page Scan Repetition Mode: R1 (0x01)Kangguoying20210209
Page Scan Mode: Mandatory Page Scan Mode (0x00)
.000 0000 0000 0000 = Clock Offset: 0x0000 (0 ms)Kangguoying20210209
0... .... .... .... = Clock_Offset_Valid_Flag: false (0)
(33) Command Status (Remote Name Request)
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)Kangguoying20210209
Bluetooth HCI Event - Command Status
Event Code: Command Status (0x0f)
Parameter Total Length: 4
Status: Pending (0x00)
Number of Allowed Command Packets: 0Kangguoying20210209Kangguoying20210209
Command Opcode: Remote Name Request (0x0419)
(34) Remote Name Req Complete
[Direction: Rcvd (0x01)]
HCI Packet Type: HCI Event (0x04)Kangguoying20210209
Bluetooth HCI Event - Remote Name Req Complete
Event Code: Remote Name Req Complete (0x07)
Parameter Total Length: 255Kangguoying20210209
Status: Other End Terminated Connection: User Ended Connection (0x13)
BD_ADDR:000e:6d:072efa (MurataMa_07:2e:fa)
Remote Name:
(35) Disconnect Complete
[Direction: Rcvd (0x01)]Kangguoying20210209
HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Disconnect Complete
Event Code: Disconnect Complete (0x05)
Parameter Total Length: 4Kangguoying20210209
Status: Success (0x00)
Connection Handle: 0x002aKangguoying20210209
Reason: Other End Terminated Connection: User Ended Connection (0x13)
原文來自:sharetechnote
整理:Kangguoying20210209