Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
dfu_cli.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
15#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_CLI_H__
16#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_CLI_H__
17
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26struct bt_mesh_dfu_cli;
27
36#define BT_MESH_DFU_CLI_INIT(_handlers) \
37 { \
38 .cb = _handlers, \
39 .blob = { .cb = &_bt_mesh_dfu_cli_blob_handlers }, \
40 }
41
48#define BT_MESH_MODEL_DFU_CLI(_cli) \
49 BT_MESH_MODEL_BLOB_CLI(&(_cli)->blob), \
50 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_DFU_CLI, _bt_mesh_dfu_cli_op, NULL, \
51 _cli, &_bt_mesh_dfu_cli_cb)
52
65};
66
75};
76
91
106};
107
126 struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx, uint8_t idx,
127 uint8_t total, const struct bt_mesh_dfu_img *img, void *cb_data);
128
137 void (*suspended)(struct bt_mesh_dfu_cli *cli);
138
147 void (*ended)(struct bt_mesh_dfu_cli *cli,
148 enum bt_mesh_dfu_status reason);
149
157 void (*applied)(struct bt_mesh_dfu_cli *cli);
158
166 void (*confirmed)(struct bt_mesh_dfu_cli *cli);
167
176 void (*lost_target)(struct bt_mesh_dfu_cli *cli,
177 struct bt_mesh_dfu_target *target);
178};
179
186 const struct bt_mesh_dfu_cli_cb *cb;
189
190 /* runtime state */
191
193 const struct bt_mesh_model *mod;
194
195 struct {
196 const struct bt_mesh_dfu_slot *slot;
197 const struct bt_mesh_blob_io *io;
198 struct bt_mesh_blob_xfer blob;
202
203 struct {
208 struct k_sem sem;
209 void *params;
212};
213
216 /* Logarithmic representation of the block size. */
220};
221
227 const struct bt_mesh_dfu_slot *slot;
234};
235
253 const struct bt_mesh_blob_cli_inputs *inputs,
254 const struct bt_mesh_blob_io *io,
255 const struct bt_mesh_dfu_cli_xfer *xfer);
256
264
272
284 struct bt_mesh_msg_ctx *ctx);
285
296
311
320
329
349 struct bt_mesh_msg_ctx *ctx,
350 bt_mesh_dfu_img_cb_t cb, void *cb_data,
351 uint8_t max_count);
352
369 struct bt_mesh_msg_ctx *ctx, uint8_t img_idx,
370 const struct bt_mesh_dfu_slot *slot,
371 struct bt_mesh_dfu_metadata_status *rsp);
372
382 struct bt_mesh_msg_ctx *ctx,
383 struct bt_mesh_dfu_target_status *rsp);
384
390
396
398extern const struct bt_mesh_blob_cli_cb _bt_mesh_dfu_cli_blob_handlers;
399extern const struct bt_mesh_model_cb _bt_mesh_dfu_cli_cb;
400extern const struct bt_mesh_model_op _bt_mesh_dfu_cli_op[];
403#ifdef __cplusplus
404}
405#endif
406
407#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_CLI_H__ */
408
Access layer APIs.
bt_mesh_blob_xfer_mode
BLOB transfer mode.
Definition: blob.h:29
int bt_mesh_dfu_cli_resume(struct bt_mesh_dfu_cli *cli)
Resume the suspended transfer.
uint8_t bt_mesh_dfu_cli_progress(struct bt_mesh_dfu_cli *cli)
Get progress as a percentage of completion.
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_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_apply(struct bt_mesh_dfu_cli *cli)
Apply the completed DFU transfer.
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.
Definition: dfu_cli.h:125
int32_t bt_mesh_dfu_cli_timeout_get(void)
Get the current procedure timeout value.
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_cancel(struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx)
Cancel a DFU transfer.
void bt_mesh_dfu_cli_timeout_set(int32_t timeout)
Set the procedure timeout value.
int bt_mesh_dfu_cli_suspend(struct bt_mesh_dfu_cli *cli)
Suspend a DFU transfer.
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.
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_confirm(struct bt_mesh_dfu_cli *cli)
Confirm that the active transfer has been applied on the Target nodes.
bt_mesh_dfu_iter
Action for DFU iteration callbacks.
Definition: dfu.h:128
bt_mesh_dfu_phase
DFU transfer phase.
Definition: dfu.h:42
bt_mesh_dfu_status
DFU status.
Definition: dfu.h:79
bt_mesh_dfu_effect
Expected effect of a DFU transfer.
Definition: dfu.h:108
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Event handler callbacks for the BLOB Transfer Client model.
Definition: blob_cli.h:190
BLOB Transfer Client transfer inputs.
Definition: blob_cli.h:104
BLOB Transfer Client model instance.
Definition: blob_cli.h:289
BLOB stream.
Definition: blob.h:145
BLOB Transfer Client Target node.
Definition: blob_cli.h:49
BLOB transfer.
Definition: blob.h:123
Firmware Update Client event callbacks.
Definition: dfu_cli.h:130
void(* confirmed)(struct bt_mesh_dfu_cli *cli)
DFU transfer confirmed on all active Target nodes.
Definition: dfu_cli.h:166
void(* applied)(struct bt_mesh_dfu_cli *cli)
DFU transfer applied on all active Target nodes.
Definition: dfu_cli.h:157
void(* ended)(struct bt_mesh_dfu_cli *cli, enum bt_mesh_dfu_status reason)
DFU ended.
Definition: dfu_cli.h:147
void(* lost_target)(struct bt_mesh_dfu_cli *cli, struct bt_mesh_dfu_target *target)
DFU Target node was lost.
Definition: dfu_cli.h:176
void(* suspended)(struct bt_mesh_dfu_cli *cli)
BLOB transfer is suspended.
Definition: dfu_cli.h:137
BLOB parameters for Firmware Update Client transfer:
Definition: dfu_cli.h:215
uint16_t chunk_size
Base chunk size.
Definition: dfu_cli.h:219
uint8_t block_size_log
Definition: dfu_cli.h:217
Firmware Update Client transfer parameters:
Definition: dfu_cli.h:223
const struct bt_mesh_dfu_cli_xfer_blob_params * blob_params
BLOB parameters to be used for the transfer, or NULL to retrieve Target nodes' capabilities before se...
Definition: dfu_cli.h:233
const struct bt_mesh_dfu_slot * slot
DFU image slot to transfer.
Definition: dfu_cli.h:227
enum bt_mesh_blob_xfer_mode mode
Transfer mode (Push (Push BLOB Transfer Mode) or Pull (Pull BLOB Transfer Mode))
Definition: dfu_cli.h:229
uint64_t blob_id
BLOB ID to use for this transfer, or 0 to set it randomly.
Definition: dfu_cli.h:225
Firmware Update Client model instance.
Definition: dfu_cli.h:184
const struct bt_mesh_dfu_cli_cb * cb
Callback structure.
Definition: dfu_cli.h:186
const struct bt_mesh_blob_io * io
Definition: dfu_cli.h:197
uint8_t flags
Definition: dfu_cli.h:200
uint8_t type
Definition: dfu_cli.h:205
struct bt_mesh_dfu_cli::@105 req
uint8_t ttl
Definition: dfu_cli.h:204
struct bt_mesh_dfu_cli::@104 xfer
uint16_t addr
Definition: dfu_cli.h:207
const struct bt_mesh_dfu_slot * slot
Definition: dfu_cli.h:196
struct bt_mesh_blob_cli blob
Underlying BLOB Transfer Client.
Definition: dfu_cli.h:188
uint32_t op
Definition: dfu_cli.h:192
bt_mesh_dfu_img_cb_t img_cb
Definition: dfu_cli.h:210
uint8_t img_cnt
Definition: dfu_cli.h:206
const struct bt_mesh_model * mod
Definition: dfu_cli.h:193
void * params
Definition: dfu_cli.h:209
uint8_t state
Definition: dfu_cli.h:199
DFU image instance.
Definition: dfu.h:140
Metadata status response.
Definition: dfu_cli.h:68
uint8_t idx
Image index.
Definition: dfu_cli.h:70
enum bt_mesh_dfu_effect effect
Effect of transfer.
Definition: dfu_cli.h:74
enum bt_mesh_dfu_status status
Status code.
Definition: dfu_cli.h:72
DFU image slot for DFU distribution.
Definition: dfu.h:152
DFU Target node status parameters.
Definition: dfu_cli.h:78
uint16_t timeout_base
Additional response time for the Target nodes, in 10-second increments.
Definition: dfu_cli.h:105
enum bt_mesh_dfu_status status
Status of the previous operation.
Definition: dfu_cli.h:80
uint64_t blob_id
BLOB ID used in the transfer.
Definition: dfu_cli.h:86
uint8_t ttl
TTL used in the transfer.
Definition: dfu_cli.h:90
enum bt_mesh_dfu_phase phase
Phase of the current DFU transfer.
Definition: dfu_cli.h:82
uint8_t img_idx
Image index to transfer.
Definition: dfu_cli.h:88
enum bt_mesh_dfu_effect effect
The effect the update will have on the Target device's state.
Definition: dfu_cli.h:84
DFU Target node.
Definition: dfu_cli.h:54
uint8_t effect
Expected DFU effect, see bt_mesh_dfu_effect.
Definition: dfu_cli.h:60
uint8_t phase
Current DFU phase, see bt_mesh_dfu_phase.
Definition: dfu_cli.h:64
uint8_t status
Current DFU status, see bt_mesh_dfu_status.
Definition: dfu_cli.h:62
struct bt_mesh_blob_target blob
BLOB Target node.
Definition: dfu_cli.h:56
uint8_t img_idx
Image index on the Target node.
Definition: dfu_cli.h:58
Model callback functions.
Definition: access.h:809
Model opcode handler.
Definition: access.h:359
Abstraction that describes a Mesh Model instance.
Definition: access.h:887
Message sending context.
Definition: msg.h:76