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_OD_PRIV_PROXY_CLI_H__ 8 : #define BT_MESH_OD_PRIV_PROXY_CLI_H__ 9 : 10 : #include <zephyr/bluetooth/mesh.h> 11 : 12 : #ifdef __cplusplus 13 : extern "C" { 14 : #endif 15 : 16 : /** 17 : * @defgroup bt_mesh_od_priv_proxy_cli Bluetooth Mesh On-Demand Private GATT Proxy Client 18 : * @ingroup bt_mesh 19 : * @{ 20 : */ 21 : 22 : /** On-Demand Private Proxy Client Model Context */ 23 1 : struct bt_mesh_od_priv_proxy_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 On-Demand Private Proxy Status messages. 31 : * 32 : * Handles received On-Demand Private Proxy Status messages from a On-Demand Private Proxy 33 : * server.The @c state param represents state of On-Demand Private Proxy server. 34 : * 35 : * @param cli On-Demand Private Proxy client that received the status message. 36 : * @param addr Address of the sender. 37 : * @param state State value. 38 : */ 39 1 : void (*od_status)(struct bt_mesh_od_priv_proxy_cli *cli, uint16_t addr, uint8_t state); 40 : }; 41 : 42 : /** 43 : * @brief On-Demand Private Proxy Client model composition data entry. 44 : */ 45 1 : #define BT_MESH_MODEL_OD_PRIV_PROXY_CLI(cli_data) \ 46 : BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI, \ 47 : _bt_mesh_od_priv_proxy_cli_op, NULL, cli_data, \ 48 : &_bt_mesh_od_priv_proxy_cli_cb) 49 : 50 : /** @brief Get the target's On-Demand Private GATT Proxy state. 51 : * 52 : * This method can be used asynchronously by setting @p val_rsp as NULL. 53 : * This way the method will not wait for response and will 54 : * return immediately after sending the command. 55 : * 56 : * To process the response arguments of an async method, register 57 : * the @c od_status callback in @c bt_mesh_od_priv_proxy_cli struct. 58 : * 59 : * @param net_idx Network index to encrypt with. 60 : * @param addr Target node address. 61 : * @param val_rsp Response buffer for On-Demand Private GATT Proxy value. 62 : * 63 : * @return 0 on success, or (negative) error code otherwise. 64 : */ 65 1 : int bt_mesh_od_priv_proxy_cli_get(uint16_t net_idx, uint16_t addr, uint8_t *val_rsp); 66 : 67 : /** @brief Set the target's On-Demand Private GATT Proxy state. 68 : * 69 : * This method can be used asynchronously by setting @p val_rsp as NULL. 70 : * This way the method will not wait for response and will 71 : * return immediately after sending the command. 72 : * 73 : * To process the response arguments of an async method, register 74 : * the @c od_status callback in @c bt_mesh_od_priv_proxy_cli struct. 75 : * 76 : * @param net_idx Network index to encrypt with. 77 : * @param addr Target node address. 78 : * @param val On-Demand Private GATT Proxy state to be set 79 : * @param val_rsp Response buffer for On-Demand Private GATT Proxy value. 80 : * 81 : * @return 0 on success, or (negative) error code otherwise. 82 : */ 83 1 : int bt_mesh_od_priv_proxy_cli_set(uint16_t net_idx, uint16_t addr, uint8_t val, uint8_t *val_rsp); 84 : 85 : /** @brief Set the transmission timeout value. 86 : * 87 : * @param timeout The new transmission timeout in milliseconds. 88 : */ 89 1 : void bt_mesh_od_priv_proxy_cli_timeout_set(int32_t timeout); 90 : 91 : /** @cond INTERNAL_HIDDEN */ 92 : extern const struct bt_mesh_model_op _bt_mesh_od_priv_proxy_cli_op[]; 93 : extern const struct bt_mesh_model_cb _bt_mesh_od_priv_proxy_cli_cb; 94 : /** @endcond */ 95 : 96 : /** @} */ 97 : 98 : #ifdef __cplusplus 99 : } 100 : #endif 101 : 102 : #endif /* BT_MESH_OD_PRIV_PROXY_CLI_H__ */