Zephyr API 3.6.99
Loading...
Searching...
No Matches

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.
 

Detailed Description

Firmware Update Server event callbacks.

Field Documentation

◆ apply

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.

Parameters
srvFirmware Update Server instance.
imgDFU image that should be applied.
Returns
0 on success, or (negative) error code otherwise.

◆ check

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.

Parameters
srvFirmware Update Server instance.
imgDFU image the metadata check is performed on.
metadataImage metadata.
effectReturn parameter for the image effect on the provisioning state of the mesh stack.
Returns
0 on success, or (negative) error code otherwise.

◆ end

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.

Parameters
srvFirmware Update Server instance.
imgDFU image that failed the update.
successWhether the DFU transfer was successful.

◆ recover

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.

Parameters
srvFirmware Update Server instance.
imgDFU image being updated.
ioBLOB stream return parameter. Must be set to a valid BLOB stream by the callback.
Returns
0 on success, or (negative) error code to abandon the transfer.

◆ start

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.

Parameters
srvFirmware Update Server instance.
imgDFU image being updated.
metadataImage metadata.
ioBLOB stream return parameter. Must be set to a valid BLOB stream by the callback.
Returns
0 on success, or (negative) error code otherwise. Return codes -ENOMEM, -EBUSY -EALREADY will be passed to the updater, other error codes are reported as internal errors.

The documentation for this struct was generated from the following file: