| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functionality

The Peer Manager API exposes functions for managing link security (for example, to initiate pairing and encryption), for managing peers (for example, to manipulate data associated with bonded peers), and for managing whitelists.

# Managing link security

After a BLE connection is established by the SoftDevice, the Peer Manager is responsible for the pairing procedure and, if requested, for creating a bond.

Before a pairing procedure can be initiated, the application must configure the security parameters that are used. For example, these parameters contain the security level of the link, information if bonding should be performed, and if so, what data should be shared during bonding. See the ble_gap_sec_params_t structure for detailed information about the security parameters. You can also retrieve information about the level of security that is set on a specific link.

To encrypt traffic on a link, the application must call the pm_conn_secure function. Depending on the relationship with the peer and the configured security parameters, this function will establish an encrypted link. If a bond is established already, the stored encryption key is used. Otherwise, pairing is initiated.

# Managing peers

After a bond to a new peer is established, the Peer Manager assigns a unique peer ID to the peer and stores the bonding and GATT data in flash. The application can later read or update this data, if required, but in most cases, it should be handled exclusively by the Peer Manager.

In addition to the bonding and GATT data, the application can store application-specific data for each peer. The content, format, and size of this data is determined by the application.

The Peer Manager also provides functions to query the number of valid peer IDs and to iterate through all used peer IDs. Using this mechanism can be convenient to, for example, write application data for all peers.

If an application's GATT database changes, all peers must be informed of this change. The Peer Manager provides a function that the application should call to distribute the service changed indications.

# Managing whitelists

The Peer Manager can be used to create a whitelist that restricts which peers are allowed to connect. To construct a whitelist, you must provide a list of peer IDs. The whitelist will then contain the addresses and IRKs of the specified peers.

Note that if you include the Peer Manager in an application and want to use whitelisting, the whitelist must be created by the Peer Manager.