Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
blob.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_H__
8#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_H__
9
10#include <sys/types.h>
11
12#include <zephyr/kernel.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
24#ifndef CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX
25#define CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX 0
26#endif
27
39
55
96
111
121
127 size_t size;
130 /* Logarithmic representation of the block size. */
134};
135
143
156 int (*open)(const struct bt_mesh_blob_io *io,
157 const struct bt_mesh_blob_xfer *xfer,
158 enum bt_mesh_blob_io_mode mode);
159
167 void (*close)(const struct bt_mesh_blob_io *io,
168 const struct bt_mesh_blob_xfer *xfer);
169
181 int (*block_start)(const struct bt_mesh_blob_io *io,
182 const struct bt_mesh_blob_xfer *xfer,
183 const struct bt_mesh_blob_block *block);
184
195 void (*block_end)(const struct bt_mesh_blob_io *io,
196 const struct bt_mesh_blob_xfer *xfer,
197 const struct bt_mesh_blob_block *block);
198
225 int (*wr)(const struct bt_mesh_blob_io *io,
226 const struct bt_mesh_blob_xfer *xfer,
227 const struct bt_mesh_blob_block *block,
228 const struct bt_mesh_blob_chunk *chunk);
229
250 int (*rd)(const struct bt_mesh_blob_io *io,
251 const struct bt_mesh_blob_xfer *xfer,
252 const struct bt_mesh_blob_block *block,
253 const struct bt_mesh_blob_chunk *chunk);
254};
255
258#ifdef __cplusplus
259}
260#endif
261
262#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_H__ */
bt_mesh_blob_io_mode
BLOB stream interaction mode.
Definition blob.h:137
bt_mesh_blob_xfer_phase
Transfer phase.
Definition blob.h:41
#define CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX
Definition blob.h:25
bt_mesh_blob_status
BLOB model status codes.
Definition blob.h:57
bt_mesh_blob_xfer_mode
BLOB transfer mode.
Definition blob.h:29
@ BT_MESH_BLOB_WRITE
Write data to the stream.
Definition blob.h:141
@ BT_MESH_BLOB_READ
Read data from the stream.
Definition blob.h:139
@ BT_MESH_BLOB_XFER_PHASE_WAITING_FOR_BLOCK
The BLOB Transfer Server is waiting for the next block of data.
Definition blob.h:47
@ BT_MESH_BLOB_XFER_PHASE_INACTIVE
The BLOB Transfer Server is awaiting configuration.
Definition blob.h:43
@ BT_MESH_BLOB_XFER_PHASE_WAITING_FOR_START
The BLOB Transfer Server is ready to receive a BLOB transfer.
Definition blob.h:45
@ BT_MESH_BLOB_XFER_PHASE_SUSPENDED
The BLOB transfer is paused.
Definition blob.h:53
@ BT_MESH_BLOB_XFER_PHASE_COMPLETE
The BLOB was transferred successfully.
Definition blob.h:51
@ BT_MESH_BLOB_XFER_PHASE_WAITING_FOR_CHUNK
The BLOB Transfer Server is waiting for the next chunk of data.
Definition blob.h:49
@ BT_MESH_BLOB_ERR_BLOB_TOO_LARGE
There is not enough space available in memory to receive the BLOB.
Definition blob.h:84
@ BT_MESH_BLOB_ERR_INFO_UNAVAILABLE
The requested information cannot be provided while the server is in the current phase.
Definition blob.h:94
@ BT_MESH_BLOB_ERR_WRONG_BLOB_ID
The message contains a BLOB ID value that is not expected.
Definition blob.h:81
@ BT_MESH_BLOB_ERR_INVALID_BLOCK_NUM
The Block Number field value is not within the range of blocks being transferred.
Definition blob.h:63
@ BT_MESH_BLOB_ERR_WRONG_PHASE
The operation cannot be performed while the server is in the current phase.
Definition blob.h:77
@ BT_MESH_BLOB_ERR_UNSUPPORTED_MODE
The transfer mode is not supported by the BLOB Transfer Server model.
Definition blob.h:88
@ BT_MESH_BLOB_ERR_INTERNAL
An internal error occurred on the node.
Definition blob.h:90
@ BT_MESH_BLOB_SUCCESS
The message was processed successfully.
Definition blob.h:59
@ BT_MESH_BLOB_ERR_INVALID_BLOCK_SIZE
The block size is smaller than the size indicated by the Min Block Size Log state or is larger than t...
Definition blob.h:68
@ BT_MESH_BLOB_ERR_INVALID_PARAM
A parameter value in the message cannot be accepted.
Definition blob.h:79
@ BT_MESH_BLOB_ERR_INVALID_CHUNK_SIZE
The chunk size exceeds the size indicated by the Max Chunk Size state, or the number of chunks exceed...
Definition blob.h:73
@ BT_MESH_BLOB_XFER_MODE_PUSH
Push mode (Push BLOB Transfer Mode).
Definition blob.h:33
@ BT_MESH_BLOB_XFER_MODE_ALL
Both modes are valid.
Definition blob.h:37
@ BT_MESH_BLOB_XFER_MODE_NONE
No valid transfer mode.
Definition blob.h:31
@ BT_MESH_BLOB_XFER_MODE_PULL
Pull mode (Pull BLOB Transfer Mode).
Definition blob.h:35
#define DIV_ROUND_UP(n, d)
Divide and round up.
Definition util.h:352
Public kernel APIs.
__INTPTR_TYPE__ off_t
Definition types.h:36
__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
uint16_t number
Block number.
Definition blob.h:104
size_t size
Block size in bytes.
Definition blob.h:100
uint16_t chunk_count
Number of chunks in block.
Definition blob.h:106
off_t offset
Offset in bytes from the start of the BLOB.
Definition blob.h:102
uint8_t missing[DIV_ROUND_UP(0, 8)]
Bitmap of missing chunks.
Definition blob.h:109
BLOB data chunk.
Definition blob.h:113
off_t offset
Offset of the chunk data from the start of the block.
Definition blob.h:115
uint8_t * data
Chunk data.
Definition blob.h:119
size_t size
Chunk data size.
Definition blob.h:117
BLOB stream.
Definition blob.h:145
int(* rd)(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, const struct bt_mesh_blob_block *block, const struct bt_mesh_blob_chunk *chunk)
Chunk data read callback.
Definition blob.h:250
int(* open)(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, enum bt_mesh_blob_io_mode mode)
Open callback.
Definition blob.h:156
void(* block_end)(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, const struct bt_mesh_blob_block *block)
Block end callback.
Definition blob.h:195
int(* block_start)(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, const struct bt_mesh_blob_block *block)
Block start callback.
Definition blob.h:181
void(* close)(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer)
Close callback.
Definition blob.h:167
int(* wr)(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, const struct bt_mesh_blob_block *block, const struct bt_mesh_blob_chunk *chunk)
Chunk data write callback.
Definition blob.h:225
BLOB transfer.
Definition blob.h:123
enum bt_mesh_blob_xfer_mode mode
BLOB transfer mode.
Definition blob.h:129
uint16_t chunk_size
Base chunk size.
Definition blob.h:133
size_t size
Total BLOB size in bytes.
Definition blob.h:127
uint64_t id
BLOB ID.
Definition blob.h:125
uint8_t block_size_log
Definition blob.h:131