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