xref: /btstack/src/mesh/mesh_proxy.h (revision 047f254657d86a6bcf7f3517a4968193e7659793)
1f4854a5eSMatthias Ringwald /*
2f4854a5eSMatthias Ringwald  * Copyright (C) 2018 BlueKitchen GmbH
3f4854a5eSMatthias Ringwald  *
4f4854a5eSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5f4854a5eSMatthias Ringwald  * modification, are permitted provided that the following conditions
6f4854a5eSMatthias Ringwald  * are met:
7f4854a5eSMatthias Ringwald  *
8f4854a5eSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9f4854a5eSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10f4854a5eSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11f4854a5eSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12f4854a5eSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13f4854a5eSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14f4854a5eSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15f4854a5eSMatthias Ringwald  *    from this software without specific prior written permission.
16f4854a5eSMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17f4854a5eSMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18f4854a5eSMatthias Ringwald  *    monetary gain.
19f4854a5eSMatthias Ringwald  *
20f4854a5eSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21f4854a5eSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22f4854a5eSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23f4854a5eSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24f4854a5eSMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25f4854a5eSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26f4854a5eSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27f4854a5eSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28f4854a5eSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29f4854a5eSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30f4854a5eSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31f4854a5eSMatthias Ringwald  * SUCH DAMAGE.
32f4854a5eSMatthias Ringwald  *
33f4854a5eSMatthias Ringwald  * Please inquire about commercial licensing options at
34f4854a5eSMatthias Ringwald  * [email protected]
35f4854a5eSMatthias Ringwald  *
36f4854a5eSMatthias Ringwald  */
37f4854a5eSMatthias Ringwald 
38f4854a5eSMatthias Ringwald #ifndef __MESH_PROXY_H
39f4854a5eSMatthias Ringwald #define __MESH_PROXY_H
40f4854a5eSMatthias Ringwald 
41f4854a5eSMatthias Ringwald #include <stdint.h>
42f4854a5eSMatthias Ringwald 
43f4854a5eSMatthias Ringwald #include "mesh/adv_bearer.h"
44f4854a5eSMatthias Ringwald 
45f4854a5eSMatthias Ringwald #ifdef __cplusplus
46f4854a5eSMatthias Ringwald extern "C"
47f4854a5eSMatthias Ringwald {
48f4854a5eSMatthias Ringwald #endif
49f4854a5eSMatthias Ringwald 
50f4854a5eSMatthias Ringwald 
51f4854a5eSMatthias Ringwald typedef enum {
52f4854a5eSMatthias Ringwald     MESH_NODE_IDENTITY_STATE_ADVERTISING_STOPPED = 0,
53f4854a5eSMatthias Ringwald     MESH_NODE_IDENTITY_STATE_ADVERTISING_RUNNING,
54f4854a5eSMatthias Ringwald     MESH_NODE_IDENTITY_STATE_ADVERTISING_NOT_SUPPORTED
55f4854a5eSMatthias Ringwald } mesh_node_identity_state_t;
56f4854a5eSMatthias Ringwald 
57f4854a5eSMatthias Ringwald /**
58f4854a5eSMatthias Ringwald  * @brief Init Mesh Proxy
59f4854a5eSMatthias Ringwald  */
60f4854a5eSMatthias Ringwald void mesh_proxy_init(uint16_t primary_unicast_address);
61f4854a5eSMatthias Ringwald 
62f4854a5eSMatthias Ringwald /**
63f4854a5eSMatthias Ringwald  * @brief Start Advertising Unprovisioned Device with Device ID
64f4854a5eSMatthias Ringwald  */
65f4854a5eSMatthias Ringwald void mesh_proxy_start_advertising_unprovisioned_device(void);
66f4854a5eSMatthias Ringwald 
67f4854a5eSMatthias Ringwald /**
68f4854a5eSMatthias Ringwald  * @brief Start Advertising Unprovisioned Device with Device ID
69f4854a5eSMatthias Ringwald  * @param device_uuid
70f4854a5eSMatthias Ringwald  */
71f4854a5eSMatthias Ringwald void mesh_proxy_stop_advertising_unprovisioned_device(void);
72f4854a5eSMatthias Ringwald 
73f4854a5eSMatthias Ringwald /**
74f4854a5eSMatthias Ringwald  * @brief Set Advertising with Node ID on given subnet
75f4854a5eSMatthias Ringwald  * @param netkey_index of subnet
76f4854a5eSMatthias Ringwald  * @returns MESH_FOUNDATION_STATUS_SUCCESS, MESH_FOUNDATION_STATUS_FEATURE_NOT_SUPPORTED, or MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX
77f4854a5eSMatthias Ringwald  * @note Node ID is only advertised on one subnet at a time and it is limited to 60 seconds
78f4854a5eSMatthias Ringwald  */
79f4854a5eSMatthias Ringwald uint8_t mesh_proxy_set_advertising_with_node_id(uint16_t netkey_index, mesh_node_identity_state_t state);
80f4854a5eSMatthias Ringwald 
81f4854a5eSMatthias Ringwald /**
82f4854a5eSMatthias Ringwald  * @brief Check if Advertising with Node ID is active
83f4854a5eSMatthias Ringwald  * @param netey_index of subnet
84f4854a5eSMatthias Ringwald  * @param out_state current state
85f4854a5eSMatthias Ringwald  * @returns MESH_FOUNDATION_STATUS_SUCCESS or MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX
86f4854a5eSMatthias Ringwald  */
87f4854a5eSMatthias Ringwald uint8_t mesh_proxy_get_advertising_with_node_id_status(uint16_t netkey_index, mesh_node_identity_state_t * out_state );
88f4854a5eSMatthias Ringwald 
89f4854a5eSMatthias Ringwald /**
90*047f2546SMatthias Ringwald  * @brief Start Advertising with Node Identity (on all subnets)
91*047f2546SMatthias Ringwald  */
92*047f2546SMatthias Ringwald void mesh_proxy_start_advertising_with_node_id(void);
93*047f2546SMatthias Ringwald 
94*047f2546SMatthias Ringwald /**
95*047f2546SMatthias Ringwald  * @brief Stop Advertising with Node Identity (on all subnets)
96*047f2546SMatthias Ringwald  */
97*047f2546SMatthias Ringwald void mesh_proxy_stop_advertising_with_node_id(void);
98*047f2546SMatthias Ringwald 
99*047f2546SMatthias Ringwald /**
100f4854a5eSMatthias Ringwald  * @brief Start Advertising with Network ID (on all subnets)
101f4854a5eSMatthias Ringwald  */
102f4854a5eSMatthias Ringwald void mesh_proxy_start_advertising_with_network_id(void);
103f4854a5eSMatthias Ringwald 
104f4854a5eSMatthias Ringwald /**
105f4854a5eSMatthias Ringwald  * @brief Stop Advertising with Network ID (on all subnets)
106f4854a5eSMatthias Ringwald  */
107f4854a5eSMatthias Ringwald void mesh_proxy_stop_advertising_with_network_id(void);
108f4854a5eSMatthias Ringwald 
109f4854a5eSMatthias Ringwald #ifdef __cplusplus
110f4854a5eSMatthias Ringwald } /* end of extern "C" */
111f4854a5eSMatthias Ringwald #endif
112f4854a5eSMatthias Ringwald 
113f4854a5eSMatthias Ringwald #endif
114