1 // Copyright 2021 Espressif Systems (Shanghai) CO LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License 14 15 #pragma once 16 17 #include "esp_netif.h" 18 #include "esp_netif_types.h" 19 #include "esp_openthread.h" 20 #include "openthread/instance.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** 27 * @brief Initializes the border router features of OpenThread. 28 * 29 * @note Calling this function will make the device behave as an OpenThread 30 * border router. Kconfig option CONFIG_OPENTHREAD_BORDER_ROUTER is required. 31 * 32 * @param[in] backbone_netif The backbone network interface (WiFi or ethernet) 33 * 34 * @return 35 * - ESP_OK on success 36 * - ESP_ERR_NOT_SUPPORTED if feature not supported 37 * - ESP_ERR_INVALID_STATE if already initialized 38 * - ESP_FIAL on other failures 39 * 40 */ 41 esp_err_t esp_openthread_border_router_init(esp_netif_t *backbone_netif); 42 43 /** 44 * @brief Deinitializes the border router features of OpenThread. 45 * 46 * @return 47 * - ESP_OK on success 48 * - ESP_ERR_INVALID_STATE if not initialized 49 * - ESP_FIAL on other failures 50 * 51 */ 52 esp_err_t esp_openthread_border_router_deinit(void); 53 54 /** 55 * @brief Gets the backbone interface of OpenThread border router. 56 * 57 * @return 58 * The backbone interface or NULL if border router not initialized. 59 * 60 */ 61 esp_netif_t *esp_openthread_get_backbone_netif(void); 62 63 #ifdef __cplusplus 64 } 65 #endif 66