1 /* 2 * Copyright (c) 2021 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** @file 8 * @brief Bluetooth Mesh SAR Configuration Client Model APIs. 9 */ 10 #ifndef BT_MESH_SAR_CFG_CLI_H__ 11 #define BT_MESH_SAR_CFG_CLI_H__ 12 13 #include <zephyr/bluetooth/mesh.h> 14 #include <zephyr/bluetooth/mesh/sar_cfg.h> 15 16 /** 17 * @brief Bluetooth Mesh 18 * @defgroup bt_mesh_sar_cfg_cli Bluetooth Mesh SAR Configuration Client Model 19 * @ingroup bt_mesh 20 * @{ 21 */ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** Mesh SAR Configuration Client Model Context */ 28 struct bt_mesh_sar_cfg_cli { 29 /** Access model pointer. */ 30 const struct bt_mesh_model *model; 31 32 /* Publication structure instance */ 33 struct bt_mesh_model_pub pub; 34 35 /* Synchronous message timeout in milliseconds. */ 36 int32_t timeout; 37 38 /* Internal parameters for tracking message responses. */ 39 struct bt_mesh_msg_ack_ctx ack_ctx; 40 }; 41 42 /** 43 * 44 * @brief SAR Configuration Client model composition data entry. 45 * 46 * @param[in] _cli Pointer to a @ref bt_mesh_sar_cfg_cli instance. 47 */ 48 #define BT_MESH_MODEL_SAR_CFG_CLI(_cli) \ 49 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SAR_CFG_CLI, \ 50 _bt_mesh_sar_cfg_cli_op, _cli.pub, _cli, \ 51 &_bt_mesh_sar_cfg_cli_cb) 52 53 /** @brief Get the SAR Transmitter state of the target node. 54 * 55 * @param net_idx Network index to encrypt with. 56 * @param addr Target node address. 57 * @param rsp Status response parameter. 58 * 59 * @return 0 on success, or (negative) error code on failure. 60 */ 61 int bt_mesh_sar_cfg_cli_transmitter_get(uint16_t net_idx, uint16_t addr, 62 struct bt_mesh_sar_tx *rsp); 63 64 /** @brief Set the SAR Transmitter state of the target node. 65 * 66 * @param net_idx Network index to encrypt with. 67 * @param addr Target node address. 68 * @param set New SAR Transmitter state to set on the target node. 69 * @param rsp Status response parameter. 70 * 71 * @return 0 on success, or (negative) error code on failure. 72 */ 73 int bt_mesh_sar_cfg_cli_transmitter_set(uint16_t net_idx, uint16_t addr, 74 const struct bt_mesh_sar_tx *set, 75 struct bt_mesh_sar_tx *rsp); 76 77 /** @brief Get the SAR Receiver state of the target node. 78 * 79 * @param net_idx Network index to encrypt with. 80 * @param addr Target node address. 81 * @param rsp Status response parameter. 82 * 83 * @return 0 on success, or (negative) error code on failure. 84 */ 85 int bt_mesh_sar_cfg_cli_receiver_get(uint16_t net_idx, uint16_t addr, 86 struct bt_mesh_sar_rx *rsp); 87 88 /** @brief Set the SAR Receiver state of the target node. 89 * 90 * @param net_idx Network index to encrypt with. 91 * @param addr Target node address. 92 * @param set New SAR Receiver state to set on the target node. 93 * @param rsp Status response parameter. 94 * 95 * @return 0 on success, or (negative) error code on failure. 96 */ 97 int bt_mesh_sar_cfg_cli_receiver_set(uint16_t net_idx, uint16_t addr, 98 const struct bt_mesh_sar_rx *set, 99 struct bt_mesh_sar_rx *rsp); 100 101 /** @brief Get the current transmission timeout value. 102 * 103 * @return The configured transmission timeout in milliseconds. 104 */ 105 int32_t bt_mesh_sar_cfg_cli_timeout_get(void); 106 107 /** @brief Set the transmission timeout value. 108 * 109 * @param timeout The new transmission timeout. 110 */ 111 void bt_mesh_sar_cfg_cli_timeout_set(int32_t timeout); 112 113 /** @cond INTERNAL_HIDDEN */ 114 extern const struct bt_mesh_model_op _bt_mesh_sar_cfg_cli_op[]; 115 extern const struct bt_mesh_model_cb _bt_mesh_sar_cfg_cli_cb; 116 /** @endcond */ 117 118 #ifdef __cplusplus 119 } 120 #endif 121 122 #endif /* BT_MESH_SAR_CFG_CLI_H__ */ 123 124 /** @} */ 125