BLE: Add function to set the identity address used by the controller/platform.

The function to get it has been removed as this operation is driven by the security manager.
pull/13759/head
Vincent Coubard 2020-09-16 14:02:55 +01:00
parent 5cb05958a9
commit 0b98682109
3 changed files with 30 additions and 34 deletions

View File

@ -220,21 +220,6 @@ ble_error_t PalSecurityManager::set_private_address_timeout(
return BLE_ERROR_NONE;
}
/**
* @see ::ble::PalSecurityManager::get_identity_address
*/
ble_error_t PalSecurityManager::get_identity_address(
address_t &address,
bool &public_address
)
{
// On cordio, the public address is hardcoded as the identity address.
address = address_t(HciGetBdAddr());
public_address = true;
return BLE_ERROR_NONE;
}
////////////////////////////////////////////////////////////////////////////
// Keys
//
@ -288,6 +273,17 @@ ble_error_t PalSecurityManager::set_irk(const irk_t &irk)
return BLE_ERROR_NONE;
}
ble_error_t PalSecurityManager::set_identity_address(
const address_t &address,
bool public_address
)
{
DmSecSetLocalIdentityAddr(
address.data(),
public_address ? DM_ADDR_PUBLIC : DM_ADDR_RANDOM
);
return BLE_ERROR_NONE;
}
ble_error_t PalSecurityManager::set_csrk(
const csrk_t &csrk,

View File

@ -183,11 +183,6 @@ public:
*/
ble_error_t set_private_address_timeout(uint16_t timeout_in_seconds) final;
/**
* @see ::ble::PalSecurityManager::get_identity_address
*/
ble_error_t get_identity_address(address_t &address, bool &public_address) final;
////////////////////////////////////////////////////////////////////////////
// Keys
//
@ -214,6 +209,13 @@ public:
*/
ble_error_t set_irk(const irk_t &irk) final;
/**
* @see ::ble::PalSecurityManager::set_identity_address
*/
ble_error_t set_identity_address(
const address_t &address, bool public_address
) final;
/**
* @see ::ble::PalSecurityManager::set_csrk
*/

View File

@ -761,20 +761,6 @@ public:
uint16_t timeout_in_seconds
) = 0;
/**
* Retrieve the identity address used by the controller
*
* @param address Will contain the address retrieved.
* @param public_address will be true if the address is public and false
* otherwise.
* @return BLE_ERROR_NONE On success, else an error code indicating the reason
* of the failure
*/
virtual ble_error_t get_identity_address(
address_t& address,
bool& public_address
) = 0;
////////////////////////////////////////////////////////////////////////////
// Keys
//
@ -814,6 +800,18 @@ public:
virtual ble_error_t set_irk(
const irk_t &irk
) = 0;
/**
* Set the local identity address.
*
* @param[in] address identity address of the device
* @param[in] public_address true if a public address is used and false otherwise.
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_identity_address(
const address_t &address, bool public_address
) = 0;
/**
* Set the local CSRK.
*