Zephyr Project API 3.7.0
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
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_SRV_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_SRV_H_
9
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
23struct bt_mesh_blob_srv;
24
29#if defined(CONFIG_BT_MESH_BLOB_SRV)
30#define BT_MESH_BLOB_BLOCKS_MAX \
31 (DIV_ROUND_UP(CONFIG_BT_MESH_BLOB_SIZE_MAX, \
32 CONFIG_BT_MESH_BLOB_BLOCK_SIZE_MIN))
33#else
34#define BT_MESH_BLOB_BLOCKS_MAX 1
35#endif
36
43#define BT_MESH_MODEL_BLOB_SRV(_srv) \
44 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BLOB_SRV, _bt_mesh_blob_srv_op, \
45 NULL, _srv, &_bt_mesh_blob_srv_cb)
46
65 int (*start)(struct bt_mesh_blob_srv *srv, struct bt_mesh_msg_ctx *ctx,
66 struct bt_mesh_blob_xfer *xfer);
67
80 void (*end)(struct bt_mesh_blob_srv *srv, uint64_t id, bool success);
81
99 void (*suspended)(struct bt_mesh_blob_srv *srv);
100
107 void (*resume)(struct bt_mesh_blob_srv *srv);
108
125 int (*recover)(struct bt_mesh_blob_srv *srv,
126 struct bt_mesh_blob_xfer *xfer,
127 const struct bt_mesh_blob_io **io);
128};
129
133 const struct bt_mesh_blob_srv_cb *cb;
134
135 /* Runtime state: */
136 const struct bt_mesh_blob_io *io;
139 const struct bt_mesh_model *mod;
141
153
154 /* Pull mode (Pull BLOB Transfer Mode) behavior. */
155 struct {
157 struct k_work_delayable report;
159};
160
177 const struct bt_mesh_blob_io *io, uint8_t ttl,
178 uint16_t timeout_base);
179
191
200
208
210extern const struct bt_mesh_model_op _bt_mesh_blob_srv_op[];
211extern const struct bt_mesh_model_cb _bt_mesh_blob_srv_cb;
216#ifdef __cplusplus
217}
218#endif
219
220#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_SRV_H_ */
Access layer APIs.
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition atomic.h:111
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:34
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:41
__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:98
BLOB stream.
Definition blob.h:145
uint16_t cli
Definition blob_srv.h:144
uint16_t timeout_base
Definition blob_srv.h:146
uint16_t app_idx
Definition blob_srv.h:145
uint8_t ttl
Definition blob_srv.h:148
atomic_t blocks[ATOMIC_BITMAP_SIZE(1)]
Definition blob_srv.h:151
uint16_t mtu_size
Definition blob_srv.h:147
struct bt_mesh_blob_xfer xfer
Definition blob_srv.h:143
BLOB Transfer Server model event handlers.
Definition blob_srv.h:51
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:125
void(* suspended)(struct bt_mesh_blob_srv *srv)
Transfer suspended callback.
Definition blob_srv.h:99
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:65
void(* resume)(struct bt_mesh_blob_srv *srv)
Transfer resume callback.
Definition blob_srv.h:107
void(* end)(struct bt_mesh_blob_srv *srv, uint64_t id, bool success)
Transfer end callback.
Definition blob_srv.h:80
BLOB Transfer Server instance.
Definition blob_srv.h:131
struct bt_mesh_blob_srv::@96 pull
const struct bt_mesh_model * mod
Definition blob_srv.h:139
const struct bt_mesh_blob_io * io
Definition blob_srv.h:136
const struct bt_mesh_blob_srv_cb * cb
Event handler callbacks.
Definition blob_srv.h:133
enum bt_mesh_blob_xfer_phase phase
Definition blob_srv.h:140
struct k_work_delayable rx_timeout
Definition blob_srv.h:137
struct bt_mesh_blob_srv::bt_mesh_blob_srv_state state
struct bt_mesh_blob_block block
Definition blob_srv.h:138
uint16_t chunk_idx
Definition blob_srv.h:156
BLOB transfer.
Definition blob.h:123
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
A structure used to submit work after a delay.
Definition kernel.h:3908
static volatile bool success[4]
Definition test_mslab_threadsafe.c:37