Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

API for the Bluetooth Mesh Firmware Update Client model More...

Data Structures

struct  bt_mesh_dfu_target
 DFU Target node. More...
 
struct  bt_mesh_dfu_metadata_status
 Metadata status response. More...
 
struct  bt_mesh_dfu_target_status
 DFU Target node status parameters. More...
 
struct  bt_mesh_dfu_cli_cb
 Firmware Update Client event callbacks. More...
 
struct  bt_mesh_dfu_cli
 Firmware Update Client model instance. More...
 
struct  bt_mesh_dfu_cli_xfer_blob_params
 BLOB parameters for Firmware Update Client transfer: More...
 
struct  bt_mesh_dfu_cli_xfer
 Firmware Update Client transfer parameters: More...
 

Macros

#define BT_MESH_DFU_CLI_INIT(_handlers)
 Initialization parameters for the Firmware Uppdate Client model.
 
#define BT_MESH_MODEL_DFU_CLI(_cli)
 Firmware Update Client model Composition Data entry.
 

Typedefs

typedef enum bt_mesh_dfu_iter(* bt_mesh_dfu_img_cb_t) (struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx, uint8_t idx, uint8_t total, const struct bt_mesh_dfu_img *img, void *cb_data)
 DFU image callback.
 

Functions

int bt_mesh_dfu_cli_send (struct bt_mesh_dfu_cli *cli, const struct bt_mesh_blob_cli_inputs *inputs, const struct bt_mesh_blob_io *io, const struct bt_mesh_dfu_cli_xfer *xfer)
 Start distributing a DFU.
 
int bt_mesh_dfu_cli_suspend (struct bt_mesh_dfu_cli *cli)
 Suspend a DFU transfer.
 
int bt_mesh_dfu_cli_resume (struct bt_mesh_dfu_cli *cli)
 Resume the suspended transfer.
 
int bt_mesh_dfu_cli_cancel (struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx)
 Cancel a DFU transfer.
 
int bt_mesh_dfu_cli_apply (struct bt_mesh_dfu_cli *cli)
 Apply the completed DFU transfer.
 
int bt_mesh_dfu_cli_confirm (struct bt_mesh_dfu_cli *cli)
 Confirm that the active transfer has been applied on the Target nodes.
 
uint8_t bt_mesh_dfu_cli_progress (struct bt_mesh_dfu_cli *cli)
 Get progress as a percentage of completion.
 
bool bt_mesh_dfu_cli_is_busy (struct bt_mesh_dfu_cli *cli)
 Check whether a DFU transfer is in progress.
 
int bt_mesh_dfu_cli_imgs_get (struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx, bt_mesh_dfu_img_cb_t cb, void *cb_data, uint8_t max_count)
 Perform a DFU image list request.
 
int bt_mesh_dfu_cli_metadata_check (struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx, uint8_t img_idx, const struct bt_mesh_dfu_slot *slot, struct bt_mesh_dfu_metadata_status *rsp)
 Perform a metadata check for the given DFU image slot.
 
int bt_mesh_dfu_cli_status_get (struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_dfu_target_status *rsp)
 Get the status of a Target node.
 
int32_t bt_mesh_dfu_cli_timeout_get (void)
 Get the current procedure timeout value.
 
void bt_mesh_dfu_cli_timeout_set (int32_t timeout)
 Set the procedure timeout value.
 

Detailed Description

API for the Bluetooth Mesh Firmware Update Client model

Macro Definition Documentation

◆ BT_MESH_DFU_CLI_INIT

#define BT_MESH_DFU_CLI_INIT ( _handlers)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Value:
{ \
.cb = _handlers, \
.blob = { .cb = &_bt_mesh_dfu_cli_blob_handlers }, \
}

Initialization parameters for the Firmware Uppdate Client model.

See also
bt_mesh_dfu_cli_cb.
Parameters
_handlersHandler callback structure.

◆ BT_MESH_MODEL_DFU_CLI

#define BT_MESH_MODEL_DFU_CLI ( _cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Value:
BT_MESH_MODEL_BLOB_CLI(&(_cli)->blob), \
BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_DFU_CLI, _bt_mesh_dfu_cli_op, NULL, \
_cli, &_bt_mesh_dfu_cli_cb)
#define BT_MESH_MODEL_ID_DFU_CLI
Firmware Update Client.
Definition access.h:353
#define BT_MESH_MODEL_BLOB_CLI(_cli)
BLOB Transfer Client model Composition Data entry.
Definition blob_cli.h:33

Firmware Update Client model Composition Data entry.

Parameters
_cliPointer to a Firmware Uppdate Client model instance.

Typedef Documentation

◆ bt_mesh_dfu_img_cb_t

typedef enum bt_mesh_dfu_iter(* bt_mesh_dfu_img_cb_t) (struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx, uint8_t idx, uint8_t total, const struct bt_mesh_dfu_img *img, void *cb_data)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

DFU image callback.

The image callback is called for every DFU image on the Target node when calling bt_mesh_dfu_cli_imgs_get.

Parameters
cliFirmware Update Client model instance.
ctxMessage context of the received message.
idxImage index.
totalTotal number of images on the Target node.
imgImage information for the given image index.
cb_dataCallback data.
Return values
BT_MESH_DFU_ITER_STOPStop iterating through the image list and return from bt_mesh_dfu_cli_imgs_get.
BT_MESH_DFU_ITER_CONTINUEContinue iterating through the image list if any images remain.

