- CCC协议规定DK报文必须以L2CAP形式通过 DK 服务(SPSM)进行传输
逻辑链路控制与适配协议 L2CAP
只支持ACL数据传输,不支持SCO数据
- DK报文以大端编码,除非该区域已被蓝牙规范或CCC规范的其他部分所定义。
L2CAP组成
- L2CAP 分组头
- 长度(2byte)
- CID(0x0001)
- 信令指令头
- 代码(1byte)
- 标识符(1byte)
- 长度(2byte)
- 数据(此部分具体格式L2CAP不进行定义,由CCC定义)
- Message Header Byte 0
- Message Type Bit [5:0]
-
RFU(Reserved for Future Use) Bit [7:6]
-
Payload Header (Message ID) Byte 1
-
Length Byte [3:2]
-
Data Byte N
- Message Header Byte 0
Message Type 与 Message ID
每个Message Type对应某几个Message ID,整理如下(各parameter的长度及详述未列出,详见CCC-TS-101):
Message Type | Value (decimal) | Message ID | Message | Parameter | APDUs |
---|---|---|---|---|---|
Framework | 0 | 0x0B | DK_APDU_RQ | APDU command | SELECT, SPAKE2+ REQUEST, SPAKE2+ VERIFIER, WRITE DATA, GET DATA, GET RESPONSE, OP CONTROL FLOW |
0x0C | DK_APDU_RS | APDU response | |||
SE | 1 | 0x0B | DK_APDU_RQ | APDU command | SELECT, AUTH0, AUTH1, EXCHANGE CONTROL FLOW CREATE RANGING KEY |
0x0C | DK_APDU_RS | APDU response |
Message Type | Value (decimal) | Message ID | Message | Parameter |
---|---|---|---|---|
UWB Ranging Service | 2 | 0x01 | Ranging_Capability_RQ | Supported_DK_Protocol_Version_Len, Supported_DK_Protocol_Version, Supported_UWB_Config_Id_Len, Supported_UWB_Config_Id Supported_PulseShape_Combo_Len Supported_PulseShape_Combo |
0x02 | Ranging_Capability_RS | Selected_DK_Protocol_Version, Selected_UWB_Config_Id Selected_PulseShape_Combo | ||
0x03 | Ranging_Session_RQ | Selected_DK_Protocol_Version, Selected_UWB_Config_id, UWB_Session_Id, Selected_PulseShape_Combo, Channel_Bitmask | ||
0x04 | Ranging_Session_RS | RAN_Multiplier, Slot_BitMask, SYNC_Code_Index_BitMask, Selected_UWB_Channel, Hopping_Config_Bitmask | ||
0x05 | Ranging_Session_Setup_RQ | Session_RAN_Multiplier, Number_Slots_per_Round, | ||
0x06 | Ranging_Session_Setup_RS | STS_Index0, UWB_Time0, HOP_Mode_Key, SYNC_Code_Index | ||
0x07 | Ranging_Suspend_RQ | UWB_Session_Id | ||
0x08 | Ranging_Suspend_RS | Suspend_Response | ||
0x09 | Ranging_Recovery_RQ | UWB_Session_Id | ||
0x0A | Ranging_Recovery_RS | STS_Index0, UWB_Time0 | ||
0x12 | Configurable_Ranging_Recovery_RQ | UWB_Session_Id Requested_RAN_Multiplier | ||
0X13 | Configurable_Ranging_Recovery_RS | Selected_RAN_Multiplier STS_Index0, UWB_Time0 |
Message Type | Value (decimal) | Message ID | Message | Parameter |
---|---|---|---|---|
DK Event Notification | 3 | 0x11 | Ranging_Event | Subevent_Category, Subevent_Code |
Vehicle OEM App | 4 | 0x10 | Pass_Through | Payload |
Supplementary Service | 5 | 0x0D | Time_Sync | DeviceEventCount, UWB_Device_Time, |
0x0E | First_Approach_RQ | E1_Payload IV1, Tag1, E2_Payload IV2, Tag2 | ||
0x0F | First_Approach_RS | E_Payload IV, Tag | ||
0x14 | RKE_Auth_RQ | RKE Challenge | ||
0x15 | RKE_Auth_RS | 8个Tag | ||
Head Unit Pairing | 6 | 0x16 | Head_Unit_Pairing_Preparation (HU-PP) | BT_Pairing_Configuration, BD_ADDR_Head_Unit, Vehicle capabilities |
0x17 | Head_Unit_Pairing_RQ (HUP-RQ) | User Intent, BD_ADDR_Device, Device Capabilities, PairingDataR192, PairingDataR256, PairingDataC192, PairingDataC256 | ||
0x18 | Head_Unit_Pairing_RS (HUP-RS) | BD_ADDR_Head_Unit, PairingDataR192, PairingDataR256, PairingDataC192, PairingDataC256 | ||
Reserved | 7-63 | / | / | / |
编码示例
Message: APDU command(Select) message over Bluetooth LE with
AID as 0xA000000809434343444B417631.
Message Type in Message Header: 0x01 (SE)
Message ID in Payload Header: 0x0B (DK_APDU_RQ, 11)
Data: 0x00A404000DA000000809434343444B41763100
(SELECT APDU command)
DK Bluetooth LE Payload: 0x010B001300A404000DA000000809434343444B41763100
Payload解读
0x010B001300...:Message Header Byte 0
0x010B001300...:Payload Header (Message ID) Byte 1
0x010B001300...:Length Byte [3:2]:长度为19字节
0x...00A40400...:Data Byte N:Parameter(SELECT command),共计19字节
SELECT APDU command解读
SELECT command 指令格式: CLA1 A4 04 00 Lc AID 00
其中AID指定为: A000000809434343444B417631 (hex)
0x00A404000DA000...00:CLA1
0x00A404000DA000...00:A4 04 00
0x00A404000DA000...00:Lc,command length,即AID长度,即13
0x00A404000DA000...00:AID
0x00A404000DA000...00:00