下面这部分讲的是 HCI_LE_Read_Remote_Features_Page_0 command

它以前叫:

LE Read Remote Features

现在规范里改名为:

LE Read Remote Features Page 0

核心作用是:

读取“已经连接的对端设备”支持哪些 LE Link Layer 特性。

一、先翻译

1. 标题说明

原文:

This command was formerly called “LE Read Remote Features”.

翻译:

这个命令以前叫 LE Read Remote Features

也就是说,新规范中名字变成了:

LE Read Remote Features Page 0

但它本质上仍然是读取对端 LE 特性的命令。


2. 命令基本信息

Command:
HCI_LE_Read_Remote_Features_Page_0

OCF:
0x0016

Command Parameters:
Connection_Handle

Return Parameters:
none

翻译:

该命令是 HCI_LE_Read_Remote_Features_Page_0

它只有一个命令参数:

Connection_Handle

没有 Return Parameters。

注意:没有 Return Parameters 不代表没有结果,结果会通过后续事件返回。


二、Description 翻译

1. 读取远端设备 Page 0 特性

原文:

This command requests, from the remote device identified by the Connection_Handle,
page 0 of the features used on the connection and the features supported by the remote device.

翻译:

这个命令会向由 Connection_Handle 标识的远端设备请求 page 0 特性

这些特性包括两部分含义:

1. 当前连接中使用到的特性
2. 远端设备支持的特性

也就是说,这个命令是用来了解对端设备 LE 能力的。


2. Central 和 Peripheral 都可以发起

原文:

This command may be issued on both the Central and Peripheral.

翻译:

这个命令可以由 Central 发出,也可以由 Peripheral 发出。

也就是说,只要连接已经建立,双方都可以读取对端支持的 LE 特性。


3. Controller 可以使用缓存结果

原文:

If a connection already exists between the two devices and page 0 of the features have already been fetched on that connection,
the Controller may use a cached copy of page 0 of the features.

翻译:

如果两个设备之间已经存在连接,并且在这条连接上已经读取过 page 0 特性,那么 Controller 可以使用 page 0 特性的缓存副本。

也就是说,重复读取时,Controller 不一定每次都重新通过空口去请求对端,也可以直接使用已有缓存。


三、Command Parameters 翻译

Connection_Handle

Size: 2 octets
12 bits meaningful

翻译:

Connection_Handle 占 2 字节,其中真正有意义的是 12 bit。

取值范围:

0x0000 到 0x0EFF

含义:

指定要读取哪一条连接上的远端设备特性。

也就是说,如果本地设备同时连接了多个 BLE 设备,就必须通过 Connection_Handle 指定要读取哪一个对端设备的能力。


四、Return Parameters 翻译

None.

翻译:

没有返回参数。

注意:这个命令是异步命令,结果不是在 Return Parameters 里返回,而是通过事件返回。


五、Event(s) generated 翻译

1. 收到命令后先返回 Command Status

原文:

When the Controller receives the HCI_LE_Read_Remote_Features_Page_0 command,
the Controller shall send the HCI_Command_Status event to the Host.

翻译:

当 Controller 收到 HCI_LE_Read_Remote_Features_Page_0 命令后,Controller 会向 Host 发送:

HCI_Command_Status event

这个事件表示 Controller 已经接收该命令,并开始处理,或者命令初步失败。


2. 完成读取后返回 Complete event

原文:

When the Controller has completed the procedure to determine the remote features
or has determined that it will be using a cached copy,
the Controller shall send an HCI_LE_Read_Remote_Features_Page_0_Complete event to the Host.

翻译:

当 Controller 完成远端特性的获取过程,或者决定使用缓存副本时,Controller 会向 Host 发送:

HCI_LE_Read_Remote_Features_Page_0_Complete event

也就是说,最终结果通过这个 Complete event 返回。


3. Complete event 中包含状态和特性参数

原文:

The HCI_LE_Read_Remote_Features_Page_0_Complete event contains the status of this command and the parameter describing page 0 of the features used on the connection and the features supported by the remote device.

翻译:

HCI_LE_Read_Remote_Features_Page_0_Complete event 包含:

1. 该命令的执行状态
2. page 0 特性参数

这些特性描述了:

当前连接中使用的特性
远端设备支持的特性

六、这部分内容表述了哪些知识

这部分主要表达了这些知识:

1. HCI_LE_Read_Remote_Features_Page_0 用于读取已连接对端设备的 LE 特性。

2. 该命令必须基于已经存在的连接,因为它需要 Connection_Handle。

3. 这个命令 Central 和 Peripheral 都可以发起。

4. 它读取的是 page 0 features。

5. 如果之前已经读取过,Controller 可以使用缓存结果。

6. 该命令没有 Return Parameters。

7. 命令接收后,Controller 先返回 HCI_Command_Status event。

8. 最终读取结果通过 HCI_LE_Read_Remote_Features_Page_0_Complete event 返回。

七、必要 Tip 说明

Tip 1:这个命令不是读取本地能力,而是读取“对端能力”

它和下面这些命令要区分:

LE Read Local Supported Features

读取的是本地 Controller 支持什么。

而:

LE Read Remote Features Page 0

读取的是已经连接的对端设备支持什么。

可以这样记:

Local = 本地
Remote = 对端

Tip 2:这个命令必须在连接建立后使用

因为它需要:

Connection_Handle

Connection_Handle 只有在连接成功后才会出现。

例如:

HCI_LE_Connection_Complete event
HCI_LE_Enhanced_Connection_Complete event

连接成功事件里会返回 Connection_Handle

所以流程通常是:

LE Create Connection
        ↓
LE Connection Complete / LE Enhanced Connection Complete
        ↓
