![]() |
nRF Connect SDK Bare Metal API 2.0.99
|
| uint32_t pm_peer_rank_highest | ( | uint16_t | peer_id | ) |
#include <peer_manager.h>
Update the rank of a peer to be the highest among all stored peers.
If this function returns NRF_SUCCESS, either a PM_EVT_PEER_DATA_UPDATE_SUCCEEDED or a PM_EVT_PEER_DATA_UPDATE_FAILED event is sent with a PM_STORE_TOKEN_INVALID store token when the operation is complete. Until the operation is complete, this function returns NRF_ERROR_BUSY.
When the operation is complete, the peer is the highest ranked peer as reported by pm_peer_ranks_get.
| [in] | peer_id | The peer to rank highest. |
| NRF_SUCCESS | If the peer's rank is, or will be, updated to be highest. |
| NRF_ERROR_INVALID_PARAM | If peer_id is invalid, or doesn't exist in non-volatile storage. |
| NRF_ERROR_RESOURCES | If there is not enough space in non-volatile storage. |
| NRF_ERROR_BUSY | If the underlying storage handler is busy with other storage operations, or if a previous call to this function has not completed. Try again after receiving a Peer Manager event. |
| NRF_ERROR_INVALID_STATE | If the Peer Manager is not initialized. |
| NRF_ERROR_DATA_SIZE | If the highest rank is UINT32_MAX, so the new rank would wrap around to 0. To fix this, manually update all ranks to smaller values, while still keeping their order. |
| NRF_ERROR_INTERNAL | If an internal error occurred. |
| NRF_ERROR_NOT_SUPPORTED | If peer rank functionality has been disabled via the CONFIG_PM_PEER_RANKS Kconfig option. |