nRF51 SDK v10.0.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Peer Manager

A module for managing BLE bonding. This involves controlling encryption and pairing procedures as well as persistently storing different pieces of data that must be stored when bonded. More...

Modules

 GATT Cache Manager
 An internal module of Peer Manager. A module for managing persistent storing of GATT attributes.
 
 GATT Client Cache Manager
 An internal module of Peer Manager. A module for managing persistent storing of GATT attributes pertaining to the GATT client role of the local device.
 
 GATT Server Cache Manager
 An internal module of Peer Manager. A module for managing persistent storing of GATT attributes pertaining to the GATT server role of the local device.
 
 ID Manager
 An internal module of Peer Manager. A module for keeping track of peer identities (IRK and peer address).
 
 Peer Data
 An internal module of Peer Manager. This module defines the structure of the data that is managed by the Peer Manager. It also provides functions for parsing the data.
 
 Peer Data Storage
 An internal module of Peer Manager. This module provides a Peer Manager-specific API to the persistent storage.
 
 Peer Database
 An internal module of Peer Manager. A module for simple management of reading and writing of peer data into persistent storage.
 
 Peer IDs
 An internal module of Peer Manager. This module keeps track of which peer IDs are in use and which are free.
 
 Buffer
 An internal module of Peer Manager. This module provides a simple buffer.
 
 Mutex
 An internal module of Peer Manager. This module provides thread-safe mutexes.
 
 Security Dispatcher
 An internal module of Peer Manager. A module for streamlining pairing, bonding, and encryption, including flash storage of shared data.
 
 Security Manager
 An internal module of Peer Manager. A module for streamlining pairing, bonding, and encryption, including flash storage of shared data.
 

Data Structures

struct  pm_link_status_t
 Structure used to report the security status of a connection. More...
 
struct  pm_link_secured_evt_t
 Structure containing parameters specific to the PM_EVT_LINK_SECURED event. More...
 
struct  pm_sec_error_t
 Type describing all errors that can occur asynchronously when securing a link. More...
 
struct  pm_link_secure_failed_evt_t
 Structure containing parameters specific to the PM_EVT_LINK_SECURE_FAILED event. More...
 
struct  pm_peer_data_update_t
 Structure containing parameters specific to the PM_EVT_PEER_DATA_UPDATED event. More...
 
struct  pm_peer_data_update_failed_t
 Structure containing parameters specific to the PM_EVT_PEER_DATA_UPDATE_FAILED event. More...
 
struct  pm_error_unexpected_evt_t
 Structure containing parameters specific to the PM_EVT_ERROR_UNEXPECTED event. More...
 
struct  pm_evt_t
 Structure describing events from the Peer Manager module. More...
 
struct  pm_peer_data_bonding_t
 Data associated with a bond to a peer. More...
 
struct  pm_peer_data_local_gatt_db_t
 Data on a local GATT database. More...
 
struct  pm_peer_data_local_gatt_db_flash_t
 Data on a local GATT database, as formatted in flash. More...
 
struct  pm_peer_data_remote_gatt_db_t
 Data on a remote GATT database. More...
 
struct  pm_peer_data_remote_gatt_db_flash_t
 Data on a remote GATT database, as formatted in flash. More...
 
union  pm_peer_data_unit_t
 Union of all data associated with one peer. More...
 
union  pm_peer_data_unit_const_t
 Immutable version of pm_peer_data_unit_t. More...
 
union  pm_peer_data_unit_flash_t
 Data from pm_peer_data_unit_t, as mapped in flash. More...
 
struct  pm_peer_data_t
 One piece of data associated with a peer, together with the type. More...
 
struct  pm_peer_data_const_t
 Immutable version of pm_peer_data_t. More...
 
struct  pm_peer_data_flash_t
 Data from pm_peer_data_t, as mapped in flash. More...
 

Macros

#define PM_PEER_ID_INVALID   0xFFFF
 
#define PM_PEER_ID_N_AVAILABLE_IDS   256
 
#define PM_LOCAL_DB_LEN_OVERHEAD_BYTES   offsetof(pm_peer_data_local_gatt_db_flash_t, p_data)
 
