diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h index 9f3d46b22a..98133f0003 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h @@ -226,6 +226,16 @@ typedef enum { ESP_BT_GAP_DISCOVERY_STARTED, /*!< Device discovery started */ } esp_bt_gap_discovery_state_t; +/// Type of link key +#define ESP_BT_LINK_KEY_COMB (0x00) /*!< Combination Key */ +#define ESP_BT_LINK_KEY_DBG_COMB (0x03) /*!< Debug Combination Key */ +#define ESP_BT_LINK_KEY_UNAUTHED_COMB_P192 (0x04) /*!< Unauthenticated Combination Key generated from P-192 */ +#define ESP_BT_LINK_KEY_AUTHED_COMB_P192 (0x05) /*!< Authenticated Combination Key generated from P-192 */ +#define ESP_BT_LINK_KEY_CHG_COMB (0x06) /*!< Changed Combination Key */ +#define ESP_BT_LINK_KEY_UNAUTHED_COMB_P256 (0x07) /*!< Unauthenticated Combination Key generated from P-256 */ +#define ESP_BT_LINK_KEY_AUTHED_COMB_P256 (0x08) /*!< Authenticated Combination Key generated from P-256 */ +typedef uint8_t esp_bt_link_key_type_t; + /// BT GAP callback events typedef enum { ESP_BT_GAP_DISC_RES_EVT = 0, /*!< Device discovery result event */ @@ -331,6 +341,7 @@ typedef union { struct auth_cmpl_param { esp_bd_addr_t bda; /*!< remote bluetooth device address*/ esp_bt_status_t stat; /*!< authentication complete status */ + esp_bt_link_key_type_t lk_type; /*!< type of link key generated */ uint8_t device_name[ESP_BT_GAP_MAX_BDNAME_LEN + 1]; /*!< device name */ } auth_cmpl; /*!< authentication complete parameter struct */ diff --git a/components/bt/host/bluedroid/btc/core/btc_dm.c b/components/bt/host/bluedroid/btc/core/btc_dm.c index 408ffb9efd..e386083411 100644 --- a/components/bt/host/bluedroid/btc/core/btc_dm.c +++ b/components/bt/host/bluedroid/btc/core/btc_dm.c @@ -413,6 +413,7 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) msg->pid = BTC_PID_GAP_BT; msg->act = BTC_GAP_BT_AUTH_CMPL_EVT; param.auth_cmpl.stat = status; + param.auth_cmpl.lk_type = p_auth_cmpl->key_type; memcpy(param.auth_cmpl.bda, p_auth_cmpl->bd_addr, ESP_BD_ADDR_LEN); memcpy(param.auth_cmpl.device_name, p_auth_cmpl->bd_name, ESP_BT_GAP_MAX_BDNAME_LEN + 1); memcpy(msg->arg, ¶m, sizeof(esp_bt_gap_cb_param_t)); diff --git a/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/main.c b/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/main.c index a140507146..46fdb76e53 100644 --- a/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/main.c +++ b/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/main.c @@ -59,6 +59,7 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa } else { ESP_LOGE(BT_AV_TAG, "authentication failed, status: %d", param->auth_cmpl.stat); } + ESP_LOGI(BT_AV_TAG, "link key type of current link is: %d", param->auth_cmpl.lk_type); break; }