这个页面的 最新开发版本 可能比这个发布的 2.3-beta.1 版本新。

固件分发服务器

固件分发服务器模型为 设备固件更新(DFU) 子系统实现分发服务器角色。它扩展了 BLOB 传输服务器 , 用于从启动器节点接收固件映像二进制文件。它还实例化了一个 固件更新客户端 ,用于在整个网状网络中分发固件更新。

备注

目前,固件分发服务器仅支持通过 SMP 服务进行固件映像的带外(OOB)检索。

固件分发服务器没有自己的 API,但依赖于不同设备上的固件分发客户端模型来为其提供信息并触发映像分发和上传。

固件插槽

固件分发服务器能够存储多个固件映像以进行分发。每个插槽包含具有元数据的单独固件映像, 并且可以以任何顺序分发到网络中的其他网状节点。固件映像的内容、格式和大小特定于供应商, 并且可能包含来自其他供应商的数据。应用程序不应尝试执行或修改它们。

插槽由固件分发客户端远程管理,该客户端既可以上载新插槽,也可以删除旧插槽。通过固件分发服务器的回调( bt_mesh_fd_srv_cb )将插槽的更改通知应用程序。虽然每个固件插槽的元数据都存储在内部,但应用程序必须提供 BLOB 流 以读取和写入固件映像。

API 参考

group bt_mesh_dfd_srv

API for the Firmware Distribution Server model.

Defines

CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX
CONFIG_BT_MESH_DFD_SRV_SLOT_MAX_SIZE
CONFIG_BT_MESH_DFD_SRV_SLOT_SPACE
BT_MESH_DFD_SRV_INIT(_cb)

Initialization parameters for the Firmware Distribution Server model.

参数:
BT_MESH_MODEL_DFD_SRV(_srv)

Firmware Distribution Server model Composition Data entry.

参数:
struct bt_mesh_dfd_srv_cb

Firmware Distribution Server callbacks:

Public Members

int (*recv)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot, const struct bt_mesh_blob_io **io)

Slot receive callback.

Called at the start of an upload procedure. The callback must fill io with a pointer to a writable BLOB stream for the Firmware Distribution Server to write the firmware image to.

Param srv:

Firmware Distribution Server model instance.

Param slot:

DFU image slot being received.

Param io:

BLOB stream response pointer.

Return:

0 on success, or (negative) error code otherwise.

void (*del)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot)

Slot delete callback.

Called when the Firmware Distribution Server is about to delete a DFU image slot. All allocated data associated with the firmware slot should be deleted.

Param srv:

Firmware Update Server instance.

Param slot:

DFU image slot being deleted.

int (*send)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot, const struct bt_mesh_blob_io **io)

Slot send callback.

Called at the start of a distribution procedure. The callback must fill io with a pointer to a readable BLOB stream for the Firmware Distribution Server to read the firmware image from.

Param srv:

Firmware Distribution Server model instance.

Param slot:

DFU image slot being sent.

Param io:

BLOB stream response pointer.

Return:

0 on success, or (negative) error code otherwise.

void (*phase)(struct bt_mesh_dfd_srv *srv, enum bt_mesh_dfd_phase phase)

Phase change callback (Optional).

Called whenever the phase of the Firmware Distribution Server changes.

Param srv:

Firmware Distribution Server model instance.

Param phase:

New Firmware Distribution phase.

struct bt_mesh_dfd_srv

Firmware Distribution Server instance.