#define PM_REMOTE_DB_LEN_OVERHEAD_BYTES   offsetof(pm_peer_data_remote_gatt_db_flash_t, p_data)
 

Typedefs

typedef void(* pm_evt_handler_t )(pm_evt_t const *p_event)
 Event handler for events from the Peer Manager module. More...
 
typedef uint16_t pm_peer_id_t
 Handle to uniquely identify a peer for which we have persistently stored data.
 
typedef uint32_t pm_prepare_token_t
 Typedef for type used for write prepares. Used to reserve space in flash.
 
typedef uint32_t pm_store_token_t
 Typedef for type used to hold reference to stored item in flash. this token can be used for locking and validity check.
 

Enumerations

enum  pm_evt_id_t {
  PM_EVT_BONDED_PEER_CONNECTED,
  PM_EVT_LINK_SECURED,
  PM_EVT_LINK_SECURE_FAILED,
  PM_EVT_STORAGE_FULL,
  PM_EVT_ERROR_UNEXPECTED,
  PM_EVT_PEER_DATA_UPDATED,
  PM_EVT_PEER_DATA_UPDATE_FAILED,
  PM_EVT_ERROR_LOCAL_DB_CACHE_APPLY,
  PM_EVT_LOCAL_DB_CACHE_APPLIED,
  PM_EVT_SERVICE_CHANGED_INDICATION_SENT
}
 Enum of the events that can come from the Peer Manager module. More...
 
enum  pm_error_type_t {
  PM_ERROR_TYPE_SEC_STATUS,
  PM_ERROR_TYPE_PM_SEC_ERROR
}
 The different types of errors that can cause security establishment to fail. More...
 
enum  pm_peer_data_action_t {
  PM_PEER_DATA_ACTION_UPDATE,
  PM_PEER_DATA_ACTION_CLEAR
}
 Actions that can be performed to peer data in persistent storage. More...
 
enum  pm_sec_error_code_t {
  PM_SEC_ERROR_CODE_PIN_OR_KEY_MISSING = BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING,
  PM_SEC_ERROR_CODE_MIC_FAILURE = BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE,
  PM_SEC_ERROR_SMP_TIMEOUT
}
 Errors originating from the Peer Manager module. More...
 
enum  pm_sec_procedure_t {
  PM_LINK_SECURED_PROCEDURE_ENCRYPTION,
  PM_LINK_SECURED_PROCEDURE_BONDING,
  PM_LINK_SECURED_PROCEDURE_PAIRING
}
 Enumeration describing the different procedures that can lead to an encrypted link. More...
 
enum  pm_peer_data_id_t {
  PM_PEER_DATA_ID_BONDING,
  PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING,
  PM_PEER_DATA_ID_GATT_LOCAL,
  PM_PEER_DATA_ID_GATT_REMOTE,
  PM_PEER_DATA_ID_APPLICATION,
  PM_PEER_DATA_ID_INVALID
}
 The different types of data associated with a peer.
 

Functions

ret_code_t pm_init (void)
 Function for initializing the Peer Manager. More...
 
ret_code_t pm_register (pm_evt_handler_t event_handler)
 Function for registering with the Peer Manager. More...
 
ret_code_t pm_sec_params_set (ble_gap_sec_params_t *p_sec_params)
 Function for providing pairing and bonding parameters to use for pairing procedures. More...
 
void pm_ble_evt_handler (ble_evt_t *p_ble_evt)
 Function for passing BLE events to the Peer Manager. More...
 
ret_code_t pm_link_secure (uint16_t conn_handle, bool force_repairing)
 Function for encrypting a link, and optionally establishing a bond. More...
 
ret_code_t pm_sec_params_reply (uint16_t conn_handle, ble_gap_sec_params_t *p_sec_params)
 Function for replying with desired security parameters for a specific link. More...
 
void pm_local_database_has_changed (void)
 Function for manually informing that the local database has changed. More...
 
ret_code_t pm_link_status_get (uint16_t conn_handle, pm_link_status_t *p_link_status)
 Function for getting the security status of a connection. More...
 
