Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Firmware Update Server event callbacks. More...
#include <dfu_srv.h>
Data Fields | |
int(* | check )(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, struct net_buf_simple *metadata, enum bt_mesh_dfu_effect *effect) |
Transfer check callback. | |
int(* | start )(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, struct net_buf_simple *metadata, const struct bt_mesh_blob_io **io) |
Transfer start callback. | |
void(* | end )(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, bool success) |
Transfer end callback. | |
int(* | recover )(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, const struct bt_mesh_blob_io **io) |
Transfer recovery callback. | |
int(* | apply )(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img) |
Transfer apply callback. | |
Firmware Update Server event callbacks.
int(* bt_mesh_dfu_srv_cb::apply) (struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img) |
Transfer apply callback.
Called after a transfer has been validated, and the updater sends an apply message to the Target nodes.
This handler is optional.
srv | Firmware Update Server instance. |
img | DFU image that should be applied. |
int(* bt_mesh_dfu_srv_cb::check) (struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, struct net_buf_simple *metadata, enum bt_mesh_dfu_effect *effect) |
Transfer check callback.
The transfer check can be used to validate the incoming transfer before it starts. The contents of the metadata is implementation specific, and should contain all the information the application needs to determine whether this image should be accepted, and what the effect of the transfer would be.
If applying the image will have an effect on the provisioning state of the mesh stack, this can be communicated through the effect
return parameter.
The metadata check can be performed both as part of starting a new transfer and as a separate procedure.
This handler is optional.
srv | Firmware Update Server instance. |
img | DFU image the metadata check is performed on. |
metadata | Image metadata. |
effect | Return parameter for the image effect on the provisioning state of the mesh stack. |
void(* bt_mesh_dfu_srv_cb::end) (struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, bool success) |
Transfer end callback.
This handler is optional.
If the transfer is successful, the application should verify the firmware image, and call either bt_mesh_dfu_srv_verified or bt_mesh_dfu_srv_rejected depending on the outcome.
If the transfer fails, the Firmware Update Server will be available for new transfers immediately after this function returns.
srv | Firmware Update Server instance. |
img | DFU image that failed the update. |
success | Whether the DFU transfer was successful. |
int(* bt_mesh_dfu_srv_cb::recover) (struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, const struct bt_mesh_blob_io **io) |
Transfer recovery callback.
If the device reboots in the middle of a transfer, the Firmware Update Server calls this function when the Bluetooth Mesh subsystem is started.
This callback is optional, but transfers will not be recovered after a reboot without it.
srv | Firmware Update Server instance. |
img | DFU image being updated. |
io | BLOB stream return parameter. Must be set to a valid BLOB stream by the callback. |
int(* bt_mesh_dfu_srv_cb::start) (struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, struct net_buf_simple *metadata, const struct bt_mesh_blob_io **io) |
Transfer start callback.
Called when the Firmware Update Server is ready to start a new DFU transfer. The application must provide an initialized BLOB stream to be used during the DFU transfer.
The following error codes are treated specially, and should be used to communicate these issues:
-ENOMEM:
The device cannot fit this image.-EBUSY:
The application is temporarily unable to accept the transfer.-EALREADY:
The device has already received and verified this image, and there's no need to transfer it again. The Firmware Update model will skip the transfer phase, and mark the image as verified.This handler is mandatory.
srv | Firmware Update Server instance. |
img | DFU image being updated. |
metadata | Image metadata. |
io | BLOB stream return parameter. Must be set to a valid BLOB stream by the callback. |
-ENOMEM
, -EBUSY
-EALREADY
will be passed to the updater, other error codes are reported as internal errors.