拿到 Connection_Handle
        ↓
LE Read Remote Features Page 0
        ↓
LE Read Remote Features Page 0 Complete

Tip 3:读取远端特性是为了判断后续能不能使用某些能力

BLE 连接建立后,并不是所有高级能力都能直接用。

必须满足:

本地支持
对端也支持

例如:

LE 2M PHY
LE Coded PHY
Data Length Extension
Connection Parameters Request Procedure
LE Secure Connections
Channel Selection Algorithm #2

如果本地支持,但对端不支持,就不能直接使用对应功能。

所以读取远端特性的目的可以理解为:

确认这条连接上双方可以共同使用哪些 LE 能力。

Tip 4:Page 0 是一页特性,不代表全部未来特性都只有这一页

这里叫 Page 0,说明 LE Features 是按 page 组织的。

早期命令叫:

LE Read Remote Features

后来改成:

LE Read Remote Features Page 0

这说明规范在扩展能力表达方式时,开始更明确地区分 feature page。

对于普通 BLE Legacy 连接,先理解 Page 0 即可。


Tip 5:Controller 可以使用缓存,不一定每次都重新空口交互

规范说 Controller 可以使用 cached copy。

这意味着:

同一条连接上,如果之前已经读取过远端 page 0 features,
后续再次读取时,Controller 可以直接返回缓存结果。

所以在 HCI log 中,不一定每次看到这个命令后都能明显看到底层空口上的特性交换过程。


Tip 6:Command Status 不是最终结果

和很多异步 HCI 命令一样,这个命令没有 Return Parameters。

流程是:

Host 发送 HCI_LE_Read_Remote_Features_Page_0
        ↓
Controller 返回 HCI_Command_Status event
        ↓
Controller 获取远端特性或使用缓存
        ↓
Controller 返回 HCI_LE_Read_Remote_Features_Page_0_Complete event

其中:

HCI_Command_Status event

只表示命令已经被 Controller 接收并开始处理,或者初步失败。

真正的特性结果要看:

HCI_LE_Read_Remote_Features_Page_0_Complete event

八、关键信息具体说明

关键信息 1:它读取的是远端设备的 LE Features

核心句子是:

This command requests, from the remote device identified by the Connection_Handle,
page 0 of the features...

具体说明:

BLE 设备支持哪些能力,不是靠猜的,也不是只看广播包就能完全知道的。

连接建立后,可以通过这个命令读取对端设备支持的 LE Link Layer features。

例如你想知道对端是否支持:

LE Data Packet Length Extension
LE 2M PHY
LE Coded PHY
LE Extended Advertising
Channel Selection Algorithm #2

就要依赖远端特性信息。


关键信息 2:它基于 Connection_Handle

这个命令只有一个参数:

Connection_Handle

说明它不是“扫描阶段”的命令,而是“连接建立后”的命令。

Connection_Handle 指定:

要读取哪一条连接上的对端设备能力。

如果本地设备同时连接多个 Peripheral,每条连接都有自己的 handle,每个对端的特性也可能不同。


关键信息 3:Central 和 Peripheral 都可以发

规范明确说:

This command may be issued on both the Central and Peripheral.

这说明读取对端特性不是 Central 专属行为。

只要连接已经建立:

Central 可以读取 Peripheral 的特性
Peripheral 也可以读取 Central 的特性

关键信息 4:结果通过 Complete event 返回

这个命令没有 Return Parameters。

最终结果在:

HCI_LE_Read_Remote_Features_Page_0_Complete event

里面。

这个 event 会包含:

Status
Connection_Handle
LE_Features

其中 LE_Features 才是你真正关心的远端能力位图。


关键信息 5:缓存结果是允许的

规范说:

the Controller may use a cached copy

具体说明:

如果这条连接上已经读取过一次 page 0 特性,Controller 可以直接返回缓存结果。

这对 Host 来说通常没有问题,因为同一条连接中的远端特性不会频繁变化。


九、和 BLE Legacy 连接的关系

这个命令不是建立连接所必需的第一步,但是它是连接建立后的重要能力确认命令。

典型位置如下:

Central 发起连接
        ↓
LE Connection Complete / LE Enhanced Connection Complete
        ↓
获得 Connection_Handle
        ↓
LE Read Remote Features Page 0
        ↓
根据对端能力决定后续操作
        ↓
是否 Set Data Length
是否 Set PHY
是否使用某些 Link Layer procedure

比如:

想切换 2M PHY:
需要确认本地和对端都支持 LE 2M PHY

想使用 Data Length Extension:
需要确认本地和对端都支持 LE Data Packet Length Extension

想让 Peripheral 发起连接参数更新:
需要确认双方是否支持 Connection Parameters Request Procedure

十、BLE Legacy 连接中最需要记住的内容

HCI_LE_Read_Remote_Features_Page_0 用于读取已经连接的对端设备支持哪些 LE 特性。

它以前叫 LE Read Remote Features。

它只有一个命令参数:Connection_Handle。

它可以由 Central 或 Peripheral 发起。

它不是扫描阶段使用的命令,而是连接建立后使用的命令。

这个命令没有 Return Parameters。

Controller 会先返回 HCI_Command_Status event。

最终结果通过 HCI_LE_Read_Remote_Features_Page_0_Complete event 返回。

如果已经读取过,Controller 可以使用缓存结果。

它的主要价值是判断后续能不能使用 Data Length、PHY Update、Connection Parameters Request 等连接相关能力。

 

Logo

智能硬件社区聚焦AI智能硬件技术生态,汇聚嵌入式AI、物联网硬件开发者,打造交流分享平台,同步全国赛事资讯、开展 OPC 核心人才招募,助力技术落地与开发者成长。

更多推荐