ESP-IDF ESP-BLE-MESH 术语全解:从角色、地址、安全到 Foundation Models 的官方定义与源码印证
ESP-IDF ESP-BLE-MESH 术语全解从角色、地址、安全到 Foundation Models 的官方定义与源码印证【免费下载链接】esp-idfEspressif IoT Development Framework. Official development framework for Espressif SoCs.项目地址: https://gitcode.com/GitHub_Trending/es/esp-idf导读本文基于 ESP-IDF 官方文档 docs/en/api-guides/esp-ble-mesh/ble-mesh-terminology.rst 整理而成系统梳理 ESP-BLE-MESHEspressif 在 ESP-IDF 中实现的 Bluetooth Mesh 协议栈的九大类核心术语网络角色、节点组成、特性、配网、地址、安全、消息、Foundation Models 与网络管理。读者学完本文将能准确区分 Node / Relay / Proxy / Friend / LPN 等节点角色理解 State / Model / Element 的组成关系掌握 Unicast / Virtual / Group 地址语义、DevKey / AppKey 安全体系以及配网认证的四种 OOB 方式并知晓这些概念在 ESP-IDF 源码esp_ble_mesh_defs.h中的对应定义为后续配置与开发 ESP-BLE-MESH 应用打下坚实的概念基础。一、网络角色Role谁在 ESP-BLE-MESH 网络中扮演什么身份ESP-BLE-MESH 网络中每一台设备都根据其被配网的状态与开启的特性承担不同角色。下表为官方定义与详细解释的完整汇总。TermOfficial DefinitionDetailed ExplanationUnprovisioned Device未配网设备A device that is not a member of a mesh network is known as an unprovisioned device.典型例子照明设备、温控设备、制造设备、电动门等。它们尚未加入任何 Mesh 网络。Node节点A node is a provisioned device.未配网设备被配网Provisioning成功后即成为节点。节点如灯具、温控器、制造设备、电动门能够发送、接收或中继 ESP-BLE-MESH 消息并可选支持一个或多个子网。Relay Node中继节点A node that supports the Relay feature and has the Relay feature enabled is known as a Relay node.中继节点可接收并重新发送 ESP-BLE-MESH 消息使消息能传输得更远。用户可根据节点状态决定是否开启转发功能。消息可被多次中继每次中继计为一次 hop跳最多可达 126 跳足以覆盖广域范围内的消息传输。Proxy Node代理节点A node that supports the Proxy feature and has the Proxy feature enabled is known as a Proxy node.代理节点从一种 bearer通常包括 advertising bearer 与 GATT bearer接收消息并从另一种 bearer 重新发送。其目的是让仅支持 GATT bearer 的通信设备接入 ESP-BLE-MESH 网络。一般而言手机 App 必须通过代理节点才能访问 Mesh 网络——没有代理节点手机 App 无法与 Mesh 网络成员通信。Friend Node友节点A node that supports the Friend feature, has the Friend feature enabled, and has a friendship with a node that supports the Low Power feature is known as a Friend node.友节点相当于低功耗节点LPN的备份可代为存储发给 LPN 的消息与安全更新并在 LPN 需要时移交。LPN 必须与一个支持 Friend 特性的节点建立 friendship友邻关系以降低接收机占空比从而降低功耗。LPN 寻找 Friend 节点并建立友邻关系的过程称为 friendship establishment。二者的协作使 LPN 能调度无线电的使用从而以适当或较低的频率接收消息无需持续监听LPN 会轮询 Friend 节点检查是否有新消息。Low Power Node低功耗节点LPNA node that supports the Low Power feature and has a friendship with a node that supports the Friend feature is known as a Low Power node.通过轮询pollingLPN 从 Friend 节点获取消息、安全更新等信息。Provisioner配网器A node that is capable of adding a device to a mesh network.能够为未配网设备配网的设备称为 Provisioner。该过程通常需要通过 App 完成App 一般由产品厂商提供可运行于网关、智能手机、平板或其他载体上。源码印证角色与特性的底层定义上述角色与特性的区分在源码中有直接对应。在 esp_ble_mesh_defs.h 中中继状态被定义为三态枚举#define ESP_BLE_MESH_RELAY_DISABLED 0x00 #define ESP_BLE_MESH_RELAY_ENABLED 0x01 #define ESP_BLE_MESH_RELAY_NOT_SUPPORTED 0x02这与文档中支持 Relay 特性且已启用 Relay 特性才称为中继节点的定义完全一致RELAY_NOT_SUPPORTED表示节点根本不支持中继RELAY_DISABLED表示支持但未开启只有RELAY_ENABLED对应的节点才是真正意义上的 Relay Node。友邻关系的建立与终止在配网事件回调中有专门的事件类型例如 esp_ble_mesh_defs.h 中的ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT、ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT、ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT、ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT且终止原因枚举中包含了 Poll 超时、收到 Friend Clear、Friend 特性被禁用等细分场景印证了文档所述轮询机制与友邻关系维护的工程实现。二、节点组成CompositionState、Model 与 Element一个节点的功能由若干可寻址实体与状态共同描述理解这一层是编写自定义模型的前提。TermOfficial DefinitionDetailed ExplanationState状态A value representing a condition of an element that is exposed by an element of a node.网络中每个节点都有一组独立的状态值用于指示设备特定状态例如照明设备的亮度、颜色。状态值的变化会导致设备物理状态改变例如切换设备的开/关状态实际上就是在开/关设备。Model模型A model defines the basic functionality of a node.一个节点可包含多个模型每个模型定义节点的基本功能如节点所需的状态、控制这些状态的消息、以及消息处理所产生的结果。节点的功能实现基于模型。模型分为 SIG Model由 SIG 定义与 Vendor Model由用户自定义两大类。Element元素An addressable entity within a device.一个节点可包含一个或多个元素每个元素拥有一个单播地址以及一个或多个模型同一元素内包含的模型不得重复。Composition Data State组合数据状态The Composition Data state contains information about a node, the elements it includes, and the supported models.通过读取 Composition Data 状态值用户可获知节点基本信息如元素数量、每个元素中的模型。Provisioner 通过该消息进一步配网设备如配置节点的订阅地址与发布地址。源码印证Element 与 Model 的宏定义在 esp_ble_mesh_defs.h 中SIG 模型与厂商模型分别通过ESP_BLE_MESH_SIG_MODEL与ESP_BLE_MESH_VENDOR_MODEL宏定义Element 则通过ESP_BLE_MESH_ELEMENT(_loc, _mods, _vnd_mods)宏声明其中_loc为位置描述符Location Descriptor_mods为 SIG 模型数组_vnd_mods为厂商模型数组并用sig_model_count与vnd_model_count记录数量。宏内部将模型的 keys 初始化为ESP_BLE_MESH_MODEL_KEYS_UNUSED、groups 初始化为ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED体现了模型默认不绑定任何应用密钥、不订阅任何组地址的初始语义。若元素没有 SIG 或厂商模型可传入ESP_BLE_MESH_MODEL_NONE。这正对应文档中同一元素内的模型不得重复以及元素是可寻址实体的设计每个元素因拥有独立单播地址而可被独立寻址。三、网络特性Features四项核心能力的官方定义TermOfficial DefinitionDetailed ExplanationLow Power FeatureThe ability to operate within a mesh network at significantly reduced receiver duty cycles only in conjunction with a node supporting the Friend feature.该特性降低节点功耗。当 LPN 搜索 Friend 节点且附近存在多个候选 Friend 节点时会通过算法选择最合适的 Friend 节点。Friend FeatureThe ability to help a node supporting the Low Power feature to operate by storing messages destined for those nodes.开启 Friend 特性的节点可代为存储发往 LPN 的信息。开启该特性可能带来更高的功耗与内存开销。Relay FeatureThe ability to receive and retransmit mesh messages over the advertising bearer to enable larger networks.中继特性使 ESP-BLE-MESH 消息可在节点间多次跳转传输距离可超过两节点间直接无线电传输的范围从而覆盖整个网络。启用中继的节点只中继自己子网的消息不中继其他子网的消息中继分段消息时不考虑数据完整性——节点收到每一个分段消息即转发而不会等待完整消息。Proxy FeatureThe ability to receive and retransmit mesh messages between GATT and advertising bearers.代理特性的目的是让没有 advertising bearer 的节点也能接入 ESP-BLE-MESH 网络通常用于需要连接手机 App 的节点。源码印证中继与转发配置中继重传参数在配置模型中作为状态暴露。在 esp_ble_mesh_config_model_api.h 中relay_retransmitRelay Retransmit 状态与 Relay 开关状态一同由 Configuration Server Model 维护用户可通过 Config Relay Set 消息调整。文档特别指出中继分段消息时不等待完整消息、逐段转发这是 Mesh 协议降低端到端延迟的设计选择代价是接收端仍需自行完成分段重组。此外消息跳数上限 126 与 esp_ble_mesh_defs.h 中定义的 TTL 机制配合ESP_BLE_MESH_TTL_DEFAULT0xFF表示使用节点配置的默认 TTLESP_BLE_MESH_TTL_MAX0x7F为最大允许 TTL每经过一跳 TTL 递减从而限制消息在网络中的传播范围。四、配网ProvisioningBearer、认证方式与配网流程配网是将未配网设备变为节点的过程其承载方式与认证方式是开发者在实现 Provisioner 与设备端时必须理解的核心。TermOfficial DefinitionDetailed ExplanationPB-ADVPB-ADV is a provisioning bearer used to provision a device using Generic Provisioning PDUs over the advertising channels.PB-ADV 通过广播信道传输配网过程产生的数据包。只有当 Provisioner 与未配网设备都支持 PB-ADV 时才能使用该方式配网。PB-GATTPB-GATT is a provisioning bearer used to provision a device using Proxy PDUs to encapsulate Provisioning PDUs within the Mesh Provisioning Service.PB-GATT 使用连接信道传输配网过程产生的数据包。未配网设备若要通过该方式配网必须实现相关的 Mesh Provisioning Service未实现该服务的设备无法通过 PB-GATT bearer 被配入 Mesh 网络。PB-RemoteThe PB-Remote provisioning bearer uses the existing mesh network to provision an unprovisioned device that is not within immediate radio range of the Provisioner.PB-Remote 使用现有 Mesh 网络为不在 Provisioner 直接射频范围内的未配网设备配网。其最后一跳到达未配网设备使用 PB-ADV 或 PB-GATT bearer。ProvisioningProvisioning is a process of adding an unprovisioned device to a mesh network, managed by a Provisioner.配网过程将未配网设备转变为节点使其成为 ESP-BLE-MESH 网络的成员。Authentication MethodAuthentication is a step during the provisioning of nodes.未配网设备共有四种认证方式Output OOB、Input OOB、Static OOB、No OOB。Input OOBInput Out-of-Band例如Provisioner 生成并显示一个随机数然后提示用户采取适当动作将该随机数输入到未配网设备。以照明开关为例用户可在一定时间内多次按键以输入 Provisioner 上显示的随机数。Input OOB 与 Output OOB 的认证方式类似但设备角色相反。Output OOBOutput Out-of-Band例如未配网设备选择一个随机数并以与其功能兼容的方式输出该随机数。若未配网设备是灯泡可闪烁指定次数若带 LCD 屏幕可将随机数显示为多位数值。开始配网的用户应输入观察到的数字以认证该未配网设备。Static OOBStatic Out-of-Band使用 Static OOB 信息进行认证。若无需 OOB 信息则将 Static OOB 信息置为 0若需要 OOB 信息则使用 Static OOB 信息认证正在进行配网的设备。No OOBNo Out-of-Band将 Static OOB 字段值置为 0。这种方式相当于不对未配网设备进行认证。Certificate-based ProvisioningCertificate-based Out-of-Band基于证书的配网特性利用公钥基础设施PKI认证未配网设备的公钥与 UUID 信息。源码印证Bearer 与 OOB 枚举esp_ble_mesh_defs.h 中直接定义了上述概念对应的枚举typedef enum { ESP_BLE_MESH_NO_OOB, ESP_BLE_MESH_STATIC_OOB, ESP_BLE_MESH_OUTPUT_OOB, ESP_BLE_MESH_INPUT_OOB, } esp_ble_mesh_oob_method_t; typedef enum { ESP_BLE_MESH_PROV_ADV BIT(0), ESP_BLE_MESH_PROV_GATT BIT(1), } esp_ble_mesh_prov_bearer_t;esp_ble_mesh_oob_method_t完整覆盖文档所述四种认证方式esp_ble_mesh_prov_bearer_t对应 PB-ADV 与 PB-GATT 两种本地配网承载PB-Remote 在协议栈中作为远程配网模型能力提供。此外esp_ble_mesh_defs.h 还定义了输出动作ESP_BLE_MESH_BLINK闪烁、ESP_BLE_MESH_BEEP蜂鸣、ESP_BLE_MESH_VIBRATE振动、ESP_BLE_MESH_DISPLAY_NUMBER显示数字、ESP_BLE_MESH_DISPLAY_STRING显示字符串与输入动作ESP_BLE_MESH_PUSH按压、ESP_BLE_MESH_TWIST旋转、ESP_BLE_MESH_ENTER_NUMBER输入数字、ESP_BLE_MESH_ENTER_STRING输入字符串它们正是文档中灯泡闪烁指定次数按键输入随机数等例子的协议级实现。配套长度限制为Static OOB 最大值 16 字节ESP_BLE_MESH_PROV_STATIC_OOB_MAX_LENOutput/Input OOB 字符串最大值 8 字节ESP_BLE_MESH_PROV_OUTPUT_OOB_MAX_LEN/ESP_BLE_MESH_PROV_INPUT_OOB_MAX_LEN。配网链路事件ESP_BLE_MESH_PROV_LINK_OPEN_EVT/ESP_BLE_MESH_PROV_LINK_CLOSE_EVT等以及 Provisioner 侧的输出/输入 OOB 回调参数中均携带bearer与method字段开发者据此实现具体交互。五、地址Address四种地址类型与广播组地址地址体系决定了消息如何被寻址与分发是理解消息流向的关键。TermOfficial DefinitionDetailed ExplanationUnassigned Address未分配地址This is a special address type, with a value of 0x0000. Its use indicates that an Element has not yet been configured or had a Unicast Address assigned to it.尚未配置或未分配地址的元素所拥有的地址即未分配地址。这些元素因没有固定地址而不会参与消息传输。建议在用户代码设置地址之前将地址值设置为未分配地址。Unicast Address单播地址A unicast address is a unique address allocated to each element.配网过程中Provisioner 会在节点生命周期内为每个元素分配唯一的单播地址。单播地址可出现在消息的源/目的地址字段中发往单播地址的消息只能由拥有该单播地址的元素处理。Virtual Address虚拟地址A virtual address represents a set of destination addresses. Each virtual address logically represents a Label UUID, which is a 128-bit value that does not have to be managed centrally.虚拟地址与特定的 UUID 标签关联可作为模型的发布或订阅地址。Label UUID 是与一个或多个节点的元素关联的 128 位值。虚拟地址的第 15、14 位分别置 1、0第 13 至 0 位为哈希值共 16384 个哈希值该哈希由 Label UUID 派生而来。订阅元素若直接比对完整 128 位 UUID 效率很低而哈希值提供了更高效的方式来确定消息最终发往哪些元素。Group Address组地址A group address is an address that is programmed into zero or more elements.组地址是 ESP-BLE-MESH 网络中的另一种多播地址通常用于节点分组。发往 all-proxies 地址的消息由所有启用代理功能的节点的主元素处理发往 all-friends 地址的消息由所有启用友邻功能的节点的主元素处理发往 all-relays 地址的消息由所有启用中继功能的节点的主元素处理发往 all-nodes 地址的消息由所有节点的主元素处理。源码印证地址常量与配置操作码esp_ble_mesh_defs.h 给出了官方地址常量的直接对应#define ESP_BLE_MESH_ADDR_UNASSIGNED 0x0000 #define ESP_BLE_MESH_ADDR_ALL_NODES 0xFFFF #define ESP_BLE_MESH_ADDR_PROXIES 0xFFFC #define ESP_BLE_MESH_ADDR_FRIENDS 0xFFFD #define ESP_BLE_MESH_ADDR_RELAYS 0xFFFE其中0x0000即文档所述未分配地址0xFFFCall-proxies、0xFFFDall-friends、0xFFFEall-relays、0xFFFFall-nodes为固定组地址。虚拟地址在配置模型中通过专用操作码管理例如 esp_ble_mesh_defs.h 中的ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADDConfig Model Subscription Virtual Address Add与ESP_BLE_MESH_MODEL_OP_MODEL_PUB_VIRTUAL_ADDR_SETConfig Model Publication Virtual Address Set说明订阅/发布虚拟地址均需在模型中显式配置且虚拟地址采用128 位 Label UUID → 14 位哈希的压缩寻址方式以提升匹配效率。六、安全SecurityDevKey、AppKey 与两种安全材料Mesh 安全体系采用分层密钥网络层密钥保障全网广播安全应用层密钥实现应用级隔离设备密钥用于配置。TermOfficial DefinitionDetailed ExplanationDevice Key (DevKey)There is also a device key, which is a special application key that is unique to each node, is known only to the node and a Configuration Client, and is used to secure communications between the node and a Configuration Client.设备密钥用于配网设备与配置节点加密配置消息即设备被配置时 Provisioner 与节点之间传输的消息。Application Key (AppKey)Application keys are used to secure communications at the upper transport layer.应用密钥用于在将应用数据递交给应用层之前对其解密并在应用层数据下发过程中对其加密。网络中某些节点具有特定用途可根据应用需求限制对潜在敏感数据的访问通过这些特定应用密钥节点与特定应用绑定。通常使用不同应用密钥的领域包括安防楼宇门禁、机房、CEO 办公室、照明工厂、建筑外墙、人行道以及 HVAC 系统。应用密钥与网络密钥NetKey绑定即应用密钥只在所绑定的网络密钥上下文内使用且一个应用密钥只能绑定一个网络密钥。Flooding Security Material洪泛安全材料The flooding security material is derived from the network key (NetKey) and can be used by other nodes in the same network. Messages encrypted with flooding security material can be decoded by any node in the same network.使用友邻安全材料加密的友邻消息包括1. Friend Poll2. Friend Update3. Friend Subscription List 的添加/删除/确认4. 友节点发送给 LPN 的存储消息Stored Messages。使用洪泛安全材料加密的友邻消息包括1. Friend Clear2. Friend Clear Confirm。根据应用配置LPN 发给友节点的消息可用友邻安全材料或洪泛安全材料加密前者用于 LPN 与友节点之间传输的消息后者用于其他网络消息。Directed Security Material定向安全材料The directed security material is derived from the network key (NetKey) and can be used by other nodes in the directed forwarding path.需要经由定向转发路径转发的消息需使用定向安全材料加密。使用定向安全材料加密的消息可被同一定向转发路径上的任何节点解密。源码印证密钥索引与友邻凭据esp_ble_mesh_defs.h 中定义了密钥相关的常量#define ESP_BLE_MESH_KEY_UNUSED 0xFFFF #define ESP_BLE_MESH_KEY_DEV 0xFFFE #define ESP_BLE_MESH_KEY_PRIMARY 0x0000 #define ESP_BLE_MESH_KEY_ANY 0xFFFFESP_BLE_MESH_KEY_DEV即 DevKey 的索引ESP_BLE_MESH_KEY_PRIMARY为主网络密钥Primary NetKey索引。友邻安全材料在发送上下文中有显式标记esp_ble_mesh_defs.h 中的ESP_BLE_MESH_FRIENDSHIP_CRED友邻安全凭据与ESP_BLE_MESH_TAG_FRIENDSHIP标记为友邻 PDU在 core/access.c 中发送时依据模型发布配置的cred字段在BLE_MESH_FRIENDSHIP_CRED与BLE_MESH_FLOODING_CRED之间选择安全凭据与文档LPN 与友节点之间消息使用友邻安全材料、其他网络消息使用洪泛安全材料的描述完全吻合。由于一个 AppKey 只能绑定一个 NetKey模型发布时还需同时指定密钥索引进一步落实应用级密钥隔离。七、消息Message分段/重组与确认/非确认TermOfficial DefinitionDetailed ExplanationReassembly/Segmentation重组/分段Segmentation and reassembly (SAR) is a method of communication network, which is divided into small units before transmitting packets and reassembled in a proper order at the communication receiving end.底层传输层lower transport layer会自动对过大的消息进行分段。接收端返回响应消息发送端根据响应消息重新发送接收端未收到的数据包该过程由底层传输层自动完成。未分段消息最多 15 字节其中 4 字节为 transMIC因此有效负载为 11 字节分段情况下前几个数据包各有 12 个有效字节最后一个数据包为 8 个有效字节。特殊情况较短的包若被底层传输层强制分段则有效字节为 8 字节。Unacknowledged/Acknowledged非确认/确认There are two types of messages: Unacknowledged or Acknowledged.根据接收端是否需要返回响应消息发送的消息分为两类。发送端应设置最大重传次数。源码印证传输参数编码重传次数与间隔通过ESP_BLE_MESH_TRANSMIT系列宏编码。esp_ble_mesh_defs.h 定义了发布重传的编解码宏#define ESP_BLE_MESH_GET_TRANSMIT_INTERVAL(transmit) ((((transmit) 3) 1) * 10) #define ESP_BLE_MESH_PUBLISH_TRANSMIT(count, int_ms) ESP_BLE_MESH_TRANSMIT(count, (int_ms) / 5)ESP_BLE_MESH_PUBLISH_TRANSMIT(count, int_ms)将重传次数与间隔步长编码进一个字节ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT与ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL则用于解码实际传输次数为 N1间隔单位为 50 ms。这与文档发送端应设置最大重传次数的要求对应开发者可通过这些宏配置模型发布消息的重传策略。分段与重组由底层传输层透明完成接收端按序重组发送端依据接收端响应补发丢失数据包因此开发者通常无需直接干预 SAR 过程如需自定义可在较新协议版本中使用 SAR Configuration 模型见下节。八、Foundation Models配置、健康与扩展模型体系Foundation Models 是 Mesh 协议的基础模型每个节点/配网器必须实现其中的部分模型其余为可选扩展模型。TermOfficial DefinitionDetailed ExplanationConfiguration Server ModelThis model is used to represent a mesh network configuration of a device.节点必须包含 Configuration Server Model负责维护配置相关状态包括NetKey List、AppKey List、Model to AppKey List、Node Identity、Key Refresh Phase、Heartbeat Publish、Heartbeat Subscription、Network Transmit、Relay Retransmit 等。Configuration Client ModelThe model is used to represent an element that can control and monitor the configuration of a node.Configuration Client Model 使用消息控制 Configuration Server Model 维护的状态。Provisioner 必须包含该模型以便发送 Configuration Composition Data Get 等配置消息。Health Server ModelThis model is used to represent a mesh network diagnostics of a device.Health Server Model 主要用于设备检查自身状态、判断是否存在错误。其维护的状态包括Current Fault、Registered Fault、Health Period、Attention Timer。Health Client ModelThe model is used to represent an element that can control and monitor the health of a node.Health Client Model 使用消息控制 Health Server Model 维护的状态可通过 Health Fault Get 消息获取其他节点的自检信息。Remote Provisioning Server modelThe model is used to support the functionality of provisioning a remote device over the mesh network and to perform the Node Provisioning Protocol Interface procedures.Remote Provisioning Server 是根模型root model和主模型main model不扩展任何其他模型。Remote Provisioning Client modelThe model is used to support the functionality of provisioning devices into a mesh network by interacting with a mesh node that supports the Remote Provisioning Server model.Remote Provisioning Client 是根模型和主模型不扩展其他模型可使用 Remote Provisioning 消息操作 Remote Provisioning Server 模型定义的状态。Directed Forwarding Configuration Server modelThe model is used to support the configuration of the directed forwarding functionality of a node.Directed Forwarding Configuration Server 是主模型扩展自 Configuration Server 模型。Directed Forwarding Configuration Client modelThe model is used to support the functionality of a node that can configure the directed forwarding functionality of another node.Directed Forwarding Configuration Client 是根模型和主模型不扩展其他模型可使用 Directed Forwarding Configuration 消息操作 Directed Forwarding Configuration Server 模型定义的状态。Bridge Configuration Server modelThe model is used to support the configuration of the subnet bridge functionality of a node.Bridge Configuration Server 是主模型扩展自 Configuration Server 模型。Bridge Configuration Client modelThe model is used to support the functionality of a node that can configure the subnet bridge functionality of another node.Bridge Configuration Client 是根模型和主模型不扩展其他模型可使用 Bridge 消息操作 Bridge Configuration Server 模型定义的状态。Mesh Private Beacon Server modelThe model is used to support the configuration of the Mesh Private beacons functionality of a node.Mesh Private Beacon Server 是主模型扩展自 Configuration Server 模型。Mesh Private Beacon Client modelThe model is used to support the functionality of a node that can configure the Mesh Private beacons functionality of another node.Mesh Private Beacon Client 是根模型和主模型不扩展其他模型可使用 Mesh Private Beacon 消息操作 Mesh Private Beacon Server 模型定义的状态。On-Demand Private Proxy Server modelThe model is used to support the configuration of the advertising with Private Network Identity type functionality of a node.On-Demand Private Proxy Server 是主模型扩展自 Mesh Private Beacon Server 模型并与 Solicitation PDU RPL Configuration Server 模型对应。On-Demand Private Proxy Client modelThe model is used to support the functionality of a node that can configure the advertising with Private Network Identity type functionality of another node.On-Demand Private Proxy Client 是根模型和主模型不扩展其他模型可使用 On-Demand Private Proxy 消息操作 On-Demand Private Proxy Server 模型定义的状态。SAR Configuration Server modelThe model is used to support the configuration of the segmentation and reassembly behavior of a node.SAR Configuration Server 是根模型和主模型不扩展其他模型。SAR Configuration Client modelThe SAR Configuration Client model is used to support the functionality of configuring the behavior of the lower transport layer of a node that supports the SAR Configuration Server model.SAR Configuration Client 是根模型和主模型不扩展其他模型可使用 SAR Configuration 消息操作 SAR Configuration Server 模型定义的状态。Solicitation PDU RPL Configuration Server modelThe Solicitation PDU RPL Configuration Server model is used to support the functionality of removing items from the solicitation replay protection list of a node.该模型与 On-Demand Private Proxy Server 模型对应。Solicitation PDU RPL Configuration Client modelThe model is used to support the functionality of removing addresses from the solicitation replay protection list of a node that supports the Solicitation PDU RPL Configuration Server model.Solicitation PDU RPL Configuration Client 是根模型和主模型不扩展其他模型可使用 Solicitation PDU RPL Configuration 消息移除对端节点 solicitation replay protection list 中的条目。Opcodes Aggregator Server modelThe model is used to support the functionality of processing a sequence of access layer messages.Opcodes Aggregator Server 是根模型不扩展其他模型。Opcodes Aggregator Client modelThe model is used to support the functionality of dispatching a sequence of access layer messages to nodes supporting the Opcodes Aggregator Server model.Opcodes Aggregator Client 是根模型和主模型不扩展其他模型。Large Composition Data Server modelThe model is used to support the functionality of exposing pages of Composition Data that do not fit in a Config Composition Data Status message and to expose metadata of the model instances.Large Composition Data Server 是主模型扩展自 Configuration Server 模型。Large Composition Data Client modelThe model is used to support the functionality of reading pages of Composition Data that do not fit in a Config Composition Data Status message and reading the metadata of the model instances.Large Composition Data Client 是根模型不扩展其他模型可使用 Large Composition Data 消息操作 Large Composition Data Server 模型定义的状态。源码印证配置模型 API 与模型状态Configuration 相关模型在 esp_ble_mesh_config_model_api.h 中实现其中relay_retransmit字段与配置模型的relay_set结构体对应文档所述 Relay Retransmit 状态配网事件在 btc_ble_mesh_config_model.c 与 btc_ble_mesh_prov.c 中完成从协议核心到应用事件的转换。Foundation Models 的主模型/根模型层级关系意味着扩展自 Configuration Server 的模型如 Directed Forwarding、Bridge、Mesh Private Beacon、Large Composition Data、On-Demand Private Proxy天然继承配置状态维护能力而 Client 侧模型均为独立根模型各自通过专属消息与对应 Server 交互——这为开发者选择在既有协议栈模型之上扩展还是实现独立模型提供了清晰指引。九、网络管理Network Management密钥刷新与 IV 更新TermOfficial DefinitionDetailed ExplanationKey Refresh procedureThis procedure is used when the security of one or more network keys and/or one or more of the application keys has been compromised or could be compromised.Key Refresh Procedure 用于更新 ESP-BLE-MESH 网络的网络密钥与应用密钥适用于一个或多个网络密钥/应用密钥安全受到威胁或可能受到威胁的场景。通常在网络中部分节点被移除后更新密钥。IV (Initialization Vector) Update ProcedureA node can also use an IV Update procedure to signal to peer nodes that it is updating the IV Index.IV Update Procedure 用于更新 ESP-BLE-MESH 网络的 IV Index 值。该值与消息加密所需的随机数相关为确保随机数值不重复该值会周期性递增。IV Index 是 32 位值属于全网共享资源Mesh 网络中的所有节点共享同一个 IV Index 值。从 0x00000000 开始IV Index 在 IV Update 过程中递增并由特定流程维护确保全网 IV Index 一致。当节点认为自己有耗尽序列号的风险或判断其他节点序列号即将耗尽时可触发更新。注意更新间隔不得少于 96 小时。更新可在收到安全网络信标secure network beacon时触发或在节点判断自身序列号大于某阈值时触发。源码印证IV Index 的共享属性文档强调IV Index 是 32 位共享网络资源该特性在协议栈中由网络层统一维护所有节点在同一子网内使用一致的 IV Index 参与加密随机数派生从而避免随机数重用导致的安全风险。96 小时的最小更新间隔约束防止 IV Index 被频繁刷新保证全网同步的稳定性。开发者通常无需直接操作 IV 更新协议栈会依据安全网络信标与序列号阈值自动决策但当网络规模较大或存在频繁入退网时理解 Key Refresh 与 IV Update 机制有助于设计安全的密钥轮换与网络运维策略。结语术语体系在 ESP-BLE-MESH 开发中的定位本文完整收录了官方术语文档九大分类的全部条目并结合 esp_ble_mesh_defs.h 等源码文件给出底层印证。这套术语贯穿 ESP-BLE-MESH 开发的各个环节角色Role决定设备在网络中的行为定位CompositionState/Model/Element决定节点如何描述自身能力Features 决定节能与转发策略Provisioning 决定设备如何入网地址与安全体系决定消息如何寻址与加密消息机制决定传输效率Foundation Models 提供标准化的配置与诊断入口网络管理机制保障长期运行安全。建议读者在阅读 ble-mesh-architecture.rst 了解协议栈分层架构、ble-mesh-feature-list.rst 查看 ESP-BLE-MESH 已支持的特性矩阵并在遇到具体报错或行为疑问时查阅 ble-mesh-faq.rst。若需查询更多术语定义可参考 Bluetooth SIG 官方发布的 Mesh 术语表本文档原引用来源。【免费下载链接】esp-idfEspressif IoT Development Framework. Official development framework for Espressif SoCs.项目地址: https://gitcode.com/GitHub_Trending/es/esp-idf创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考