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