Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
blob_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
12
13#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_SRV_H_
14#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_SRV_H_
15
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
28
29struct bt_mesh_blob_srv;
30
35#if defined(CONFIG_BT_MESH_BLOB_SRV)
36#define BT_MESH_BLOB_BLOCKS_MAX \
37 (DIV_ROUND_UP(CONFIG_BT_MESH_BLOB_SIZE_MAX, \
38 CONFIG_BT_MESH_BLOB_BLOCK_SIZE_MIN))
39#else
40#define BT_MESH_BLOB_BLOCKS_MAX 1
41#endif
42
49#define BT_MESH_MODEL_BLOB_SRV(_srv) \
50 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BLOB_SRV, _bt_mesh_blob_srv_op, \
51 NULL, _srv, &_bt_mesh_blob_srv_cb)
52
71 int (*start)(struct bt_mesh_blob_srv *srv, struct bt_mesh_msg_ctx *ctx,
72 struct bt_mesh_blob_xfer *xfer);
73
86 void (*end)(struct bt_mesh_blob_srv *srv, uint64_t id, bool success);
87
105 void (*suspended)(struct bt_mesh_blob_srv *srv);
106
113 void (*resume)(struct bt_mesh_blob_srv *srv);
114
131 int (*recover)(struct bt_mesh_blob_srv *srv,
132 struct bt_mesh_blob_xfer *xfer,
133 const struct bt_mesh_blob_io **io);
134};
135
139 const struct bt_mesh_blob_srv_cb *cb;
140
141 /* Runtime state: */
142 const struct bt_mesh_blob_io *io;
145 const struct bt_mesh_model *mod;
147
159
160 /* Pull mode (Pull BLOB Transfer Mode) behavior. */
161 struct {
165};
166
183 const struct bt_mesh_blob_io *io, uint8_t ttl,
184 uint16_t timeout_base);
185
197
206
214
216extern const struct bt_mesh_model_op _bt_mesh_blob_srv_op[];
217extern const struct bt_mesh_model_cb _bt_mesh_blob_srv_cb;
219
221
222#ifdef __cplusplus
223}
224#endif
225
226#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_SRV_H_ */
Access layer APIs.
Header file for the Bluetooth Mesh BLOB Transfer model API.
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition atomic.h:119
int bt_mesh_blob_srv_recv(struct bt_mesh_blob_srv *srv, uint64_t id, const struct bt_mesh_blob_io *io, uint8_t ttl, uint16_t timeout_base)
Prepare BLOB Transfer Server for an incoming transfer.
uint8_t bt_mesh_blob_srv_progress(const struct bt_mesh_blob_srv *srv)
Get the current progress of the active transfer in percent.
bool bt_mesh_blob_srv_is_busy(const struct bt_mesh_blob_srv *srv)
Get the current state of the BLOB Transfer Server.
#define BT_MESH_BLOB_BLOCKS_MAX
Max number of blocks in a single transfer.
Definition blob_srv.h:40
int bt_mesh_blob_srv_cancel(struct bt_mesh_blob_srv *srv)
Cancel the current BLOB transfer.
bt_mesh_blob_xfer_phase
Transfer phase.
Definition blob.h:47
state
Definition parser_state.h:29
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
BLOB transfer data block.
Definition blob.h:104
BLOB stream.
Definition blob.h:151
uint16_t cli
Definition blob_srv.h:150
uint16_t timeout_base
Definition blob_srv.h:152
atomic_t blocks[ATOMIC_BITMAP_SIZE(1)]
Definition blob_srv.h:157
uint16_t app_idx
Definition blob_srv.h:151
uint8_t ttl
Definition blob_srv.h:154
uint16_t mtu_size
Definition blob_srv.h:153
struct bt_mesh_blob_xfer xfer
Definition blob_srv.h:149
BLOB Transfer Server model event handlers.
Definition blob_srv.h:57
int(* recover)(struct bt_mesh_blob_srv *srv, struct bt_mesh_blob_xfer *xfer, const struct bt_mesh_blob_io **io)
Transfer recovery callback.
Definition blob_srv.h:131
void(* suspended)(struct bt_mesh_blob_srv *srv)
Transfer suspended callback.
Definition blob_srv.h:105
int(* start)(struct bt_mesh_blob_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_blob_xfer *xfer)
Transfer start callback.
Definition blob_srv.h:71
void(* resume)(struct bt_mesh_blob_srv *srv)
Transfer resume callback.
Definition blob_srv.h:113
void(* end)(struct bt_mesh_blob_srv *srv, uint64_t id, bool success)
Transfer end callback.
Definition blob_srv.h:86
BLOB Transfer Server model instance.
Definition blob_srv.h:137
const struct bt_mesh_model * mod
Definition blob_srv.h:145
const struct bt_mesh_blob_io * io
Definition blob_srv.h:142
const struct bt_mesh_blob_srv_cb * cb
Event handler callbacks.
Definition blob_srv.h:139
enum bt_mesh_blob_xfer_phase phase
Definition blob_srv.h:146
struct k_work_delayable rx_timeout
Definition blob_srv.h:143
struct bt_mesh_blob_block block
Definition blob_srv.h:144
uint16_t chunk_idx
Definition blob_srv.h:162
struct k_work_delayable report
Definition blob_srv.h:163
struct bt_mesh_blob_srv::@067133117245337364026014036366273070063164131043 pull
BLOB transfer.
Definition blob.h:129
Model callback functions.
Definition access.h:635
Model opcode handler.
Definition access.h:182
Abstraction that describes a Mesh Model instance.
Definition access.h:713
Message sending context.
Definition msg.h:76
A structure used to submit work after a delay.
Definition kernel.h:4642