Merge branch 'bugfix/btdm_smp_auth_complete_error' into 'master'

component/bt: Change the btc layer data copy method.

See merge request !844
pull/622/merge
Jiang Jiang Jian 2017-06-14 15:16:38 +08:00
commit ae7269d39d
2 zmienionych plików z 18 dodań i 6 usunięć

Wyświetl plik

@ -24,6 +24,7 @@
#include "btc_ble_storage.h" #include "btc_ble_storage.h"
#include "esp_gap_ble_api.h" #include "esp_gap_ble_api.h"
#include "bta_api.h" #include "bta_api.h"
#include "bta_gatt_api.h"
/****************************************************************************** /******************************************************************************
@ -121,9 +122,11 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
if (p_auth_cmpl->success) { if (p_auth_cmpl->success) {
status = BT_STATUS_SUCCESS; status = BT_STATUS_SUCCESS;
int addr_type; int addr_type;
bt_bdaddr_t bdaddr;
bdcpy(bdaddr.address, p_auth_cmpl->bd_addr);
bdcpy(pairing_cb.bd_addr, p_auth_cmpl->bd_addr); bdcpy(pairing_cb.bd_addr, p_auth_cmpl->bd_addr);
if (btc_storage_get_remote_addr_type((bt_bdaddr_t *)pairing_cb.bd_addr, &addr_type) != BT_STATUS_SUCCESS) { if (btc_storage_get_remote_addr_type(&bdaddr, &addr_type) != BT_STATUS_SUCCESS) {
btc_storage_set_remote_addr_type((bt_bdaddr_t *)pairing_cb.bd_addr, p_auth_cmpl->addr_type); btc_storage_set_remote_addr_type(&bdaddr, p_auth_cmpl->addr_type);
} }
btc_save_ble_bonding_keys(); btc_save_ble_bonding_keys();
@ -338,12 +341,20 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
case BTA_DM_LINK_UP_EVT: case BTA_DM_LINK_UP_EVT:
case BTA_DM_LINK_DOWN_EVT: case BTA_DM_LINK_DOWN_EVT:
case BTA_DM_HW_ERROR_EVT: case BTA_DM_HW_ERROR_EVT:
LOG_WARN( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act );
break;
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE)) #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
case BTA_DM_BLE_AUTH_CMPL_EVT: { case BTA_DM_BLE_AUTH_CMPL_EVT: {
rsp_app = true; rsp_app = true;
ble_msg.act = ESP_GAP_BLE_AUTH_CMPL_EVT; ble_msg.act = ESP_GAP_BLE_AUTH_CMPL_EVT;
memcpy(&param.ble_security.auth_cmpl, &p_data->auth_cmpl, sizeof(esp_ble_auth_cmpl_t)); param.ble_security.auth_cmpl.addr_type = p_data->auth_cmpl.addr_type;
param.ble_security.auth_cmpl.dev_type = p_data->auth_cmpl.dev_type;
param.ble_security.auth_cmpl.key_type = p_data->auth_cmpl.key_type;
param.ble_security.auth_cmpl.fail_reason = p_data->auth_cmpl.fail_reason;
param.ble_security.auth_cmpl.success = p_data->auth_cmpl.success ? true : false;
param.ble_security.auth_cmpl.key_present = p_data->auth_cmpl.key_present;
memcpy(param.ble_security.auth_cmpl.bd_addr, p_data->auth_cmpl.bd_addr, sizeof(BD_ADDR));
memcpy(param.ble_security.auth_cmpl.key, p_data->auth_cmpl.key, sizeof(LINK_KEY));
btc_dm_ble_auth_cmpl_evt(&p_data->auth_cmpl); btc_dm_ble_auth_cmpl_evt(&p_data->auth_cmpl);
break; break;
} }
@ -484,7 +495,8 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
case BTA_DM_SP_RMT_OOB_EVT: case BTA_DM_SP_RMT_OOB_EVT:
case BTA_DM_SP_KEYPRESS_EVT: case BTA_DM_SP_KEYPRESS_EVT:
case BTA_DM_ROLE_CHG_EVT: case BTA_DM_ROLE_CHG_EVT:
LOG_WARN( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act );
break;
default: default:
LOG_WARN( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act ); LOG_WARN( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act );
break; break;

Wyświetl plik

@ -396,7 +396,7 @@ void app_main()
/* set the security iocap & auth_req & key size & init key response key parameters to the stack*/ /* set the security iocap & auth_req & key size & init key response key parameters to the stack*/
esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND; //bonding with peer device after authentication esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND; //bonding with peer device after authentication
esp_ble_io_cap_t iocap = ESP_IO_CAP_IO; //set the IO capability to Output only esp_ble_io_cap_t iocap = ESP_IO_CAP_OUT; //set the IO capability to Output only
uint8_t key_size = 16; //the key size should be 7~16 bytes uint8_t key_size = 16; //the key size should be 7~16 bytes
uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK; uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK; uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;