3#if CONFIG_BT_BLE_ENABLED
12 esp_ble_gatts_cb_param_t *param) {
17 int dev_num = esp_ble_get_bond_device_num();
18 esp_ble_bond_dev_t *dev_list =
19 (esp_ble_bond_dev_t *)malloc(
sizeof(esp_ble_bond_dev_t) * dev_num);
20 esp_ble_get_bond_device_list(&dev_num, dev_list);
21 ESP_LOGI(
"MIDIBLE",
"Bonded devices list [%d]:", dev_num);
22 for (
int i = 0; i < dev_num; i++) {
23 ESP_LOGI(
"MIDIBLE",
" - %02x:%02x:%02x:%02x:%02x:%02x",
24 dev_list[i].bd_addr[0], dev_list[i].bd_addr[1],
25 dev_list[i].bd_addr[2], dev_list[i].bd_addr[3],
26 dev_list[i].bd_addr[4], dev_list[i].bd_addr[5]);
32 esp_ble_gap_cb_param_t *param) {
36 case ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT:
38 "status: %d, min_int: %d, max_int: %d, conn_int: %d, "
39 "latency: %d, timeout: %d",
40 param->update_conn_params.status,
41 param->update_conn_params.min_int,
42 param->update_conn_params.max_int,
43 param->update_conn_params.conn_int,
44 param->update_conn_params.latency,
45 param->update_conn_params.timeout);
48 case ESP_GAP_BLE_PASSKEY_NOTIF_EVT:
52 ESP_LOGI(
"MIDIBLE",
"The passkey Notify number: %06d",
53 param->ble_security.key_notif.passkey);
56 case ESP_GAP_BLE_KEY_EVT:
57 ESP_LOGI(
"MIDIBLE",
"key type: %s",
59 param->ble_security.ble_key.key_type));
62 case ESP_GAP_BLE_AUTH_CMPL_EVT:
63 ESP_LOGI(
"MIDIBLE",
"%02x:%02x:%02x:%02x:%02x:%02x",
64 param->ble_security.auth_cmpl.bd_addr[0],
65 param->ble_security.auth_cmpl.bd_addr[1],
66 param->ble_security.auth_cmpl.bd_addr[2],
67 param->ble_security.auth_cmpl.bd_addr[3],
68 param->ble_security.auth_cmpl.bd_addr[4],
69 param->ble_security.auth_cmpl.bd_addr[5]);
70 ESP_LOGI(
"MIDIBLE",
"address type: %d",
71 param->ble_security.auth_cmpl.addr_type);
72 ESP_LOGI(
"MIDIBLE",
"pair status: %s",
73 param->ble_security.auth_cmpl.success ?
"success"
75 if (!param->ble_security.auth_cmpl.success) {
76 ESP_LOGI(
"MIDIBLE",
"fail reason: 0x%x",
77 param->ble_security.auth_cmpl.fail_reason);
79 ESP_LOGI(
"MIDIBLE",
"auth mode: %s",
81 param->ble_security.auth_cmpl.auth_mode));
86 case ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT:
87 ESP_LOGI(
"MIDIBLE",
"status: %d",
88 param->remove_bond_dev_cmpl.status);
89 ESP_LOGI(
"MIDIBLE",
"%02x:%02x:%02x:%02x:%02x:%02x",
90 param->remove_bond_dev_cmpl.bd_addr[0],
91 param->remove_bond_dev_cmpl.bd_addr[1],
92 param->remove_bond_dev_cmpl.bd_addr[2],
93 param->remove_bond_dev_cmpl.bd_addr[3],
94 param->remove_bond_dev_cmpl.bd_addr[4],
95 param->remove_bond_dev_cmpl.bd_addr[5]);
Helpers for printing the names of enum values of the ESP32 Bluetooth API.
const char * esp_gatts_cb_event_to_string(esp_gatts_cb_event_t event)
const char * esp_ble_key_type_to_string(esp_ble_key_type_t key_type)
const char * esp_gap_ble_cb_event_to_string(esp_gap_ble_cb_event_t event)
const char * esp_ble_auth_req_to_string(esp_ble_auth_req_t auth_type)
Helpers for printing Bluetooth events and status.
void print_gatts_event(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void show_bonded_devices(void)
void print_gap_event(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)