2021-09-07 05:37:47 -04:00
|
|
|
/*
|
2024-04-28 07:41:35 -04:00
|
|
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
2021-09-07 05:37:47 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2021-06-07 04:13:58 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esp_netif.h"
|
|
|
|
#include "esp_netif_types.h"
|
|
|
|
#include "esp_openthread.h"
|
2021-06-17 03:44:19 -04:00
|
|
|
#include "openthread/instance.h"
|
2021-06-07 04:13:58 -04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-09-07 05:37:47 -04:00
|
|
|
/**
|
|
|
|
* @brief Sets the backbone interface used for border routing.
|
|
|
|
*
|
|
|
|
* @note This function must be called before esp_openthread_init
|
|
|
|
*
|
|
|
|
* @param[in] backbone_netif The backbone network interface (WiFi or ethernet)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void esp_openthread_set_backbone_netif(esp_netif_t *backbone_netif);
|
|
|
|
|
2021-06-07 04:13:58 -04:00
|
|
|
/**
|
|
|
|
* @brief Initializes the border router features of OpenThread.
|
|
|
|
*
|
|
|
|
* @note Calling this function will make the device behave as an OpenThread
|
|
|
|
* border router. Kconfig option CONFIG_OPENTHREAD_BORDER_ROUTER is required.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK on success
|
|
|
|
* - ESP_ERR_NOT_SUPPORTED if feature not supported
|
2021-06-17 03:44:19 -04:00
|
|
|
* - ESP_ERR_INVALID_STATE if already initialized
|
|
|
|
* - ESP_FIAL on other failures
|
2021-06-07 04:13:58 -04:00
|
|
|
*
|
|
|
|
*/
|
2021-09-07 05:37:47 -04:00
|
|
|
esp_err_t esp_openthread_border_router_init(void);
|
2021-06-07 04:13:58 -04:00
|
|
|
|
2021-06-17 03:44:19 -04:00
|
|
|
/**
|
|
|
|
* @brief Deinitializes the border router features of OpenThread.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK on success
|
|
|
|
* - ESP_ERR_INVALID_STATE if not initialized
|
|
|
|
* - ESP_FIAL on other failures
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
esp_err_t esp_openthread_border_router_deinit(void);
|
|
|
|
|
2021-06-07 04:13:58 -04:00
|
|
|
/**
|
|
|
|
* @brief Gets the backbone interface of OpenThread border router.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* The backbone interface or NULL if border router not initialized.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
esp_netif_t *esp_openthread_get_backbone_netif(void);
|
|
|
|
|
2022-03-02 05:04:38 -05:00
|
|
|
/**
|
|
|
|
* @brief Registers the callback for RCP failure.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_handler handler);
|
|
|
|
|
|
|
|
/**
|
2024-04-28 07:41:35 -04:00
|
|
|
* @brief Deinitializes the connection to RCP.
|
2022-03-02 05:04:38 -05:00
|
|
|
*
|
2023-11-22 06:15:55 -05:00
|
|
|
* @return
|
|
|
|
* - ESP_OK on success
|
|
|
|
* - ESP_ERR_INVALID_STATE if fail to deinitialize RCP
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
esp_err_t esp_openthread_rcp_deinit(void);
|
|
|
|
|
|
|
|
/**
|
2024-04-28 07:41:35 -04:00
|
|
|
* @brief Initializes the connection to RCP.
|
2023-11-22 06:15:55 -05:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK on success
|
|
|
|
* - ESP_FAIL if fail to initialize RCP
|
|
|
|
*
|
2022-03-02 05:04:38 -05:00
|
|
|
*/
|
2023-11-22 06:15:55 -05:00
|
|
|
esp_err_t esp_openthread_rcp_init(void);
|
2022-03-02 05:04:38 -05:00
|
|
|
|
2024-04-28 07:41:35 -04:00
|
|
|
/**
|
|
|
|
* @brief Sets the meshcop(e) instance name.
|
|
|
|
*
|
|
|
|
* @note This function can only be called before `esp_openthread_border_router_init`.
|
|
|
|
* If `instance_name` is NULL, then the service will use the hostname as instance name.
|
|
|
|
*
|
|
|
|
* @param[in] instance_name The instance name, can be `NULL`.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK on success
|
|
|
|
* - ESP_FAIL if fail to initialize RCP
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
esp_err_t esp_openthread_set_meshcop_instance_name(const char *instance_name);
|
|
|
|
|
2021-06-07 04:13:58 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|