Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
blob_cli.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_CLI_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_CLI_H_
9
10#include <sys/types.h>
11
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
25struct bt_mesh_blob_cli;
26
33#define BT_MESH_MODEL_BLOB_CLI(_cli) \
34 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BLOB_CLI, _bt_mesh_blob_cli_op, \
35 NULL, _cli, &_bt_mesh_blob_cli_cb)
36
47
52
55
60
63
64 uint8_t procedure_complete:1, /* Procedure has been completed. */
65 acked:1, /* Message has been acknowledged. Not used when sending. */
66 timedout:1, /* Target node didn't respond after specified timeout. */
67 skip:1; /* Skip Target node from broadcast. */
68};
69
102
137
161
185
202 void (*caps)(struct bt_mesh_blob_cli *cli,
203 const struct bt_mesh_blob_cli_caps *caps);
204
215 void (*lost_target)(struct bt_mesh_blob_cli *cli,
216 struct bt_mesh_blob_target *target,
217 enum bt_mesh_blob_status reason);
218
225 void (*suspended)(struct bt_mesh_blob_cli *cli);
226
237 void (*end)(struct bt_mesh_blob_cli *cli,
238 const struct bt_mesh_blob_xfer *xfer, bool success);
239
249 void (*xfer_progress)(struct bt_mesh_blob_cli *cli,
250 struct bt_mesh_blob_target *target,
251 const struct bt_mesh_blob_xfer_info *info);
252
260};
261
263struct blob_cli_broadcast_ctx {
265 void (*send)(struct bt_mesh_blob_cli *cli, uint16_t dst);
267 void (*send_complete)(struct bt_mesh_blob_cli *cli, uint16_t dst);
272 void (*next)(struct bt_mesh_blob_cli *cli);
276 bool acked;
278 bool force_unicast;
280 bool optional;
284 bool is_inited;
285 /* Defines a time in ms by which the broadcast API postpones sending the message to a next
286 * target or completing the broadcast.
287 */
288 uint32_t post_send_delay_ms;
289};
295 const struct bt_mesh_blob_cli_cb *cb;
296
297 /* Runtime state */
298 const struct bt_mesh_model *mod;
299
300 struct {
302 struct blob_cli_broadcast_ctx ctx;
303 struct k_work_delayable retry;
304 /* Represents Client Timeout timer in a timestamp. Used in Pull mode only. */
306 struct k_work_delayable complete;
311 } tx;
312
313 const struct bt_mesh_blob_io *io;
315 const struct bt_mesh_blob_xfer *xfer;
323};
324
345 const struct bt_mesh_blob_cli_inputs *inputs);
346
369 const struct bt_mesh_blob_cli_inputs *inputs,
370 const struct bt_mesh_blob_xfer *xfer,
371 const struct bt_mesh_blob_io *io);
372
380
388
394
408 const struct bt_mesh_blob_cli_inputs *inputs);
409
417
426
442
444extern const struct bt_mesh_model_op _bt_mesh_blob_cli_op[];
445extern const struct bt_mesh_model_cb _bt_mesh_blob_cli_cb;
450#ifdef __cplusplus
451}
452#endif
453
454#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_CLI_H_ */
Access layer APIs.
static ssize_t send(int sock, const void *buf, size_t len, int flags)
POSIX wrapper for zsock_send.
Definition socket.h:867
void bt_mesh_blob_cli_set_chunk_interval_ms(struct bt_mesh_blob_cli *cli, uint32_t interval_ms)
Set chunk sending interval in ms.
uint8_t bt_mesh_blob_cli_xfer_progress_active_get(struct bt_mesh_blob_cli *cli)
Get the current progress of the active transfer in percent.
int bt_mesh_blob_cli_xfer_progress_get(struct bt_mesh_blob_cli *cli, const struct bt_mesh_blob_cli_inputs *inputs)
Get the progress of BLOB transfer.
void bt_mesh_blob_cli_cancel(struct bt_mesh_blob_cli *cli)
Cancel an ongoing transfer.
bool bt_mesh_blob_cli_is_busy(struct bt_mesh_blob_cli *cli)
Get the current state of the BLOB Transfer Client.
int bt_mesh_blob_cli_resume(struct bt_mesh_blob_cli *cli)
Resume the suspended transfer.
int bt_mesh_blob_cli_send(struct bt_mesh_blob_cli *cli, const struct bt_mesh_blob_cli_inputs *inputs, const struct bt_mesh_blob_xfer *xfer, const struct bt_mesh_blob_io *io)
Perform a BLOB transfer.
int bt_mesh_blob_cli_suspend(struct bt_mesh_blob_cli *cli)
Suspend the active transfer.
int bt_mesh_blob_cli_caps_get(struct bt_mesh_blob_cli *cli, const struct bt_mesh_blob_cli_inputs *inputs)
Retrieve transfer capabilities for a list of Target nodes.
bt_mesh_blob_cli_state
BLOB Transfer Client state.
Definition blob_cli.h:163
@ BT_MESH_BLOB_CLI_STATE_BLOCK_CHECK
Checking block status.
Definition blob_cli.h:175
@ BT_MESH_BLOB_CLI_STATE_NONE
No transfer is active.
Definition blob_cli.h:165
@ BT_MESH_BLOB_CLI_STATE_CANCEL
Cancelling transfer.
Definition blob_cli.h:179
@ BT_MESH_BLOB_CLI_STATE_CAPS_GET
Retrieving transfer capabilities.
Definition blob_cli.h:167
@ BT_MESH_BLOB_CLI_STATE_SUSPENDED
Transfer is suspended.
Definition blob_cli.h:181
@ BT_MESH_BLOB_CLI_STATE_START
Sending transfer start.
Definition blob_cli.h:169
@ BT_MESH_BLOB_CLI_STATE_XFER_CHECK
Checking transfer status.
Definition blob_cli.h:177
@ BT_MESH_BLOB_CLI_STATE_BLOCK_SEND
Sending block chunks.
Definition blob_cli.h:173
@ BT_MESH_BLOB_CLI_STATE_XFER_PROGRESS_GET
Checking transfer progress.
Definition blob_cli.h:183
@ BT_MESH_BLOB_CLI_STATE_BLOCK_START
Sending block start.
Definition blob_cli.h:171
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
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
#define DIV_ROUND_UP(n, d)
Divide and round up.
Definition util.h:352
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT64_TYPE__ int64_t
Definition stdint.h:75
BLOB transfer data block.
Definition blob.h:98
Transfer capabilities of a Target node.
Definition blob_cli.h:139
enum bt_mesh_blob_xfer_mode modes
Supported transfer modes.
Definition blob_cli.h:159
uint16_t max_chunks
Max number of chunks per block.
Definition blob_cli.h:150
uint8_t max_block_size_log
Logarithmic representation of the maximum block size.
Definition blob_cli.h:147
uint16_t mtu_size
Max MTU size.
Definition blob_cli.h:156
uint8_t min_block_size_log
Logarithmic representation of the minimum block size.
Definition blob_cli.h:144
uint16_t max_chunk_size
Max chunk size.
Definition blob_cli.h:153
size_t max_size
Max BLOB size.
Definition blob_cli.h:141
Event handler callbacks for the BLOB Transfer Client model.
Definition blob_cli.h:190
void(* suspended)(struct bt_mesh_blob_cli *cli)
Transfer is suspended.
Definition blob_cli.h:225
void(* lost_target)(struct bt_mesh_blob_cli *cli, struct bt_mesh_blob_target *target, enum bt_mesh_blob_status reason)
Target node loss callback.
Definition blob_cli.h:215
void(* xfer_progress)(struct bt_mesh_blob_cli *cli, struct bt_mesh_blob_target *target, const struct bt_mesh_blob_xfer_info *info)
Transfer progress callback.
Definition blob_cli.h:249
void(* caps)(struct bt_mesh_blob_cli *cli, const struct bt_mesh_blob_cli_caps *caps)
Capabilities retrieval completion callback.
Definition blob_cli.h:202
void(* end)(struct bt_mesh_blob_cli *cli, const struct bt_mesh_blob_xfer *xfer, bool success)
Transfer end callback.
Definition blob_cli.h:237
void(* xfer_progress_complete)(struct bt_mesh_blob_cli *cli)
End of Get Transfer Progress procedure.
Definition blob_cli.h:259
BLOB Transfer Client transfer inputs.
Definition blob_cli.h:104
uint16_t timeout_base
Additional response time for the Target nodes, in 10-second increments.
Definition blob_cli.h:135
uint16_t app_idx
AppKey index to send with.
Definition blob_cli.h:111
sys_slist_t targets
Linked list of Target nodes.
Definition blob_cli.h:108
uint16_t group
Group address destination for the BLOB transfer, or BT_MESH_ADDR_UNASSIGNED to send every message to ...
Definition blob_cli.h:117
uint8_t ttl
Time to live value of BLOB transfer messages.
Definition blob_cli.h:120
BLOB Transfer Client model instance.
Definition blob_cli.h:293
uint16_t pending
Definition blob_cli.h:307
uint32_t chunk_interval_ms
Definition blob_cli.h:316
const struct bt_mesh_blob_io * io
Definition blob_cli.h:313
struct bt_mesh_blob_target * target
Definition blob_cli.h:301
uint16_t block_count
Definition blob_cli.h:317
const struct bt_mesh_blob_cli_cb * cb
Event handler callbacks.
Definition blob_cli.h:295
uint8_t cancelled
Definition blob_cli.h:310
int64_t cli_timestamp
Definition blob_cli.h:305
uint8_t sending
Definition blob_cli.h:309
const struct bt_mesh_blob_xfer * xfer
Definition blob_cli.h:315
struct bt_mesh_blob_cli::@145 tx
const struct bt_mesh_blob_cli_inputs * inputs
Definition blob_cli.h:314
struct bt_mesh_blob_cli_caps caps
Definition blob_cli.h:322
uint16_t chunk_idx
Definition blob_cli.h:318
uint16_t mtu_size
Definition blob_cli.h:319
enum bt_mesh_blob_cli_state state
Definition blob_cli.h:320
uint8_t retries
Definition blob_cli.h:308
struct bt_mesh_blob_block block
Definition blob_cli.h:321
const struct bt_mesh_model * mod
Definition blob_cli.h:298
BLOB stream.
Definition blob.h:145
Target node's Pull mode (Pull BLOB Transfer Mode) context used while sending chunks to the Target nod...
Definition blob_cli.h:40
uint8_t missing[DIV_ROUND_UP(CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX, 8)]
Missing chunks reported by this Target node.
Definition blob_cli.h:45
int64_t block_report_timestamp
Timestamp when the Block Report Timeout Timer expires for this Target node.
Definition blob_cli.h:42
BLOB Transfer Client Target node.
Definition blob_cli.h:49
struct bt_mesh_blob_target_pull * pull
Target node's Pull mode context.
Definition blob_cli.h:59
uint8_t timedout
Definition blob_cli.h:66
uint8_t acked
Definition blob_cli.h:65
uint8_t status
BLOB transfer status, see bt_mesh_blob_status.
Definition blob_cli.h:62
uint8_t procedure_complete
Definition blob_cli.h:64
uint8_t skip
Definition blob_cli.h:67
uint16_t addr
Target node address.
Definition blob_cli.h:54
sys_snode_t n
Linked list node.
Definition blob_cli.h:51
BLOB transfer information.
Definition blob_cli.h:77
uint64_t id
BLOB ID.
Definition blob_cli.h:88
enum bt_mesh_blob_xfer_phase phase
BLOB transfer phase.
Definition blob_cli.h:85
enum bt_mesh_blob_xfer_mode mode
BLOB transfer mode.
Definition blob_cli.h:82
const uint8_t * missing_blocks
Bit field indicating blocks that were not received.
Definition blob_cli.h:100
enum bt_mesh_blob_status status
BLOB transfer status.
Definition blob_cli.h:79
uint32_t size
BLOB size in octets.
Definition blob_cli.h:91
uint8_t block_size_log
Logarithmic representation of the block size.
Definition blob_cli.h:94
uint16_t mtu_size
MTU size in octets.
Definition blob_cli.h:97
BLOB transfer.
Definition blob.h:123
Model callback functions.
Definition access.h:813
Model opcode handler.
Definition access.h:363
Abstraction that describes a Mesh Model instance.
Definition access.h:891
A structure used to submit work after a delay.
Definition kernel.h:3985