Skip to content

Commit 94a6cac

Browse files
expose identity address used by controller
1 parent d6a5bd2 commit 94a6cac

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

features/FEATURE_BLE/ble/pal/PalSecurityManager.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,22 @@ class SecurityManager : private mbed::NonCopyable<SecurityManager<Impl, EventHan
967967
return impl()->set_private_address_timeout(timeout_in_seconds);
968968
}
969969

970+
/**
971+
* Retrieve the identity address used by the controller
972+
*
973+
* @param address Will contain the address retrieved.
974+
* @param public_address will be true if the address is public and false
975+
* otherwise.
976+
* @return BLE_ERROR_NONE On success, else an error code indicating the reason
977+
* of the failure
978+
*/
979+
ble_error_t get_identity_address(
980+
address_t& address,
981+
bool& public_address
982+
) {
983+
return impl()->get_identity_address_(address, public_address);
984+
}
985+
970986
////////////////////////////////////////////////////////////////////////////
971987
// Keys
972988
//

features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalSecurityManager.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ class CordioSecurityManager : public ::ble::pal::SecurityManager<CordioSecurityM
212212
*/
213213
ble_error_t set_private_address_timeout_(uint16_t timeout_in_seconds);
214214

215+
/**
216+
* @see ::ble::pal::SecurityManager::get_identity_address
217+
*/
218+
ble_error_t get_identity_address_(address_t& address, bool& public_address);
219+
215220
////////////////////////////////////////////////////////////////////////////
216221
// Keys
217222
//

features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalSecurityManager.tpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,20 @@ ble_error_t CordioSecurityManager<EventHandler>::set_private_address_timeout_(
279279
return BLE_ERROR_NONE;
280280
}
281281

282+
/**
283+
* @see ::ble::pal::SecurityManager::get_identity_address
284+
*/
285+
template <class EventHandler>
286+
ble_error_t CordioSecurityManager<EventHandler>::get_identity_address_(
287+
address_t& address,
288+
bool& public_address
289+
) {
290+
// On cordio, the public address is hardcoded as the identity address.
291+
address = address_t(HciGetBdAddr());
292+
public_address = true;
293+
return BLE_ERROR_NONE;
294+
}
295+
282296
////////////////////////////////////////////////////////////////////////////
283297
// Keys
284298
//

0 commit comments

Comments
 (0)