Line data Source code
1 0 : /* 2 : * Copyright (c) 2022 Nordic Semiconductor ASA 3 : * 4 : * SPDX-License-Identifier: Apache-2.0 5 : */ 6 : 7 : #ifndef BT_MESH_SOL_PDU_RPL_CLI_H__ 8 : #define BT_MESH_SOL_PDU_RPL_CLI_H__ 9 : 10 : #include <zephyr/bluetooth/mesh.h> 11 : 12 : #ifdef __cplusplus 13 : extern "C" { 14 : #endif 15 : 16 : /** 17 : * @defgroup bt_mesh_sol_pdu_rpl_cli Bluetooth Mesh Solicitation PDU RPL Client 18 : * @ingroup bt_mesh 19 : * @{ 20 : */ 21 : 22 : /** Solicitation PDU RPL Client Model Context */ 23 1 : struct bt_mesh_sol_pdu_rpl_cli { 24 : /** Solicitation PDU RPL model entry pointer. */ 25 1 : const struct bt_mesh_model *model; 26 : 27 : /* Internal parameters for tracking message responses. */ 28 0 : struct bt_mesh_msg_ack_ctx ack_ctx; 29 : 30 : /** @brief Optional callback for Solicitation PDU RPL Status messages. 31 : * 32 : * Handles received Solicitation PDU RPL Status messages from a Solicitation 33 : * PDU RPL server.The @c start param represents the start of range that server 34 : * has cleared. The @c length param represents length of range cleared by server. 35 : * 36 : * @param cli Solicitation PDU RPL client that received the status message. 37 : * @param addr Address of the sender. 38 : * @param range_start Range start value. 39 : * @param range_length Range length value. 40 : */ 41 1 : void (*srpl_status)(struct bt_mesh_sol_pdu_rpl_cli *cli, uint16_t addr, 42 : uint16_t range_start, uint8_t range_length); 43 : }; 44 : 45 : /** 46 : * @brief Solicitation PDU RPL Client model composition data entry. 47 : */ 48 1 : #define BT_MESH_MODEL_SOL_PDU_RPL_CLI(cli_data) \ 49 : BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI, \ 50 : _bt_mesh_sol_pdu_rpl_cli_op, NULL, cli_data, \ 51 : &_bt_mesh_sol_pdu_rpl_cli_cb) 52 : 53 : /** @brief Remove entries from Solicitation PDU RPL of addresses in given range. 54 : * 55 : * This method can be used asynchronously by setting @p start_rsp or 56 : * @p len_rsp as NULL. This way the method will not wait for response and will 57 : * return immediately after sending the command. 58 : * 59 : * To process the response arguments of an async method, register 60 : * the @c srpl_status callback in @c bt_mesh_sol_pdu_rpl_cli struct. 61 : * 62 : * @param ctx Message context for the message. 63 : * @param range_start Start of Unicast address range. 64 : * @param range_len Length of Unicast address range. Valid values are 0x00 and 0x02 65 : * to 0xff. 66 : * @param start_rsp Range start response buffer. 67 : * @param len_rsp Range length response buffer. 68 : * 69 : * @return 0 on success, or (negative) error code otherwise. 70 : */ 71 1 : int bt_mesh_sol_pdu_rpl_clear(struct bt_mesh_msg_ctx *ctx, uint16_t range_start, 72 : uint8_t range_len, uint16_t *start_rsp, uint8_t *len_rsp); 73 : 74 : 75 : /** @brief Remove entries from Solicitation PDU RPL of addresses in given range (unacked). 76 : * 77 : * @param ctx Message context for the message. 78 : * @param range_start Start of Unicast address range. 79 : * @param range_len Length of Unicast address range. Valid values are 0x00 and 0x02 80 : * to 0xff. 81 : * 82 : * @return 0 on success, or (negative) error code otherwise. 83 : */ 84 1 : int bt_mesh_sol_pdu_rpl_clear_unack(struct bt_mesh_msg_ctx *ctx, uint16_t range_start, 85 : uint8_t range_len); 86 : 87 : /** @brief Set the transmission timeout value. 88 : * 89 : * @param timeout The new transmission timeout in milliseconds. 90 : */ 91 1 : void bt_mesh_sol_pdu_rpl_cli_timeout_set(int32_t timeout); 92 : 93 : /** @cond INTERNAL_HIDDEN */ 94 : extern const struct bt_mesh_model_op _bt_mesh_sol_pdu_rpl_cli_op[]; 95 : extern const struct bt_mesh_model_cb _bt_mesh_sol_pdu_rpl_cli_cb; 96 : /** @endcond */ 97 : 98 : /** @} */ 99 : 100 : #ifdef __cplusplus 101 : } 102 : #endif 103 : 104 : #endif /* BT_MESH_SOL_PDU_RPL_CLI_H__ */