ret_code_t pm_wlist_create (pm_peer_id_t *p_peer_ids, uint8_t n_peer_ids, ble_gap_whitelist_t *p_whitelist)
 Function for constructing a whitelist for use when advertising. More...
 
ret_code_t pm_wlist_set (ble_gap_whitelist_t *p_whitelist)
 Function for informing this module of what whitelist will be used. More...
 
ret_code_t pm_conn_handle_get (pm_peer_id_t peer_id, uint16_t *p_conn_handle)
 Function for getting the corresponding connection handle based on the Peer ID. More...
 
ret_code_t pm_peer_id_get (uint16_t conn_handle, pm_peer_id_t *p_peer_id)
 Function for getting the corresponding peer ID based on the connection handle. More...
 
pm_peer_id_t pm_next_peer_id_get (pm_peer_id_t prev_peer_id)
 Function for getting the next peer ID in the sequence of all used peer IDs. Can be used to loop through all used peer IDs. More...
 
uint32_t pm_n_peers (void)
 Function for querying the number of valid peer IDs available (i.e the number of peers there exists data for in persistent storage). More...
 
ret_code_t pm_peer_data_get (pm_peer_id_t peer_id, pm_peer_data_id_t data_id, pm_peer_data_t *p_peer_data)
 Function for retrieving (copying out) stored data for a peer. More...
 
ret_code_t pm_peer_data_store (pm_peer_id_t peer_id, pm_peer_data_const_t *p_peer_data, pm_store_token_t *p_token)
 Function for setting/updating the stored data for a peer. More...
 
ret_code_t pm_peer_data_clear (pm_peer_id_t peer_id, pm_peer_data_id_t data_id)
 Function for deleting a peer's stored data. More...
 
ret_code_t pm_peer_new (pm_peer_data_bonding_t *p_bonding_data, pm_peer_id_t *p_new_peer_id, pm_store_token_t *p_token)
 Function for registering persistent storage for a new peer. More...
 
void pm_peer_delete (pm_peer_id_t peer_id)
 Function for freeing persistent storage for a peer. More...
 
void pm_peer_delete_all (void)
 Function for deleting all data stored for all peers. More...
 
static __INLINE uint16_t PM_N_WORDS (uint16_t n_bytes)
 
static __INLINE uint16_t PM_BONDING_DATA_N_WORDS (void)
 Function for calculating the flash size of bonding data. More...
 
static __INLINE uint16_t PM_SC_STATE_N_WORDS (void)
 Function for calculating the flash size of service changed pending state. More...
 
static __INLINE uint16_t PM_LOCAL_DB_N_WORDS (uint16_t local_db_len)
 Function for calculating the flash size of local GATT database data. More...
 
static __INLINE uint16_t PM_LOCAL_DB_LEN (uint16_t n_words)
 Function for calculating the length of a local GATT database attribute array. More...
 
static __INLINE uint16_t PM_REMOTE_DB_N_WORDS (uint16_t service_count)
 Function for calculating the flash size of remote GATT database data. More...
 
static __INLINE bool PM_PEER_DATA_ID_IS_VALID (pm_peer_data_id_t data_id)
 Macro saying whether a data_id is valid, i.e. one of the valid enum values. More...
 

Detailed Description

A module for managing BLE bonding. This involves controlling encryption and pairing procedures as well as persistently storing different pieces of data that must be stored when bonded.

The API consists of functions for configuring the pairing/encryption behavior of the device, and functions for manipulation of the stored data.

Macro Definition Documentation

#define PM_PEER_ID_INVALID   0xFFFF

Invalid value for pm_peer_id_t.

#define PM_PEER_ID_N_AVAILABLE_IDS   256

The number of available peer IDs.

Typedef Documentation

typedef void(* pm_evt_handler_t)(pm_evt_t const *p_event)

Event handler for events from the Peer Manager module.

Parameters
[in]p_eventThe event that has happened.

Enumeration Type Documentation

The different types of errors that can cause security establishment to fail.

Enumerator
PM_ERROR_TYPE_SEC_STATUS 

Error is in the range defined in GAP Security status.

PM_ERROR_TYPE_PM_SEC_ERROR 

Error is of type pm_sec_error_code_t.

Enum of the events that can come from the Peer Manager module.

