BLE: Add bonded device to resolving list at the end of bonding.

pull/6932/head
Vincent Coubard 2018-04-17 14:16:35 +01:00
parent ae8d5b4de1
commit 77b1903634
2 changed files with 30 additions and 14 deletions

View File

@ -400,21 +400,13 @@ private:
);
/**
* Inform the security manager of a new connection.
*
* @param[in] params information about the new connection.
* Callback invoked by the secure DB when an identity entry has been
* retrieved.
* @param identity
*/
void connection_callback(
const Gap::ConnectionCallbackParams_t* params
);
/**
* Inform the security manager that a connection ended.
*
* @param[in] params handle and reason of the disconnection.
*/
void disconnection_callback(
const Gap::DisconnectionCallbackParams_t* params
void on_security_entry_retrieved(
pal::SecurityDb::entry_handle_t entry,
const pal::SecurityEntryIdentity_t* identity
);
private:

View File

@ -864,6 +864,26 @@ void GenericSecurityManager::on_disconnected(
_db.sync();
}
void GenericSecurityManager::on_security_entry_retrieved(
pal::SecurityDb::entry_handle_t entry,
const pal::SecurityEntryIdentity_t* identity
) {
if (!identity) {
return;
}
typedef advertising_peer_address_type_t address_type_t;
_pal.add_device_to_resolving_list(
identity->identity_address_is_public ?
address_type_t::PUBLIC_ADDRESS :
address_type_t::RANDOM_ADDRESS,
identity->identity_address,
identity->irk
);
}
/* Implements ble::pal::SecurityManagerEventHandler */
////////////////////////////////////////////////////////////////////////////
@ -935,6 +955,10 @@ void GenericSecurityManager::on_pairing_completed(connection_handle_t connection
if (cb) {
// set the distribution flags in the db
_db.set_distribution_flags(cb->db_entry, *cb);
_db.get_entry_identity(
mbed::callback(this, &GenericSecurityManager::on_security_entry_retrieved),
cb->db_entry
);
}
eventHandler->pairingResult(