Line data Source code
1 1 : /** @file
2 : * @brief Proxy APIs.
3 : */
4 :
5 : /*
6 : * Copyright (c) 2017 Intel Corporation
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : */
10 : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_PROXY_H_
11 : #define ZEPHYR_INCLUDE_BLUETOOTH_MESH_PROXY_H_
12 :
13 : #include <stdint.h>
14 :
15 : #include <zephyr/kernel.h>
16 : #include <zephyr/sys/iterable_sections.h>
17 :
18 : /**
19 : * @brief Proxy
20 : * @defgroup bt_mesh_proxy Proxy
21 : * @ingroup bt_mesh
22 : * @{
23 : */
24 :
25 : #ifdef __cplusplus
26 : extern "C" {
27 : #endif
28 :
29 : /** Callbacks for the Proxy feature.
30 : *
31 : * Should be instantiated with @ref BT_MESH_PROXY_CB_DEFINE.
32 : */
33 1 : struct bt_mesh_proxy_cb {
34 : /** @brief Started sending Node Identity beacons on the given subnet.
35 : *
36 : * @param net_idx Network index the Node Identity beacons are running
37 : * on.
38 : */
39 1 : void (*identity_enabled)(uint16_t net_idx);
40 : /** @brief Stopped sending Node Identity beacons on the given subnet.
41 : *
42 : * @param net_idx Network index the Node Identity beacons were running
43 : * on.
44 : */
45 1 : void (*identity_disabled)(uint16_t net_idx);
46 : };
47 :
48 : /**
49 : * @brief Register a callback structure for Proxy events.
50 : *
51 : * Registers a structure with callback functions that gets called on various
52 : * Proxy events.
53 : *
54 : * @param _name Name of callback structure.
55 : */
56 1 : #define BT_MESH_PROXY_CB_DEFINE(_name) \
57 : static const STRUCT_SECTION_ITERABLE( \
58 : bt_mesh_proxy_cb, _CONCAT(bt_mesh_proxy_cb_, _name))
59 :
60 : /** @brief Enable advertising with Node Identity.
61 : *
62 : * This API requires that GATT Proxy support has been enabled. Once called
63 : * each subnet will start advertising using Node Identity for the next
64 : * 60 seconds.
65 : *
66 : * @return 0 on success, or (negative) error code on failure.
67 : */
68 1 : int bt_mesh_proxy_identity_enable(void);
69 :
70 : /** @brief Enable advertising with Private Node Identity.
71 : *
72 : * This API requires that GATT Proxy support has been enabled. Once called
73 : * each subnet will start advertising using Private Node Identity for the next
74 : * 60 seconds.
75 : *
76 : * @return 0 on success, or (negative) error code on failure.
77 : */
78 1 : int bt_mesh_proxy_private_identity_enable(void);
79 :
80 : /** @brief Allow Proxy Client to auto connect to a network.
81 : *
82 : * This API allows a proxy client to auto-connect a given network.
83 : *
84 : * @param net_idx Network Key Index
85 : *
86 : * @return 0 on success, or (negative) error code on failure.
87 : */
88 1 : int bt_mesh_proxy_connect(uint16_t net_idx);
89 :
90 : /** @brief Disallow Proxy Client to auto connect to a network.
91 : *
92 : * This API disallows a proxy client to connect a given network.
93 : *
94 : * @param net_idx Network Key Index
95 : *
96 : * @return 0 on success, or (negative) error code on failure.
97 : */
98 1 : int bt_mesh_proxy_disconnect(uint16_t net_idx);
99 :
100 : /** @brief Schedule advertising of Solicitation PDUs.
101 : *
102 : * Once called, the device will schedule advertising Solicitation PDUs for the amount of time
103 : * defined by @c adv_int * (@c CONFIG_BT_MESH_SOL_ADV_XMIT + 1), where @c adv_int is 20ms
104 : * for Bluetooth v5.0 or higher, or 100ms otherwise.
105 : *
106 : * If the number of advertised Solicitation PDUs reached 0xFFFFFF, the advertisements will
107 : * no longer be started until the node is reprovisioned.
108 : *
109 : * @param net_idx Network Key Index
110 : *
111 : * @return 0 on success, or (negative) error code on failure.
112 : */
113 1 : int bt_mesh_proxy_solicit(uint16_t net_idx);
114 :
115 : #ifdef __cplusplus
116 : }
117 : #endif
118 :
119 : /**
120 : * @}
121 : */
122 :
123 : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_PROXY_H_ */
|