Bluetooth® Main API
API Reference
Header File
This header file can be included with:
#include "esp_bt_main.h"
This header file is a part of the API provided by the
btcomponent. To declare that your component depends onbt, add the following to your CMakeLists.txt:REQUIRES bt
or
PRIV_REQUIRES bt
Functions
- 
esp_bluedroid_status_t esp_bluedroid_get_status(void)
 Get bluetooth stack status.
- 返回
 Bluetooth stack status
- 
esp_err_t esp_bluedroid_enable(void)
 Enable bluetooth, must after esp_bluedroid_init()/esp_bluedroid_init_with_cfg().
- 返回
 ESP_OK : Succeed
Other : Failed
- 
esp_err_t esp_bluedroid_disable(void)
 Disable Bluetooth, must be called prior to esp_bluedroid_deinit().
备注
Before calling this API, ensure that all activities related to the application, such as connections, scans, etc., are properly closed.
- 返回
 ESP_OK : Succeed
Other : Failed
- 
esp_err_t esp_bluedroid_init(void)
 Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff.
- 返回
 ESP_OK : Succeed
Other : Failed
- 
esp_err_t esp_bluedroid_init_with_cfg(esp_bluedroid_config_t *cfg)
 Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff.
- 参数
 cfg -- Initial configuration of ESP Bluedroid stack.
- 返回
 ESP_OK : Succeed
Other : Failed
Structures
Macros
- 
BT_BLUEDROID_INIT_CONFIG_DEFAULT()
 
Enumerations
- 
enum esp_bluedroid_status_t
 Bluetooth stack status type, to indicate whether the bluetooth stack is ready.
Values:
- 
enumerator ESP_BLUEDROID_STATUS_UNINITIALIZED
 Bluetooth not initialized
- 
enumerator ESP_BLUEDROID_STATUS_INITIALIZED
 Bluetooth initialized but not enabled
- 
enumerator ESP_BLUEDROID_STATUS_ENABLED
 Bluetooth initialized and enabled
- 
enumerator ESP_BLUEDROID_STATUS_UNINITIALIZED