Enumerator
PM_EVT_BONDED_PEER_CONNECTED 

A connected peer has been identified as one with which we have a bond.

PM_EVT_LINK_SECURED 

A link has been encrypted, either as a result of a call to pm_link_secure, or of action by the peer. The event structure contains more information about the circumstances.

PM_EVT_LINK_SECURE_FAILED 

A pairing or encryption procedure has failed. In most cases, this will mean that security is not possible on this link.

PM_EVT_STORAGE_FULL 

There is no more room for peer data in flash storage. This must be mitigated by performing a compress procedure in FDS, possibly preceded by deleting some information.

PM_EVT_ERROR_UNEXPECTED 

An operation failed with an unexpected error. The error is provided. This is possibly a fatal error.

PM_EVT_PEER_DATA_UPDATED 

A piece of peer data was stored, updated, or cleared in flash storage.

PM_EVT_PEER_DATA_UPDATE_FAILED 

A piece of peer data was attempted stored, updated, or cleared in flash storage, but failed.

PM_EVT_ERROR_LOCAL_DB_CACHE_APPLY 

The stored local database values for a peer were rejected by the SoftDevice, which means the database has changed.

PM_EVT_LOCAL_DB_CACHE_APPLIED 

The SoftDevice has been given local database values from the persistent cache, for one peer.

PM_EVT_SERVICE_CHANGED_INDICATION_SENT 

A service changed indication has been sent to and confirmed by a peer.

Actions that can be performed to peer data in persistent storage.

Enumerator
PM_PEER_DATA_ACTION_UPDATE 

Overwriting the data.

PM_PEER_DATA_ACTION_CLEAR 

Removing the data.

Errors originating from the Peer Manager module.

Enumerator
PM_SEC_ERROR_CODE_PIN_OR_KEY_MISSING 

Encryption failed because the peripheral has lost the LTK for this bond.

PM_SEC_ERROR_CODE_MIC_FAILURE 

Pairing ended with disconnection because of mismatching keys.

PM_SEC_ERROR_SMP_TIMEOUT 

Pairing/bonding could not start because an SMP timeout has already happened on this link. This means that no more pairing or bonding can happen on this link. To be able to pair or bond, the link must be disconnected and then reconnected. See Bluetooth specification 4.2 section 3.H.3.4

Enumeration describing the different procedures that can lead to an encrypted link.

Enumerator
PM_LINK_SECURED_PROCEDURE_ENCRYPTION 

Using an LTK shared during a previous bonding procedure to encrypt the link.

PM_LINK_SECURED_PROCEDURE_BONDING 

A pairing procedure, followed by a bonding procedure.

PM_LINK_SECURED_PROCEDURE_PAIRING 

A pairing procedure with no bonding.

Function Documentation

void pm_ble_evt_handler ( ble_evt_t p_ble_evt)

Function for passing BLE events to the Peer Manager.

Note
This routine should be called from BLE stack event dispatcher for the module to work as expected.
Parameters
[in]p_ble_evtBLE stack event being dispatched to the function.
static __INLINE uint16_t PM_BONDING_DATA_N_WORDS ( void  )
static

Function for calculating the flash size of bonding data.

Returns
The number of words the data will take in flash.
ret_code_t pm_conn_handle_get ( pm_peer_id_t  peer_id,
uint16_t *  p_conn_handle 
)

Function for getting the corresponding connection handle based on the Peer ID.

Parameters
[out]peer_idPeer ID.
[in]p_conn_handleCorresponding connection handle. BLE_INVALID_CONN_HANDLE if peer is not connected.
Return values
NRF_SUCCESSConnection handle retrieved successfully.
NRF_ERROR_NULLp_conn_handle was NULL.
ret_code_t pm_init ( void  )

Function for initializing the Peer Manager.

Note
FDS must be initialized before calling this function.
Return values
NRF_SUCCESSInitialization was successful.
NRF_ERROR_INVALID_STATEFDS not initialized.
NRF_ERROR_NULLp_init_params was NULL.
NRF_ERROR_INTERNALAn unexpected internal error occurred.
ret_code_t pm_link_secure ( uint16_t  conn_handle,
bool  force_repairing 
)

