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

◆ pm_peer_new()

uint32_t pm_peer_new ( uint16_t * new_peer_id,
struct pm_peer_data_bonding * bonding_data,
uint32_t * token )

#include <peer_manager.h>

Manually add a peer to the non-volatile storage.

This function allocates a new peer ID and stores bonding data for the new peer. The bonding data is necessary to prevent ambiguity/inconsistency in peer data.

Parameters
[out]new_peer_idPeer ID for the new peer, or an existing peer if a match was found.
[in]bonding_dataThe bonding data of the new peer (must contain a public/static address or a non-zero IRK).
[out]tokenA token that identifies this particular store operation (storing the bonding data). The token can be used to identify events that pertain to this operation. This parameter can be NULL.
Return values
NRF_SUCCESSIf the store operation for bonding data was initiated successfully.
NRF_ERROR_NULLIf bonding_data or new_peer_id are NULL.
NRF_ERROR_INVALID_ADDRIf bonding_data is not word-aligned (4 bytes).
NRF_ERROR_RESOURCESIf there is not enough space in non-volatile storage.
NRF_ERROR_NO_MEMIf there are no more available peer IDs.
NRF_ERROR_BUSYIf the underlying storage is busy with other storage operations. Try again after receiving a Peer Manager event.
NRF_ERROR_INVALID_STATEIf the Peer Manager is not initialized.
NRF_ERROR_INTERNALIf an internal error occurred.