1 /* 2 * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef __ESP_BT_MAIN_H__ 8 #define __ESP_BT_MAIN_H__ 9 10 #include "esp_err.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * @brief Bluetooth stack status type, to indicate whether the bluetooth stack is ready. 18 */ 19 typedef enum { 20 ESP_BLUEDROID_STATUS_UNINITIALIZED = 0, /*!< Bluetooth not initialized */ 21 ESP_BLUEDROID_STATUS_INITIALIZED, /*!< Bluetooth initialized but not enabled */ 22 ESP_BLUEDROID_STATUS_ENABLED /*!< Bluetooth initialized and enabled */ 23 } esp_bluedroid_status_t; 24 25 /** 26 * @brief Get bluetooth stack status 27 * 28 * @return Bluetooth stack status 29 * 30 */ 31 esp_bluedroid_status_t esp_bluedroid_get_status(void); 32 33 /** 34 * @brief Enable bluetooth, must after esp_bluedroid_init(). 35 * 36 * @return 37 * - ESP_OK : Succeed 38 * - Other : Failed 39 */ 40 esp_err_t esp_bluedroid_enable(void); 41 42 /** 43 * @brief Disable Bluetooth, must be called prior to esp_bluedroid_deinit(). 44 * 45 * @note Before calling this API, ensure that all activities related to 46 * the application, such as connections, scans, etc., are properly closed. 47 * 48 * @return 49 * - ESP_OK : Succeed 50 * - Other : Failed 51 */ 52 esp_err_t esp_bluedroid_disable(void); 53 54 /** 55 * @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff. 56 * 57 * @return 58 * - ESP_OK : Succeed 59 * - Other : Failed 60 */ 61 esp_err_t esp_bluedroid_init(void); 62 63 /** 64 * @brief Deinit and free the resource for bluetooth, must be after every bluetooth stuff. 65 * 66 * @return 67 * - ESP_OK : Succeed 68 * - Other : Failed 69 */ 70 esp_err_t esp_bluedroid_deinit(void); 71 72 #if defined(CONFIG_EXAMPLE_CI_ID) && defined(CONFIG_EXAMPLE_CI_PIPELINE_ID) 73 // Only for internal used (CI example test) 74 char *esp_bluedroid_get_example_name(void); 75 #endif 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* __ESP_BT_MAIN_H__ */ 82