master missing BLE_AUTH_CMPL_EVT after restart

This commit is contained in:
wangcheng 2020-05-13 19:56:24 +08:00 committed by bot
parent 977d98cb6d
commit 049402ae8d

View file

@ -1990,9 +1990,7 @@ void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable)
} }
smp_sm_event(&smp_cb, SMP_ENCRYPTED_EVT, &encr_enable); smp_sm_event(&smp_cb, SMP_ENCRYPTED_EVT, &encr_enable);
} } else if (p_dev_rec && !p_dev_rec->role_master && !p_dev_rec->enc_init_by_we ){
else if(p_dev_rec && !p_dev_rec->enc_init_by_we){
/* /*
if enc_init_by_we is false, it means that client initiates encryption before slave calls esp_ble_set_encryption() if enc_init_by_we is false, it means that client initiates encryption before slave calls esp_ble_set_encryption()
we need initiate pairing_bda and p_cb->role then encryption, for example iPhones we need initiate pairing_bda and p_cb->role then encryption, for example iPhones
@ -2002,6 +2000,12 @@ void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable)
p_cb->role = HCI_ROLE_SLAVE; p_cb->role = HCI_ROLE_SLAVE;
p_dev_rec->enc_init_by_we = FALSE; p_dev_rec->enc_init_by_we = FALSE;
smp_sm_event(&smp_cb, SMP_ENCRYPTED_EVT, &encr_enable); smp_sm_event(&smp_cb, SMP_ENCRYPTED_EVT, &encr_enable);
} else if (p_dev_rec && p_dev_rec->role_master && p_dev_rec->enc_init_by_we){
memcpy(&smp_cb.pairing_bda[0], bda, BD_ADDR_LEN);
p_cb->state = SMP_STATE_ENCRYPTION_PENDING;
p_cb->role = HCI_ROLE_MASTER;
p_dev_rec->enc_init_by_we = FALSE;
smp_sm_event(&smp_cb, SMP_ENCRYPTED_EVT, &encr_enable);
} }
} }