expose identity address used by controller

pull/13037/head
Paul Szczeanek 2020-06-03 17:24:11 +01:00
parent d6a5bd2825
commit 94a6cac838
3 changed files with 35 additions and 0 deletions

View File

@ -967,6 +967,22 @@ public:
return impl()->set_private_address_timeout(timeout_in_seconds); return impl()->set_private_address_timeout(timeout_in_seconds);
} }
/**
* 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
*/
ble_error_t get_identity_address(
address_t& address,
bool& public_address
) {
return impl()->get_identity_address_(address, public_address);
}
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Keys // Keys
// //

View File

@ -212,6 +212,11 @@ public:
*/ */
ble_error_t set_private_address_timeout_(uint16_t timeout_in_seconds); ble_error_t set_private_address_timeout_(uint16_t timeout_in_seconds);
/**
* @see ::ble::pal::SecurityManager::get_identity_address
*/
ble_error_t get_identity_address_(address_t& address, bool& public_address);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Keys // Keys
// //

View File

@ -279,6 +279,20 @@ ble_error_t CordioSecurityManager<EventHandler>::set_private_address_timeout_(
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
/**
* @see ::ble::pal::SecurityManager::get_identity_address
*/
template <class EventHandler>
ble_error_t CordioSecurityManager<EventHandler>::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 // Keys
// //