Firmware Distribution Server
The Firmware Distribution Server model, implemented as part of the Device Firmware Update (DFU) subsystem, fulfills the role of a distribution server. It extends the :ref: bluetooth_mesh_blob_srv to receive firmware image binary files from initiator nodes. Additionally, it instantiates a. It also instantiates a Firmware Update Client for distributing firmware updates across the entire mesh network.
Note
Currently, the Firmware Distribution Server supports out-of-band (OOB) retrieval of firmware images over SMP service only.
The Firmware Distribution Server does not have an API of its own, but relies on a Firmware Distribution Client model on a different device to give it information and trigger image distribution and upload.
Firmware Slots
The Firmware Distribution Server has the capability to store multiple firmware images for distribution. Each slot contains a separate firmware image with metadata and can be distributed to other mesh nodes in the network in any order. The content, format, and size of the firmware images are vendor-specific and may contain data from other vendors. Applications should not attempt to execute or modify them.
The slots are managed remotely by a Firmware Distribution Client, which can either upload new slots
or delete old ones. The application is notified of changes to the slots through the Firmware
Distribution Server’s callbacks (bt_mesh_fd_srv_cb
). While the metadata for each
firmware slot is stored internally, the application must provide a BLOB Streams
for reading and writing the firmware image.
API Reference
- 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.
- Parameters:
_cb – [in] Pointer to a bt_mesh_dfd_srv_cb instance.
-
BT_MESH_MODEL_DFD_SRV(_srv)
Firmware Distribution Server model Composition Data entry.
- Parameters:
_srv – Pointer to a Firmware Distribution Server model instance.
-
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.
-
int (*recv)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot, const struct bt_mesh_blob_io **io)
-
struct bt_mesh_dfd_srv
Firmware Distribution Server instance.
-
CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX