1 /*
2  * Copyright (c) 2022 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef BT_MESH_OP_AGG_CLI_H__
8 #define BT_MESH_OP_AGG_CLI_H__
9 
10 #include <zephyr/bluetooth/mesh.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * @defgroup bt_mesh_op_agg_cli Opcodes Aggregator Client model
18  * @ingroup bt_mesh
19  * @{
20  */
21 
22 /**
23  *
24  *  @brief Opcodes Aggregator Client model composition data entry.
25  */
26 #define BT_MESH_MODEL_OP_AGG_CLI                                               \
27 	BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_OP_AGG_CLI, _bt_mesh_op_agg_cli_op,  \
28 			 NULL, NULL, &_bt_mesh_op_agg_cli_cb)
29 
30 /** @brief Configure Opcodes Aggregator context.
31  *
32  *  @param net_idx           NetKey index to encrypt with.
33  *  @param app_idx           AppKey index to encrypt with.
34  *  @param dst               Target Opcodes Aggregator Server address.
35  *  @param elem_addr         Target node element address for the sequence message.
36  *
37  *  @return 0 on success, or (negative) error code on failure.
38  */
39 int bt_mesh_op_agg_cli_seq_start(uint16_t net_idx, uint16_t app_idx, uint16_t dst,
40 				 uint16_t elem_addr);
41 
42 /** @brief Opcodes Aggregator message send.
43  *
44  *  Uses previously configured context and sends aggregated message
45  *  to target node.
46  *
47  *  @return 0 on success, or (negative) error code on failure.
48  */
49 int bt_mesh_op_agg_cli_seq_send(void);
50 
51 /** @brief Abort Opcodes Aggregator context.
52  */
53 void bt_mesh_op_agg_cli_seq_abort(void);
54 
55 /** @brief Check if Opcodes Aggregator Sequence context is started.
56  *
57  *  @return true if it is started, otherwise false.
58  */
59 bool bt_mesh_op_agg_cli_seq_is_started(void);
60 
61 /** @brief Get Opcodes Aggregator context tailroom.
62  *
63  *  @return Remaning tailroom of Opcodes Aggregator SDU.
64  */
65 size_t bt_mesh_op_agg_cli_seq_tailroom(void);
66 
67 /** @brief Get the current transmission timeout value.
68  *
69  *  @return The configured transmission timeout in milliseconds.
70  */
71 int32_t bt_mesh_op_agg_cli_timeout_get(void);
72 
73 /** @brief Set the transmission timeout value.
74  *
75  *  @param timeout The new transmission timeout.
76  */
77 void bt_mesh_op_agg_cli_timeout_set(int32_t timeout);
78 
79 /** @cond INTERNAL_HIDDEN */
80 extern const struct bt_mesh_model_op _bt_mesh_op_agg_cli_op[];
81 extern const struct bt_mesh_model_cb _bt_mesh_op_agg_cli_cb;
82 /** @endcond */
83 
84 /**
85  * @}
86  */
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* BT_MESH_OP_AGG_CLI_H__ */
93