Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
dfu_srv.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_SRV_H__
16#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_SRV_H__
17
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26struct bt_mesh_dfu_srv;
27
36#define BT_MESH_DFU_SRV_INIT(_handlers, _imgs, _img_count) \
37 { \
38 .blob = { .cb = &_bt_mesh_dfu_srv_blob_cb }, .cb = _handlers, \
39 .imgs = _imgs, .img_count = _img_count, \
40 }
41
48#define BT_MESH_MODEL_DFU_SRV(_srv) \
49 BT_MESH_MODEL_BLOB_SRV(&(_srv)->blob), \
50 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_DFU_SRV, _bt_mesh_dfu_srv_op, NULL, \
51 _srv, &_bt_mesh_dfu_srv_cb)
52
80 int (*check)(struct bt_mesh_dfu_srv *srv,
81 const struct bt_mesh_dfu_img *img,
82 struct net_buf_simple *metadata,
83 enum bt_mesh_dfu_effect *effect);
84
113 int (*start)(struct bt_mesh_dfu_srv *srv,
114 const struct bt_mesh_dfu_img *img,
115 struct net_buf_simple *metadata,
116 const struct bt_mesh_blob_io **io);
117
133 void (*end)(struct bt_mesh_dfu_srv *srv,
134 const struct bt_mesh_dfu_img *img, bool success);
135
152 int (*recover)(struct bt_mesh_dfu_srv *srv,
153 const struct bt_mesh_dfu_img *img,
154 const struct bt_mesh_blob_io **io);
155
168 int (*apply)(struct bt_mesh_dfu_srv *srv,
169 const struct bt_mesh_dfu_img *img);
170};
171
180 const struct bt_mesh_dfu_srv_cb *cb;
182 const struct bt_mesh_dfu_img *imgs;
184 size_t img_count;
185
186 /* Runtime state */
187 const struct bt_mesh_model *mod;
188 struct {
189 /* Effect of transfer, @see bt_mesh_dfu_effect. */
191 /* Current phase, @see bt_mesh_dfu_phase. */
198};
199
211
223
229
237
245
253
255extern const struct bt_mesh_model_op _bt_mesh_dfu_srv_op[];
256extern const struct bt_mesh_model_cb _bt_mesh_dfu_srv_cb;
257extern const struct bt_mesh_blob_srv_cb _bt_mesh_dfu_srv_blob_cb;
260#ifdef __cplusplus
261}
262#endif
263
264#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_SRV_H__ */
265
Access layer APIs.
void bt_mesh_dfu_srv_applied(struct bt_mesh_dfu_srv *srv)
Confirm that the received DFU transfer was applied.
void bt_mesh_dfu_srv_verified(struct bt_mesh_dfu_srv *srv)
Accept the received DFU transfer.
void bt_mesh_dfu_srv_rejected(struct bt_mesh_dfu_srv *srv)
Reject the received DFU transfer.
bool bt_mesh_dfu_srv_is_busy(const struct bt_mesh_dfu_srv *srv)
Check if the Firmware Update Server is busy processing a transfer.
uint8_t bt_mesh_dfu_srv_progress(const struct bt_mesh_dfu_srv *srv)
Get the progress of the current DFU procedure, in percent.
void bt_mesh_dfu_srv_cancel(struct bt_mesh_dfu_srv *srv)
Cancel the ongoing DFU transfer.
bt_mesh_dfu_effect
Expected effect of a DFU transfer.
Definition dfu.h:108
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
BLOB stream.
Definition blob.h:145
BLOB Transfer Server model event handlers.
Definition blob_srv.h:51
BLOB Transfer Server instance.
Definition blob_srv.h:131
DFU image instance.
Definition dfu.h:140
Firmware Update Server event callbacks.
Definition dfu_srv.h:54
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.
Definition dfu_srv.h:152
void(* end)(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img, bool success)
Transfer end callback.
Definition dfu_srv.h:133
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.
Definition dfu_srv.h:113
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.
Definition dfu_srv.h:80
int(* apply)(struct bt_mesh_dfu_srv *srv, const struct bt_mesh_dfu_img *img)
Transfer apply callback.
Definition dfu_srv.h:168
Firmware Update Server instance.
Definition dfu_srv.h:176
uint8_t idx
Definition dfu_srv.h:194
const struct bt_mesh_dfu_srv_cb * cb
Callback structure.
Definition dfu_srv.h:180
uint16_t meta
Definition dfu_srv.h:196
uint16_t timeout_base
Definition dfu_srv.h:195
uint8_t effect
Definition dfu_srv.h:190
struct bt_mesh_blob_srv blob
Underlying BLOB Transfer Server.
Definition dfu_srv.h:178
uint8_t phase
Definition dfu_srv.h:192
const struct bt_mesh_model * mod
Definition dfu_srv.h:187
const struct bt_mesh_dfu_img * imgs
List of updatable images.
Definition dfu_srv.h:182
size_t img_count
Number of updatable images.
Definition dfu_srv.h:184
struct bt_mesh_dfu_srv::@109 update
uint8_t ttl
Definition dfu_srv.h:193
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
Simple network buffer representation.
Definition buf.h:87
static volatile bool success[4]
Definition test_mslab_threadsafe.c:37