Function for encrypting a link, and optionally establishing a bond.

The actions taken by this function is partly dictated by the parameters given in the pm_sec_params_set.

Note
If the connection is a slave connection, this will send a security request to the master, but the master is not obligated to initiate pairing or encryption in response.
Parameters
[in]conn_handleConnection handle of the link as provided by the SoftDevice.
[in]force_repairingWhether to force a pairing procedure to happen regardless of whether an encryption key already exists. This argument is only relevant for the central role. Recommended value: false
Return values
NRF_SUCCESSSuccess.
NRF_ERROR_TIMEOUTThere has been an SMP timeout, so no more SMP operations can be performed on this link.
BLE_ERROR_INVALID_CONN_HANDLEInvalid connection handle.
NRF_ERROR_NOT_FOUNDSecurity parameters have not been set.
NRF_ERROR_INVALID_STATEModule is not initialized, or the peer is disconnected or in the process of disconnecting.
NRF_ERROR_INTERNALAn unexpected error occurred.
ret_code_t pm_link_status_get ( uint16_t  conn_handle,
pm_link_status_t p_link_status 
)

Function for getting the security status of a connection.

Parameters
[in]conn_handleConnection handle of the link as provided by the SoftDevice.
[out]p_link_statusSecurity status of the link.
Return values
NRF_SUCCESSPairing initiated successfully.
NRF_ERROR_INVALID_PARAMconn_handle is invalid or does not refer to an active connection.
NRF_ERROR_NULLp_link_status was NULL.
void pm_local_database_has_changed ( void  )

Function for manually informing that the local database has changed.

This causes a service changed indication to be sent to all bonded peers that subscribe to it.

static __INLINE uint16_t PM_LOCAL_DB_LEN ( uint16_t  n_words)
static

Function for calculating the length of a local GATT database attribute array.

Parameters
[in]n_wordsThe number of words the data takes in flash.
Returns
The length of the database attribute array.
static __INLINE uint16_t PM_LOCAL_DB_N_WORDS ( uint16_t  local_db_len)
static

Function for calculating the flash size of local GATT database data.

Parameters
[in]local_db_lenThe length of the database as reported by the SoftDevice.
Returns
The number of words the data will take in flash.
uint32_t pm_n_peers ( void  )

Function for querying the number of valid peer IDs available (i.e the number of peers there exists data for in persistent storage).

Returns
The number of valid peer IDs.
pm_peer_id_t pm_next_peer_id_get ( pm_peer_id_t  prev_peer_id)

Function for getting the next peer ID in the sequence of all used peer IDs. Can be used to loop through all used peer IDs.

Note
PM_PEER_ID_INVALID is considered to be before the first and after the last used peer ID.
The order the peer IDs are returned can be considered random.
Parameters
[in]prev_peer_idThe previous peer ID.
Returns
The next peer ID.
The first used peer ID if prev_peer_id was PM_PEER_ID_INVALID.
Return values
PM_PEER_ID_INVALIDif prev_peer_id was the last used peer ID.
ret_code_t pm_peer_data_clear ( pm_peer_id_t  peer_id,
pm_peer_data_id_t  data_id 
)

Function for deleting a peer's stored data.

Note
Clearing of data in persistent storage happens asynchronously.
Bonding data can not be cleared with on their own. Use pm_peer_delete() to delete all data for a spesified peer including bonding data.
Parameters
[in]peer_idPeer ID to clear info for.
[in]data_idWhich data to clear. Bonding data cannot be cleared, use pm_peer_delete
Return values
NRF_SUCCESSData will be cleared in persistent storage ASAP.
NRF_ERROR_INVALID_PARAMAttempted to delete bonding data or data id was invalid.
NRF_ERROR_NOT_FOUNDNothing to clear for this data for this peer ID.
NRF_ERROR_BUSYCould not process request at this time. Reattempt later.
NRF_ERROR_INVALID_STATEModule is not initialized.
ret_code_t pm_peer_data_get ( pm_peer_id_t  peer_id,
pm_peer_data_id_t  data_id,
pm_peer_data_t p_peer_data 
)

