Controller && VHCI¶
Overview¶
Application Example¶
Check bluetooth folder in ESP-IDF examples, which contains the following application:
- This is a BLE advertising demo with virtual HCI interface. Send Reset/ADV_PARAM/ADV_DATA/ADV_ENABLE HCI command for BLE advertising - bluetooth/ble_adv.
API Reference¶
Header File¶
Functions¶
-
esp_err_t
esp_bt_controller_init
(esp_bt_controller_config_t *cfg)¶ Initialize BT controller to allocate task and other resource.
- Return
- ESP_OK - success, other - failed
- Parameters
cfg
: Initial configuration of BT controller. This function should be called only once, before any other BT functions are called.
-
void
esp_bt_controller_deinit
(void)¶ De-initialize BT controller to free resource and delete task.
This function should be called only once, after any other BT functions are called. This function is not whole completed, esp_bt_controller_init cannot called after this function.
-
esp_err_t
esp_bt_controller_enable
(esp_bt_mode_t mode)¶ Enable BT controller.
- Return
- ESP_OK - success, other - failed
- Parameters
mode
: : the mode(BLE/BT/BTDM) to enable. Now only support BTDM.
-
esp_err_t
esp_bt_controller_disable
(esp_bt_mode_t mode)¶ Disable BT controller.
- Return
- ESP_OK - success, other - failed
- Parameters
mode
: : the mode(BLE/BT/BTDM) to disable. Now only support BTDM.
-
esp_bt_controller_status_t
esp_bt_controller_get_status
(void)¶ Get BT controller is initialised/de-initialised/enabled/disabled.
- Return
- status value
-
bool
esp_vhci_host_check_send_available
(void)¶ esp_vhci_host_check_send_available used for check actively if the host can send packet to controller or not.
- Return
- true for ready to send, false means cannot send packet
-
void
esp_vhci_host_send_packet
(uint8_t *data, uint16_t len)¶ esp_vhci_host_send_packet host send packet to controller
- Parameters
data
: the packet point ,len
: the packet length
-
void
esp_vhci_host_register_callback
(const esp_vhci_host_callback_t *callback)¶ esp_vhci_host_register_callback register the vhci referece callback, the call back struct defined by vhci_host_callback structure.
- Parameters
callback
: esp_vhci_host_callback type variable
Structures¶
-
struct
esp_bt_controller_config_t
¶ Controller config options, depend on config mask. Config mask indicate which functions enabled, this means some options or parameters of some functions enabled by config mask.
-
struct
esp_vhci_host_callback
¶ esp_vhci_host_callback used for vhci call host function to notify what host need to do
Type Definitions¶
-
typedef struct esp_vhci_host_callback
esp_vhci_host_callback_t
¶ esp_vhci_host_callback used for vhci call host function to notify what host need to do