[学习笔记-蓝牙钥匙]CCC协议3.0 - 数据格式

  • 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 Type 与 Message ID

每个Message Type对应某几个Message ID,整理如下(各parameter的长度及详述未列出,详见CCC-TS-101):

Message Type (Framework, SE)
Message Type Value (decimal)Message IDMessageParameterAPDUs
Framework00x0BDK_APDU_RQAPDU commandSELECT,  
SPAKE2+ REQUEST, 
SPAKE2+ VERIFIER,  
WRITE DATA,  
GET DATA,  
GET RESPONSE, 
OP CONTROL FLOW
0x0CDK_APDU_RSAPDU response
SE10x0BDK_APDU_RQAPDU commandSELECT,  
AUTH0,  
AUTH1,  
EXCHANGE 
CONTROL FLOW CREATE RANGING KEY
0x0CDK_APDU_RSAPDU response
Message Type (UWB Ranging Service)
Message TypeValue (decimal)Message IDMessageParameter
UWB Ranging Service20x01Ranging_Capability_RQSupported_DK_Protocol_Version_Len, 
Supported_DK_Protocol_Version, 
Supported_UWB_Config_Id_Len, 
Supported_UWB_Config_Id 
Supported_PulseShape_Combo_Len 
Supported_PulseShape_Combo 
0x02Ranging_Capability_RSSelected_DK_Protocol_Version, 
Selected_UWB_Config_Id 
Selected_PulseShape_Combo
0x03Ranging_Session_RQSelected_DK_Protocol_Version, 
Selected_UWB_Config_id, 
UWB_Session_Id, 
Selected_PulseShape_Combo, 
Channel_Bitmask
0x04Ranging_Session_RSRAN_Multiplier, 
Slot_BitMask, 
SYNC_Code_Index_BitMask, 
Selected_UWB_Channel, 
Hopping_Config_Bitmask
0x05Ranging_Session_Setup_RQ

Session_RAN_Multiplier, 
Number_Chaps_per_Slot,  
Number_Responders_Nodes, 

Number_Slots_per_Round, 
SYNC_Code_Index, 
Selected_Hopping_Config_Bitmask

0x06Ranging_Session_Setup_RSSTS_Index0, 
UWB_Time0, 
HOP_Mode_Key, 
SYNC_Code_Index
0x07Ranging_Suspend_RQUWB_Session_Id
0x08Ranging_Suspend_RSSuspend_Response
0x09Ranging_Recovery_RQUWB_Session_Id
0x0ARanging_Recovery_RSSTS_Index0, 
UWB_Time0
0x12Configurable_Ranging_Recovery_RQUWB_Session_Id 
Requested_RAN_Multiplier
0X13Configurable_Ranging_Recovery_RSSelected_RAN_Multiplier 
STS_Index0, 
UWB_Time0
Message Type (rest)
Message TypeValue (decimal)Message IDMessageParameter
DK Event Notification30x11Ranging_EventSubevent_Category, 
Subevent_Code
Vehicle OEM App40x10Pass_Through Payload
Supplementary Service50x0DTime_Sync

DeviceEventCount,

UWB_Device_Time, 
UWB_Device_Time_Uncertainty, 
UWB_Clock_Skew_Measurement_available, 
Device_max_PPM, 
Success, 
RetryDelay

0x0EFirst_Approach_RQE1_Payload 
IV1, 
Tag1, 
E2_Payload 
IV2, 
Tag2 
0x0FFirst_Approach_RSE_Payload 
IV, 
Tag
0x14RKE_Auth_RQRKE Challenge
0x15RKE_Auth_RS8个Tag
Head Unit Pairing60x16Head_Unit_Pairing_Preparation (HU-PP)BT_Pairing_Configuration, 
BD_ADDR_Head_Unit, 
Vehicle capabilities
0x17Head_Unit_Pairing_RQ (HUP-RQ)User Intent,  
BD_ADDR_Device, 
Device Capabilities, 
PairingDataR192, 
PairingDataR256, 
PairingDataC192, 
PairingDataC256
0x18Head_Unit_Pairing_RS (HUP-RS)BD_ADDR_Head_Unit, 
PairingDataR192, 
PairingDataR256, 
PairingDataC192, 
PairingDataC256
Reserved7-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

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值