LCOV - code coverage report
Current view: top level - zephyr/bluetooth/mesh - priv_beacon_cli.h Hit Total Coverage
Test: new.info Lines: 20 23 87.0 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           0 : /*
       2             :  * Copyright (c) 2020 Nordic Semiconductor ASA
       3             :  *
       4             :  * SPDX-License-Identifier: Apache-2.0
       5             :  */
       6             : 
       7             : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_PRIV_BEACON_CLI_H__
       8             : #define ZEPHYR_INCLUDE_BLUETOOTH_MESH_PRIV_BEACON_CLI_H__
       9             : 
      10             : #include <zephyr/bluetooth/mesh.h>
      11             : 
      12             : #ifdef __cplusplus
      13             : extern "C" {
      14             : #endif
      15             : 
      16             : /**
      17             :  * @defgroup bt_mesh_priv_beacon_cli Bluetooth Mesh Private Beacon Client
      18             :  * @ingroup bt_mesh
      19             :  * @{
      20             :  */
      21             : 
      22             : /**
      23             :  *
      24             :  *  @brief Private Beacon Client model composition data entry.
      25             :  *
      26             :  *  @param cli_data Pointer to a @ref bt_mesh_priv_beacon_cli instance.
      27             :  */
      28           1 : #define BT_MESH_MODEL_PRIV_BEACON_CLI(cli_data)                                \
      29             :         BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_PRIV_BEACON_CLI,                     \
      30             :                          bt_mesh_priv_beacon_cli_op, NULL, cli_data,           \
      31             :                          &bt_mesh_priv_beacon_cli_cb)
      32             : 
      33             : struct bt_mesh_priv_beacon_cli;
      34             : 
      35             : /** Private Beacon */
      36           1 : struct bt_mesh_priv_beacon {
      37             :         /** Private beacon is enabled */
      38           1 :         uint8_t enabled;
      39             :         /** Random refresh interval (in 10 second steps), or 0 to keep current
      40             :          *  value.
      41             :          */
      42           1 :         uint8_t rand_interval;
      43             : };
      44             : 
      45             : /** Private Node Identity */
      46           1 : struct bt_mesh_priv_node_id {
      47             :         /** Index of the NetKey. */
      48           1 :         uint16_t net_idx;
      49             :         /** Private Node Identity state */
      50           1 :         uint8_t state;
      51             :         /** Response status code. */
      52           1 :         uint8_t status;
      53             : };
      54             : 
      55             : /** Private Beacon Client Status messages callbacks */
      56           1 : struct bt_mesh_priv_beacon_cli_cb {
      57             :         /** @brief Optional callback for Private Beacon Status message.
      58             :          *
      59             :          *  Handles received Private Beacon Status messages from a Private Beacon server.
      60             :          *
      61             :          *  @param cli         Private Beacon client context.
      62             :          *  @param addr        Address of the sender.
      63             :          *  @param priv_beacon Mesh Private Beacon state received from the server.
      64             :          */
      65           1 :         void (*priv_beacon_status)(struct bt_mesh_priv_beacon_cli *cli, uint16_t addr,
      66             :                                    struct bt_mesh_priv_beacon *priv_beacon);
      67             : 
      68             :         /** @brief Optional callback for Private GATT Proxy Status message.
      69             :          *
      70             :          *  Handles received Private GATT Proxy Status messages from a Private Beacon server.
      71             :          *
      72             :          *  @param cli         Private Beacon client context.
      73             :          *  @param addr        Address of the sender.
      74             :          *  @param gatt_proxy  Private GATT Proxy state received from the server.
      75             :          */
      76           1 :         void (*priv_gatt_proxy_status)(struct bt_mesh_priv_beacon_cli *cli, uint16_t addr,
      77             :                                        uint8_t gatt_proxy);
      78             : 
      79             :         /** @brief Optional callback for Private Node Identity Status message.
      80             :          *
      81             :          *  Handles received Private Node Identity Status messages from a Private Beacon server.
      82             :          *
      83             :          *  @param cli           Private Beacon client context.
      84             :          *  @param addr          Address of the sender.
      85             :          *  @param priv_node_id  Private Node Identity state received from the server.
      86             :          */
      87           1 :         void (*priv_node_id_status)(struct bt_mesh_priv_beacon_cli *cli, uint16_t addr,
      88             :                                     struct bt_mesh_priv_node_id *priv_node_id);
      89             : };
      90             : 
      91             : /** Mesh Private Beacon Client model */
      92           1 : struct bt_mesh_priv_beacon_cli {
      93           0 :         const struct bt_mesh_model *model;
      94             : 
      95             :         /* Internal parameters for tracking message responses. */
      96           0 :         struct bt_mesh_msg_ack_ctx ack_ctx;
      97             : 
      98             :         /** Optional callback for Private Beacon Client Status messages. */
      99           1 :         const struct bt_mesh_priv_beacon_cli_cb *cb;
     100             : };
     101             : 
     102             : /** @brief Set the target's Private Beacon state.
     103             :  *
     104             :  *  This method can be used asynchronously by setting @p rsp as NULL.
     105             :  *  This way the method will not wait for response and will return
     106             :  *  immediately after sending the command.
     107             : 
     108             :  *  @param net_idx Network index to encrypt with.
     109             :  *  @param addr    Target node address.
     110             :  *  @param val     New Private Beacon value.
     111             :  *  @param rsp     If set, returns response status on success.
     112             :  *
     113             :  *  @return 0 on success, or (negative) error code otherwise.
     114             :  */
     115           1 : int bt_mesh_priv_beacon_cli_set(uint16_t net_idx, uint16_t addr,
     116             :                                 struct bt_mesh_priv_beacon *val,
     117             :                                 struct bt_mesh_priv_beacon *rsp);
     118             : 
     119             : /** @brief Get the target's Private Beacon state.
     120             :  *
     121             :  *  @param net_idx Network index to encrypt with.
     122             :  *  @param addr    Target node address.
     123             :  *  @param val     Response buffer for Private Beacon value.
     124             :  *
     125             :  *  @return 0 on success, or (negative) error code otherwise.
     126             :  */
     127           1 : int bt_mesh_priv_beacon_cli_get(uint16_t net_idx, uint16_t addr,
     128             :                                 struct bt_mesh_priv_beacon *val);
     129             : 
     130             : /** @brief Set the target's Private GATT Proxy state.
     131             :  *
     132             :  *  This method can be used asynchronously by setting @p rsp as NULL.
     133             :  *  This way the method will not wait for response and will return
     134             :  *  immediately after sending the command.
     135             :  *
     136             :  *  @param net_idx Network index to encrypt with.
     137             :  *  @param addr    Target node address.
     138             :  *  @param val     New Private GATT Proxy value.
     139             :  *  @param rsp     If set, returns response status on success.
     140             :  *
     141             :  *  @return 0 on success, or (negative) error code otherwise.
     142             :  */
     143           1 : int bt_mesh_priv_beacon_cli_gatt_proxy_set(uint16_t net_idx, uint16_t addr,
     144             :                                            uint8_t val, uint8_t *rsp);
     145             : 
     146             : /** @brief Get the target's Private GATT Proxy state.
     147             :  *
     148             :  *  @param net_idx Network index to encrypt with.
     149             :  *  @param addr    Target node address.
     150             :  *  @param val     Response buffer for Private GATT Proxy value.
     151             :  *
     152             :  *  @return 0 on success, or (negative) error code otherwise.
     153             :  */
     154           1 : int bt_mesh_priv_beacon_cli_gatt_proxy_get(uint16_t net_idx, uint16_t addr,
     155             :                                            uint8_t *val);
     156             : 
     157             : /** @brief Set the target's Private Node Identity state.
     158             :  *
     159             :  *  This method can be used asynchronously by setting @p rsp as NULL.
     160             :  *  This way the method will not wait for response and will return
     161             :  *  immediately after sending the command.
     162             :  *
     163             :  *  @param net_idx Network index to encrypt with.
     164             :  *  @param addr    Target node address.
     165             :  *  @param val     New Private Node Identity value.
     166             :  *  @param rsp     If set, returns response status on success.
     167             :  *
     168             :  *  @return 0 on success, or (negative) error code otherwise.
     169             :  */
     170           1 : int bt_mesh_priv_beacon_cli_node_id_set(uint16_t net_idx, uint16_t addr,
     171             :                                         struct bt_mesh_priv_node_id *val,
     172             :                                         struct bt_mesh_priv_node_id *rsp);
     173             : 
     174             : /** @brief Get the target's Private Node Identity state.
     175             :  *
     176             :  *  @param net_idx     Network index to encrypt with.
     177             :  *  @param addr        Target node address.
     178             :  *  @param key_net_idx Network index to get the Private Node Identity state of.
     179             :  *  @param val         Response buffer for Private Node Identity value.
     180             :  *
     181             :  *  @return 0 on success, or (negative) error code otherwise.
     182             :  */
     183           1 : int bt_mesh_priv_beacon_cli_node_id_get(uint16_t net_idx, uint16_t addr,
     184             :                                         uint16_t key_net_idx,
     185             :                                         struct bt_mesh_priv_node_id *val);
     186             : 
     187             : /** @cond INTERNAL_HIDDEN */
     188             : extern const struct bt_mesh_model_op bt_mesh_priv_beacon_cli_op[];
     189             : extern const struct bt_mesh_model_cb bt_mesh_priv_beacon_cli_cb;
     190             : /** @endcond */
     191             : 
     192             : /** @} */
     193             : 
     194             : #ifdef __cplusplus
     195             : }
     196             : #endif
     197             : 
     198             : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_PRIV_BEACON_CLI_H__ */

Generated by: LCOV version 1.14