mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
feat(openthread): add an API to set rcp version string
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "esp_netif.h"
|
||||
#include "esp_netif_types.h"
|
||||
#include "esp_openthread.h"
|
||||
#include "esp_openthread_spinel.h"
|
||||
#include "openthread/instance.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -60,42 +61,6 @@ esp_err_t esp_openthread_border_router_deinit(void);
|
||||
*/
|
||||
esp_netif_t *esp_openthread_get_backbone_netif(void);
|
||||
|
||||
/**
|
||||
* @brief Registers the callback for RCP failure.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_handler handler);
|
||||
|
||||
/**
|
||||
* @brief Registers the callback for spinel compatibility error.
|
||||
*
|
||||
* @note This function must be called before esp_openthread_init.
|
||||
*
|
||||
* @param[in] callback The callback.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_set_compatibility_error_callback(esp_openthread_compatibility_error_callback callback);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the connection to RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_INVALID_STATE if fail to deinitialize RCP
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Initializes the connection to RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL if fail to initialize RCP
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_init(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the meshcop(e) instance name.
|
||||
*
|
||||
|
||||
71
components/openthread/include/esp_openthread_spinel.h
Normal file
71
components/openthread/include/esp_openthread_spinel.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_openthread_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Registers the callback for RCP failure.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_handler handler);
|
||||
|
||||
/**
|
||||
* @brief Registers the callback for spinel compatibility error.
|
||||
*
|
||||
* @note This function should be called before esp_openthread_init.
|
||||
*
|
||||
* @param[in] callback The callback.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_set_compatibility_error_callback(esp_openthread_compatibility_error_callback callback);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the connection to RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_INVALID_STATE if fail to deinitialize RCP
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Initializes the connection to RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL if fail to initialize RCP
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_init(void);
|
||||
|
||||
/**
|
||||
* @brief Set the RCP version string.
|
||||
*
|
||||
* @note This function should be called before esp_openthread_init. When the RCP version string is not an empty string,
|
||||
* compatibility checks will be performed during the initialization of the ESP OpenThread radio spinel.
|
||||
* The `esp_openthread_compatibility_error_callback` will be triggered if the desired RCP version does not match
|
||||
* the actual version running on the RCP. If needed, a NULL parameter can be passed to clear the version string.
|
||||
*
|
||||
* @param[in] version_str The pointer to RCP version string.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL if fail to set RCP version string
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_version_set(const char *version_str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -198,8 +198,16 @@ typedef struct {
|
||||
esp_openthread_port_config_t port_config; /*!< The port configuration */
|
||||
} esp_openthread_platform_config_t;
|
||||
|
||||
/**
|
||||
* @brief The OpenThread rcp failure handler
|
||||
*
|
||||
*/
|
||||
typedef void (*esp_openthread_rcp_failure_handler)(void);
|
||||
|
||||
/**
|
||||
* @brief The OpenThread compatibility error callback
|
||||
*
|
||||
*/
|
||||
typedef void (*esp_openthread_compatibility_error_callback)(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user