Function for retrieving (copying out) stored data for a peer.

Parameters
[in]peer_idPeer ID to get info for.
[in]data_idWhich piece of data to read.
[in,out]p_peer_dataWhere to store the data. If the data to be read has variable length, the appropriate length field needs to reflect the available buffer space. On a successful read, the length field is updated to match the length of the read data.
Return values
NRF_SUCCESSData successfully read.
NRF_ERROR_INVALID_PARAMData ID or Peer ID was invalid or unallocated.
NRF_ERROR_NULLp_peer_data contained a NULL pointer.
NRF_ERROR_NOT_FOUNDThis data was not found for this peer ID.
NRF_ERROR_DATA_SIZEThe provided buffer was not large enough.
NRF_ERROR_INVALID_STATEModule is not initialized.
static __INLINE bool PM_PEER_DATA_ID_IS_VALID ( pm_peer_data_id_t  data_id)
static

Macro saying whether a data_id is valid, i.e. one of the valid enum values.

Parameters
[in]data_idThe data_id to check.
ret_code_t pm_peer_data_store ( pm_peer_id_t  peer_id,
pm_peer_data_const_t p_peer_data,
pm_store_token_t p_token 
)

Function for setting/updating the stored data for a peer.

Note
Writing the data to persistent storage happens asynchronously.
Parameters
[in]peer_idPeer ID to get info for.
[in]p_peer_dataData to set. For values that are NULL, the stored data will not be touched.
[out]p_tokenA token identifying this particular store operation. The token can be used to identify events pertaining to this operation.
Return values
NRF_SUCCESSData will be written to persistent storage ASAP.
NRF_ERROR_NULLp_peer_data is NULL.
NRF_ERROR_NOT_FOUNDNo peer found for that peer ID.
NRF_ERROR_BUSYBonding procedure is in progress, so data integrity cannot be guaranteed.
void pm_peer_delete ( pm_peer_id_t  peer_id)

Function for freeing persistent storage for a peer.

Parameters
[in]peer_idPeer ID to be freed.
void pm_peer_delete_all ( void  )

Function for deleting all data stored for all peers.

Note
Use this only when not connected or connectable.
ret_code_t pm_peer_id_get ( uint16_t  conn_handle,
pm_peer_id_t p_peer_id 
)

Function for getting the corresponding peer ID based on the connection handle.

Parameters
[in]conn_handleConnection handle as provided by the SoftDevice.
[out]p_peer_idCorresponding peer ID.
Return values
NRF_SUCCESSPeer ID retrieved successfully.
NRF_ERROR_NULLp_peer_id was NULL.
NRF_ERROR_NOT_FOUNDNo peer ID was found for the connection handle. This means that there is no bond with the connected peer, or the conn_handle does not refer to an active connection.
ret_code_t pm_peer_new ( pm_peer_data_bonding_t p_bonding_data,
pm_peer_id_t p_new_peer_id,
pm_store_token_t p_token 
)

Function for registering persistent storage for a new peer.

Parameters
[in]p_bonding_dataThe bonding data of the new peer. This must be provided to avoid inconsistencies (duplicate entries). Must contain a public/static address or a non-zero master ID.
[out]p_new_peer_idPeer ID for the new peer, or an existing peer if a match was found.
[out]p_tokenA token identifying this particular store operation (storing the bonding data). The token can be used to identify events pertaining to this operation.
Return values
NRF_SUCCESSStore operation for bonding data started successfully.
NRF_ERROR_NULLA parameter is NULL.
NRF_ERROR_NO_MEMNo more space in persistent storage. New peer cannot be allocated.
NRF_ERROR_BUSYOperation cannot be performed at this time. Try again later.
NRF_ERROR_INVALID_PARAMBonding data is invalid.
NRF_ERROR_INVALID_STATEPeer Manager not initialized.
ret_code_t pm_register ( pm_evt_handler_t  event_handler)

Function for registering with the Peer Manager.

Parameters
[in]event_handlerCallback for events from the Peer Manager module.
Return values
NRF_SUCCESSInitialization was successful.
NRF_ERROR_INVALID_STATEPeer Manager not initialized.
NRF_ERROR_NULLp_init_params was NULL.
static __INLINE uint16_t PM_REMOTE_DB_N_WORDS ( uint16_t  service_count)
static

