nRF5 SDK v16.0.0
Architecture
peer_manager_architecture.svg
Peer Manager modules

The Peer Manager consists of the following modules:

Security Manager & Dispatcher

When the application or a connected peer device requests a secured link, the Security Manager & Dispatcher is responsible for handling the required procedure. It interfaces with the SoftDevice in creating the secured connection, stores and retrieves the exchanged keys, and manages the pairing procedure.

The module consists of two parts: the Security Manager and the Security Dispatcher. The Security Manager stores security parameters, keeps track of the current state, and coordinates the pairing procedure. The Security Dispatcher interfaces with the SoftDevice and the flash to do the actual pairing.

LESC support (optional)
You can enable support for LESC pairing by setting "PM_LESC_ENABLED" in the sdk_config.h file. In this mode, the Peer Manager handles internally all requests for Diffie-Hellman keys from the SoftDevice. When PM_LESC_ENABLED is true, it is necessary to call nrf_ble_lesc_request_handler function in the main context of the application. If there is any pending DH key request, the function will calculate the requested key and provide it to the SoftDevice.
Repeated pairing attempts protection (optional)
You can enable protection against repeated pairing attempts by setting "PM_RA_PROTECTION_ENABLED" in the sdk_config.h file. In this mode, the Peer Manager uses the timing module to keep track of peer devices that failed at the pairing procedure. Future pairing attempts from these peer devices are rejected for a certain period of time. More detailed description of peer tracking policy can be found in Bluetooth Core Specification v5.0, Vol 3, Part H, Section 2.3.6.
ID Manager

The ID Manager keeps track of connected peers and identifies them based on different kinds of IDs: the static device address, master ID, Identity Resolving Key (IRK), IRK whitelist index, and peer ID. It detects if different IDs refer to the same peer and determines which of the connected peers are bonded. When a bonded device is connected, the application can ask for the connection handle associated with the peer ID (or the other way around).

In addition, the ID Manager creates and maintains whitelists.

GATT Cache Manager
The GATT Cache Manager (with its submodules GATT Server Cache Manager and GATT Client Cache Manager) has three main tasks:
  • Store CCCD values: As required by the Bluetooth Specification, the GATT Server Cache Manager persistently stores the CCCD values for all bonded peers across connections.
  • Distribute service changed indications: When the application notifies the Peer Manager that its database has changed, the GATT Server Cache Manager sends a service changed indication to all connected peers (and to all bonded peers when they reconnect).
  • Store remote ATT databases in flash: If requested by the application, the GATT Client Cache Manager stores the remote database for all peers. This attribute caching is optional, but it reduces the required packet exchange and therefore conserves energy.
Peer Database
The Peer Database holds the stored data for all peer IDs. It provides functions to create unique peer IDs, write and read data for a specific peer ID, free a peer ID, and enumerate all existing peer IDs.
Peer Data Storage
The Peer Data Storage module is an interface between the Peer Database and the Flash Data Storage module. It is responsible for storing the peer data in flash memory. To do so, it uses the Flash Data Storage module and requires exclusive use of certain record keys and file IDs (see Restrictions on keys and IDs for more information). In addition, the Peer Data Storage module assigns peer IDs.

See Experimental: Flash Data Storage for detailed information about the Flash Data Storage module.


Documentation feedback | Developer Zone | Subscribe | Updated