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_BT_MESH_RPR_H__
8 : #define ZEPHYR_INCLUDE_BT_MESH_RPR_H__
9 :
10 : #include <zephyr/kernel.h>
11 : #include <zephyr/bluetooth/mesh/main.h>
12 :
13 : #ifdef __cplusplus
14 : extern "C" {
15 : #endif
16 :
17 : /**
18 : * @defgroup bt_mesh_rpr Remote Provisioning models
19 : * @ingroup bt_mesh
20 : * @{
21 : */
22 :
23 : /** Unprovisioned device has URI hash value */
24 1 : #define BT_MESH_RPR_UNPROV_HASH BIT(0)
25 1 : #define BT_MESH_RPR_UNPROV_ACTIVE BIT(1) /**< Internal */
26 1 : #define BT_MESH_RPR_UNPROV_FOUND BIT(2) /**< Internal */
27 1 : #define BT_MESH_RPR_UNPROV_REPORTED BIT(3) /**< Internal */
28 1 : #define BT_MESH_RPR_UNPROV_EXT BIT(4) /**< Internal */
29 1 : #define BT_MESH_RPR_UNPROV_HAS_LINK BIT(5) /**< Internal */
30 1 : #define BT_MESH_RPR_UNPROV_EXT_ADV_RXD BIT(6) /**< Internal */
31 :
32 : /** Minimum extended scan duration in seconds */
33 1 : #define BT_MESH_RPR_EXT_SCAN_TIME_MIN 1
34 : /** Maximum extended scan duration in seconds */
35 1 : #define BT_MESH_RPR_EXT_SCAN_TIME_MAX 21
36 :
37 0 : enum bt_mesh_rpr_status {
38 : BT_MESH_RPR_SUCCESS,
39 : BT_MESH_RPR_ERR_SCANNING_CANNOT_START,
40 : BT_MESH_RPR_ERR_INVALID_STATE,
41 : BT_MESH_RPR_ERR_LIMITED_RESOURCES,
42 : BT_MESH_RPR_ERR_LINK_CANNOT_OPEN,
43 : BT_MESH_RPR_ERR_LINK_OPEN_FAILED,
44 : BT_MESH_RPR_ERR_LINK_CLOSED_BY_DEVICE,
45 : BT_MESH_RPR_ERR_LINK_CLOSED_BY_SERVER,
46 : BT_MESH_RPR_ERR_LINK_CLOSED_BY_CLIENT,
47 : BT_MESH_RPR_ERR_LINK_CLOSED_AS_CANNOT_RECEIVE_PDU,
48 : BT_MESH_RPR_ERR_LINK_CLOSED_AS_CANNOT_SEND_PDU,
49 : BT_MESH_RPR_ERR_LINK_CLOSED_AS_CANNOT_DELIVER_PDU_REPORT,
50 : };
51 :
52 0 : enum bt_mesh_rpr_scan {
53 : BT_MESH_RPR_SCAN_IDLE,
54 : BT_MESH_RPR_SCAN_MULTI,
55 : BT_MESH_RPR_SCAN_SINGLE,
56 : };
57 :
58 0 : enum bt_mesh_rpr_node_refresh {
59 : /** Change the Device key. */
60 : BT_MESH_RPR_NODE_REFRESH_DEVKEY,
61 : /** Change the Device key and address. Device composition may change. */
62 : BT_MESH_RPR_NODE_REFRESH_ADDR,
63 : /** Change the Device key and composition. */
64 : BT_MESH_RPR_NODE_REFRESH_COMPOSITION,
65 : };
66 :
67 0 : enum bt_mesh_rpr_link_state {
68 : BT_MESH_RPR_LINK_IDLE,
69 : BT_MESH_RPR_LINK_OPENING,
70 : BT_MESH_RPR_LINK_ACTIVE,
71 : BT_MESH_RPR_LINK_SENDING,
72 : BT_MESH_RPR_LINK_CLOSING,
73 : };
74 :
75 : /** Remote provisioning actor, as seen across the mesh. */
76 1 : struct bt_mesh_rpr_node {
77 : /** Unicast address of the node. */
78 1 : uint16_t addr;
79 : /** Network index used when communicating with the node. */
80 1 : uint16_t net_idx;
81 : /** Time To Live value used when communicating with the node. */
82 1 : uint8_t ttl;
83 : };
84 :
85 : /** Unprovisioned device. */
86 1 : struct bt_mesh_rpr_unprov {
87 : /** Unprovisioned device UUID. */
88 1 : uint8_t uuid[16];
89 : /** Flags, see @p BT_MESH_RPR_UNPROV_* flags. */
90 1 : uint8_t flags;
91 : /** RSSI of unprovisioned device, as received by server. */
92 1 : int8_t rssi;
93 : /** Out of band information. */
94 1 : bt_mesh_prov_oob_info_t oob;
95 : /** URI hash in unprovisioned beacon.
96 : *
97 : * Only valid if @c flags has @ref BT_MESH_RPR_UNPROV_HASH set.
98 : */
99 1 : uint32_t hash;
100 : };
101 :
102 : /** Remote Provisioning Link status */
103 1 : struct bt_mesh_rpr_link {
104 : /** Link status */
105 1 : enum bt_mesh_rpr_status status;
106 : /** Link state */
107 1 : enum bt_mesh_rpr_link_state state;
108 : };
109 :
110 : /** @} */
111 :
112 : #ifdef __cplusplus
113 : }
114 : #endif
115 :
116 : #endif /* ZEPHYR_INCLUDE_BT_MESH_RPR_H__ */
|