Function for calculating the flash size of remote GATT database data.

Parameters
[in]service_countThe number of services in the service array.
Returns
The number of words the data will take in flash.
static __INLINE uint16_t PM_SC_STATE_N_WORDS ( void  )
static

Function for calculating the flash size of service changed pending state.

Returns
The number of words the data will take in flash.
ret_code_t pm_sec_params_reply ( uint16_t  conn_handle,
ble_gap_sec_params_t p_sec_params 
)

Function for replying with desired security parameters for a specific link.

Warning
This function is not yet implemented

This function must be called if and only if a PM_EVT_SEC_PARAMS_REQ event was received. The PM_EVT_SEC_PARAMS_REQ is received only if the always_ask_for_sec_params option was set during initialization.

Parameters
[in]conn_handleThe link to set the security parameters for.
[in]p_sec_paramsThe security parameters to set for the link.
Return values
NRF_SUCCESSSuccessfully set security parameters.
BLE_ERROR_INVALID_CONN_HANDLEConnection handle does not refer to an active connection.
NRF_ERROR_FORBIDDENSecurity parameters have not been requested on this link.
NRF_ERROR_INVALID_PARAMInvalid value or combination in security parameters.
ret_code_t pm_sec_params_set ( ble_gap_sec_params_t p_sec_params)

Function for providing pairing and bonding parameters to use for pairing procedures.

Until this is called, all bonding procedures initiated by the peer will be rejected. This function can be called multiple times, even with NULL p_sec_params, in which case it will go back to rejecting all procedures.

Parameters
[in]p_sec_paramsSecurity parameters to be used for all security procedures.
Return values
NRF_SUCCESSSuccess.
NRF_ERROR_INVALID_PARAMInvalid combination of parameters.
NRF_ERROR_INVALID_STATEModule is not initialized.
NRF_ERROR_INTERNALAn unexpected internal error occurred.
ret_code_t pm_wlist_create ( pm_peer_id_t p_peer_ids,
uint8_t  n_peer_ids,
ble_gap_whitelist_t p_whitelist 
)

Function for constructing a whitelist for use when advertising.

Construct a whitelist containing the addresses and IRKs of the provided peer IDs. If p_peer_ids is NULL, the first (lowest) peer IDs will be chosen. If pp_addrs in p_whitelist is NULL, the whitelist will contain only IRKs, and vice versa.

Note
When advertising with whitelist, always use the whitelist created/set by the most recent call to this function or to im_wlist_set, whichever happened most recently.
Do not call this function while advertising with another whitelist.
Parameters
[in]p_peer_idsThe ids of the peers to be added to the whitelist.
[in]n_peer_idsThe number of peer ids in p_peer_ids.
[in,out]p_whitelistThe constructed whitelist. Note that p_adv_whitelist->pp_addrs must be NULL or point to an array with size BLE_GAP_WHITELIST_ADDR_MAX_COUNT and p_adv_whitelist->pp_irks must be NULL or point to an array with size BLE_GAP_WHITELIST_IRK_MAX_COUNT.
Return values
NRF_SUCCESSWhitelist successfully created.
NRF_ERROR_NULLp_whitelist was NULL.
ret_code_t pm_wlist_set ( ble_gap_whitelist_t p_whitelist)

Function for informing this module of what whitelist will be used.

This function is meant to be used when the app wants to use a custom whitelist. When using peer manager, this function must be used if a custom whitelist is used.

Note
When using a whitelist, always use the whitelist created/set by the most recent call to im_wlist_create or to this function, whichever happened most recently.
Do not call this function while scanning with another whitelist.
Do not add any irks to the whitelist that are not present in the bonding data of a peer in the peer database.
Parameters
[in]p_whitelistThe whitelist.
Return values
NRF_SUCCESSWhitelist successfully set.
NRF_ERROR_NULLp_whitelist was NULL.
NRF_ERROR_NOT_FOUNDOne or more of the whitelists irks was not found in the peer_database.

This document was last updated on Mon Nov 9 2015.
Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone.