nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches

◆ pm_id_addr_set()

uint32_t pm_id_addr_set ( const ble_gap_addr_t * addr)

#include <peer_manager.h>

Set the local Bluetooth identity address.

The local Bluetooth identity address is the address that identifies the device to other peers. The address type must be either BLE_GAP_ADDR_TYPE_PUBLIC or BLE_GAP_ADDR_TYPE_RANDOM_STATIC. The identity address cannot be changed while roles are running.

The SoftDevice sets a default address of type BLE_GAP_ADDR_TYPE_RANDOM_STATIC when it is enabled. This default address is a random number that is populated during the IC manufacturing process. It remains unchanged for the lifetime of each IC, but the application can use this function to assign a different identity address.

The identity address is distributed to the peer during bonding. Changing the identity address means that bonded devices might not recognize this device.

Note
The SoftDevice functions sd_ble_gap_addr_set and sd_ble_gap_privacy_set must not be called when using the Peer Manager. Use the Peer Manager equivalents instead.
Parameters
[in]addrThe GAP address to be set.
Return values
NRF_SUCCESSIf the identity address was set successfully.
NRF_ERROR_NULLIf addr is NULL.
NRF_ERROR_INVALID_ADDRIf the addr pointer is invalid.
BLE_ERROR_GAP_INVALID_BLE_ADDRIf the Bluetooth LE address is invalid.
NRF_ERROR_BUSYIf the SoftDevice was busy. Process SoftDevice events and retry.
NRF_ERROR_INVALID_STATEIf the Peer Manager is not initialized or if this function was called while advertising, scanning, or while connected.
NRF_ERROR_INTERNALIf an internal error occurred.