1f4854a5eSMatthias Ringwald /* 2f4854a5eSMatthias Ringwald * Copyright (C) 2019 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_H 39f4854a5eSMatthias Ringwald #define __MESH_H 40f4854a5eSMatthias Ringwald 41f4854a5eSMatthias Ringwald #include "btstack_defines.h" 429d29a5e2SMatthias Ringwald #include "mesh/provisioning.h" 4366380807SMatthias Ringwald #include "mesh/mesh_keys.h" 44726dac53SMatthias Ringwald #include "mesh/mesh_access.h" 45f4854a5eSMatthias Ringwald 46f4854a5eSMatthias Ringwald #if defined __cplusplus 47f4854a5eSMatthias Ringwald extern "C" { 48f4854a5eSMatthias Ringwald #endif 49f4854a5eSMatthias Ringwald 50f4854a5eSMatthias Ringwald /** 51f4854a5eSMatthias Ringwald * Init Mesh network stack 52f4854a5eSMatthias Ringwald */ 53f4854a5eSMatthias Ringwald void mesh_init(void); 54f4854a5eSMatthias Ringwald 55f4854a5eSMatthias Ringwald /** 56f4854a5eSMatthias Ringwald * Register for Mesh Provisioning Device events 57f4854a5eSMatthias Ringwald * @param packet_handler 58f4854a5eSMatthias Ringwald */ 59f4854a5eSMatthias Ringwald void mesh_register_provisioning_device_packet_handler(btstack_packet_handler_t packet_handler); 60f4854a5eSMatthias Ringwald 61*a55e84a9SMatthias Ringwald // Foundation state 62*a55e84a9SMatthias Ringwald void mesh_foundation_state_load(void); 63*a55e84a9SMatthias Ringwald void mesh_foundation_state_store(void); 64*a55e84a9SMatthias Ringwald 6566380807SMatthias Ringwald // Mesh NetKey List 6666380807SMatthias Ringwald void mesh_store_network_key(mesh_network_key_t * network_key); 6766380807SMatthias Ringwald void mesh_delete_network_key(uint16_t internal_index); 6866380807SMatthias Ringwald void mesh_delete_network_keys(void); 6966380807SMatthias Ringwald void mesh_load_network_keys(void); 7066380807SMatthias Ringwald 7168d9ac23SMatthias Ringwald // Mesh Appkeys 7268d9ac23SMatthias Ringwald void mesh_store_app_key(mesh_transport_key_t * app_key); 7368d9ac23SMatthias Ringwald void mesh_delete_app_key(uint16_t internal_index); 7468d9ac23SMatthias Ringwald void mesh_delete_app_keys(void); 7568d9ac23SMatthias Ringwald void mesh_load_app_keys(void); 7668d9ac23SMatthias Ringwald 77726dac53SMatthias Ringwald // Mesh Model to Appkey List 78726dac53SMatthias Ringwald void mesh_load_appkey_lists(void); 79726dac53SMatthias Ringwald void mesh_delete_appkey_lists(void); 80726dac53SMatthias Ringwald void mesh_model_reset_appkeys(mesh_model_t * mesh_model); 81726dac53SMatthias Ringwald uint8_t mesh_model_bind_appkey(mesh_model_t * mesh_model, uint16_t appkey_index); 82726dac53SMatthias Ringwald void mesh_model_unbind_appkey(mesh_model_t * mesh_model, uint16_t appkey_index); 83726dac53SMatthias Ringwald int mesh_model_contains_appkey(mesh_model_t * mesh_model, uint16_t appkey_index); 84726dac53SMatthias Ringwald 859d29a5e2SMatthias Ringwald // temp 869d29a5e2SMatthias Ringwald void mesh_access_setup_from_provisioning_data(const mesh_provisioning_data_t * provisioning_data); 879d29a5e2SMatthias Ringwald void mesh_access_setup_without_provisiong_data(void); 889d29a5e2SMatthias Ringwald 89f4854a5eSMatthias Ringwald #if defined __cplusplus 90f4854a5eSMatthias Ringwald } 91f4854a5eSMatthias Ringwald #endif 92f4854a5eSMatthias Ringwald 93f4854a5eSMatthias Ringwald #endif //__MESH_H 94