Function Documentation

◆ bt_mesh_dfu_cli_apply()

int bt_mesh_dfu_cli_apply ( struct bt_mesh_dfu_cli * cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Apply the completed DFU transfer.

A transfer can only be applied after it has ended successfully. The Firmware Update Client's applied callback is called at the end of the apply procedure.

Parameters
cliFirmware Update Client model instance.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_cancel()

int bt_mesh_dfu_cli_cancel ( struct bt_mesh_dfu_cli * cli,
struct bt_mesh_msg_ctx * ctx )

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Cancel a DFU transfer.

Will cancel the ongoing DFU transfer, or the transfer on a specific Target node if ctx is valid.

Parameters
cliFirmware Update Client model instance.
ctxMessage context, or NULL to cancel the ongoing DFU transfer.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_confirm()

int bt_mesh_dfu_cli_confirm ( struct bt_mesh_dfu_cli * cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Confirm that the active transfer has been applied on the Target nodes.

A transfer can only be confirmed after it has been applied. The Firmware Update Client's confirmed callback is called at the end of the confirm procedure.

Target nodes that have reported the effect as BT_MESH_DFU_EFFECT_UNPROV are expected to not respond to the query, and will fail if they do.

Parameters
cliFirmware Update Client model instance.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_imgs_get()

int bt_mesh_dfu_cli_imgs_get ( struct bt_mesh_dfu_cli * cli,
struct bt_mesh_msg_ctx * ctx,
bt_mesh_dfu_img_cb_t cb,
void * cb_data,
uint8_t max_count )

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Perform a DFU image list request.

Requests the full list of DFU images on a Target node, and iterates through them, calling the cb for every image.

The DFU image list request can be used to determine which image index the Target node holds its different firmwares in.

Waits for a response until the procedure timeout expires.

Parameters
cliFirmware Update Client model instance.
ctxMessage context.
cbCallback to call for each image index.
cb_dataCallback data to pass to cb.
max_countMax number of images to return.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_is_busy()

bool bt_mesh_dfu_cli_is_busy ( struct bt_mesh_dfu_cli * cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Check whether a DFU transfer is in progress.

Parameters
cliFirmware Update Client model instance.
Returns
true if the BLOB Transfer Client is currently participating in a transfer, false otherwise.

◆ bt_mesh_dfu_cli_metadata_check()

int bt_mesh_dfu_cli_metadata_check ( struct bt_mesh_dfu_cli * cli,
struct bt_mesh_msg_ctx * ctx,
uint8_t img_idx,
const struct bt_mesh_dfu_slot * slot,
struct bt_mesh_dfu_metadata_status * rsp )

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Perform a metadata check for the given DFU image slot.

The metadata check procedure allows the Firmware Update Client to check if a Target node will accept a transfer of this DFU image slot, and what the effect would be.

Waits for a response until the procedure timeout expires.

Parameters
cliFirmware Update Client model instance.
ctxMessage context.
img_idxTarget node's image index to check.
slotDFU image slot to check for.
rspMetadata status response buffer.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_progress()

uint8_t bt_mesh_dfu_cli_progress ( struct bt_mesh_dfu_cli * cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Get progress as a percentage of completion.

Parameters
cliFirmware Update Client model instance.
Returns
The progress of the current transfer in percent, or 0 if no transfer is active.

◆ bt_mesh_dfu_cli_resume()

int bt_mesh_dfu_cli_resume ( struct bt_mesh_dfu_cli * cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Resume the suspended transfer.

Parameters
cliFirmware Update Client instance.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_send()

int bt_mesh_dfu_cli_send ( struct bt_mesh_dfu_cli * cli,
const struct bt_mesh_blob_cli_inputs * inputs,
const struct bt_mesh_blob_io * io,
const struct bt_mesh_dfu_cli_xfer * xfer )

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Start distributing a DFU.

Starts distribution of the firmware in the given slot to the list of DFU Target nodes in ctx. The transfer runs in the background, and its end is signalled through the bt_mesh_dfu_cli_cb::ended callback.

Note
The BLOB Transfer Client transfer inputs targets list must point to a list of bt_mesh_dfu_target nodes.
Parameters
cliFirmware Update Client model instance.
inputsBLOB Transfer Client transfer inputs.
ioBLOB stream to read BLOB from.
xferFirmware Update Client transfer parameters.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_status_get()

int bt_mesh_dfu_cli_status_get ( struct bt_mesh_dfu_cli * cli,
struct bt_mesh_msg_ctx * ctx,
struct bt_mesh_dfu_target_status * rsp )

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Get the status of a Target node.

Parameters
cliFirmware Update Client model instance.
ctxMessage context.
rspResponse data buffer.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_suspend()

int bt_mesh_dfu_cli_suspend ( struct bt_mesh_dfu_cli * cli)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Suspend a DFU transfer.

Parameters
cliFirmware Update Client instance.
Returns
0 on success, or (negative) error code otherwise.

◆ bt_mesh_dfu_cli_timeout_get()

int32_t bt_mesh_dfu_cli_timeout_get ( void )

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Get the current procedure timeout value.

Returns
The configured procedure timeout.

◆ bt_mesh_dfu_cli_timeout_set()

void bt_mesh_dfu_cli_timeout_set ( int32_t timeout)

#include <zephyr/bluetooth/mesh/dfu_cli.h>

Set the procedure timeout value.

Parameters
timeoutThe new procedure timeout.