Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
dfd_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_DFD_SRV_H__
16#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFD_SRV_H__
17
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#ifndef CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX
29#define CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX 0
30#endif
31
32#ifndef CONFIG_BT_MESH_DFD_SRV_SLOT_MAX_SIZE
33#define CONFIG_BT_MESH_DFD_SRV_SLOT_MAX_SIZE 0
34#endif
35
36#ifndef CONFIG_BT_MESH_DFD_SRV_SLOT_SPACE
37#define CONFIG_BT_MESH_DFD_SRV_SLOT_SPACE 0
38#endif
39
40struct bt_mesh_dfd_srv;
41
42#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
54#define BT_MESH_DFD_SRV_OOB_INIT(_cb, _oob_schemes, _oob_schemes_count) \
55 { \
56 .cb = _cb, \
57 .dfu = BT_MESH_DFU_CLI_INIT(&_bt_mesh_dfd_srv_dfu_cb), \
58 .upload = { \
59 .blob = { .cb = &_bt_mesh_dfd_srv_blob_cb }, \
60 }, \
61 .oob_schemes = { \
62 .schemes = _oob_schemes, \
63 .count = _oob_schemes_count, \
64 }, \
65 }
66#endif /* CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD */
67
74#define BT_MESH_DFD_SRV_INIT(_cb) \
75 { \
76 .cb = _cb, \
77 .dfu = BT_MESH_DFU_CLI_INIT(&_bt_mesh_dfd_srv_dfu_cb), \
78 .upload = { \
79 .blob = { .cb = &_bt_mesh_dfd_srv_blob_cb }, \
80 }, \
81 }
82
89#define BT_MESH_MODEL_DFD_SRV(_srv) \
90 BT_MESH_MODEL_DFU_CLI(&(_srv)->dfu), \
91 BT_MESH_MODEL_BLOB_SRV(&(_srv)->upload.blob), \
92 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_DFD_SRV, _bt_mesh_dfd_srv_op, NULL, \
93 _srv, &_bt_mesh_dfd_srv_cb)
94
97
110 int (*recv)(struct bt_mesh_dfd_srv *srv,
111 const struct bt_mesh_dfu_slot *slot,
112 const struct bt_mesh_blob_io **io);
113
114#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
140 int (*start_oob_upload)(struct bt_mesh_dfd_srv *srv,
141 const struct bt_mesh_dfu_slot *slot,
142 const char *uri, uint8_t uri_len,
143 const uint8_t *fwid, uint16_t fwid_len);
144
154 void (*cancel_oob_upload)(struct bt_mesh_dfd_srv *srv,
155 const struct bt_mesh_dfu_slot *slot);
156
168 uint8_t (*oob_progress_get)(struct bt_mesh_dfd_srv *srv,
169 const struct bt_mesh_dfu_slot *slot);
170#endif /* CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD */
171
181 void (*del)(struct bt_mesh_dfd_srv *srv,
182 const struct bt_mesh_dfu_slot *slot);
183
196 int (*send)(struct bt_mesh_dfd_srv *srv,
197 const struct bt_mesh_dfu_slot *slot,
198 const struct bt_mesh_blob_io **io);
199
207 void (*phase)(struct bt_mesh_dfd_srv *srv, enum bt_mesh_dfd_phase phase);
208};
209
212 const struct bt_mesh_dfd_srv_cb *cb;
213 const struct bt_mesh_model *mod;
217 const struct bt_mesh_blob_io *io;
220 bool apply;
223
224 struct {
227 const struct flash_area *area;
228 struct bt_mesh_blob_srv blob;
229#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
230 bool is_oob;
231 bool is_pending_oob_check;
232 struct {
233 uint8_t uri_len;
235 uint16_t current_fwid_len;
237 struct bt_mesh_msg_ctx ctx;
238 } oob;
239#endif /* CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD */
241
242#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
243 struct {
244 const uint8_t *schemes;
245 const uint8_t count;
246 } oob_schemes;
247#endif /* CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD */
248};
249
250#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
276int bt_mesh_dfd_srv_oob_check_complete(struct bt_mesh_dfd_srv *srv,
277 const struct bt_mesh_dfu_slot *slot, int status,
278 uint8_t *fwid, size_t fwid_len);
279
295int bt_mesh_dfd_srv_oob_store_complete(struct bt_mesh_dfd_srv *srv,
296 const struct bt_mesh_dfu_slot *slot, bool success,
297 size_t size, const uint8_t *metadata, size_t metadata_len);
298#endif /* CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD */
299
301extern const struct bt_mesh_model_op _bt_mesh_dfd_srv_op[];
302extern const struct bt_mesh_model_cb _bt_mesh_dfd_srv_cb;
303extern const struct bt_mesh_dfu_cli_cb _bt_mesh_dfd_srv_dfu_cb;
304extern const struct bt_mesh_blob_srv_cb _bt_mesh_dfd_srv_blob_cb;
307#ifdef __cplusplus
308}
309#endif
310
311#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFD_SRV_H__ */
312
Access layer APIs.
#define CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX
Definition: dfd_srv.h:29
bt_mesh_dfd_upload_phase
Firmware upload phases.
Definition: dfd.h:100
bt_mesh_dfd_phase
Firmware distribution phases.
Definition: dfd.h:73
#define CONFIG_BT_MESH_DFU_URI_MAXLEN
Definition: dfu.h:34
#define CONFIG_BT_MESH_DFU_FWID_MAXLEN
Definition: dfu.h:26
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
BLOB Transfer Client transfer inputs.
Definition: blob_cli.h:104
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
Target node's Pull mode (Pull BLOB Transfer Mode) context used while sending chunks to the Target nod...
Definition: blob_cli.h:40
Firmware Distribution Server callbacks:
Definition: dfd_srv.h:96
int(* recv)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot, const struct bt_mesh_blob_io **io)
Slot receive callback.
Definition: dfd_srv.h:110
void(* del)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot)
Slot delete callback.
Definition: dfd_srv.h:181
int(* send)(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot, const struct bt_mesh_blob_io **io)
Slot send callback.
Definition: dfd_srv.h:196
void(* phase)(struct bt_mesh_dfd_srv *srv, enum bt_mesh_dfd_phase phase)
Phase change callback (Optional).
Definition: dfd_srv.h:207
Firmware Distribution Server instance.
Definition: dfd_srv.h:211
struct bt_mesh_dfu_slot * slot
Definition: dfd_srv.h:226
struct bt_mesh_blob_target_pull pull_ctxs[0]
Definition: dfd_srv.h:216
struct bt_mesh_dfu_cli dfu
Definition: dfd_srv.h:214
const struct bt_mesh_model * mod
Definition: dfd_srv.h:213
enum bt_mesh_dfd_phase phase
Definition: dfd_srv.h:221
struct bt_mesh_blob_cli_inputs inputs
Definition: dfd_srv.h:222
const struct flash_area * area
Definition: dfd_srv.h:227
uint16_t target_cnt
Definition: dfd_srv.h:218
const struct bt_mesh_blob_io * io
Definition: dfd_srv.h:217
const struct bt_mesh_dfd_srv_cb * cb
Definition: dfd_srv.h:212
struct bt_mesh_dfd_srv::@103 upload
enum bt_mesh_dfd_upload_phase phase
Definition: dfd_srv.h:225
struct bt_mesh_dfu_target targets[0]
Definition: dfd_srv.h:215
bool apply
Definition: dfd_srv.h:220
uint16_t slot_idx
Definition: dfd_srv.h:219
Firmware Update Client event callbacks.
Definition: dfu_cli.h:130
Firmware Update Client model instance.
Definition: dfu_cli.h:184
DFU image slot for DFU distribution.
Definition: dfu.h:152
DFU Target node.
Definition: dfu_cli.h:54
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
Flash partition.
Definition: flash_map.h:59