Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Embed: (wiki syntax)

« Back to documentation index

Peer IDs

Peer IDs
[Peer_manager]

An internal module of Peer_manager. More...

Functions

void peer_id_init (void)
 Function for initializing the module.
pm_peer_id_t peer_id_allocate (pm_peer_id_t peer_id)
 Function for claiming an unused peer ID.
void peer_id_free (pm_peer_id_t peer_id)
 Function for freeing a peer ID and clearing all data associated with it in persistent storage.
bool peer_id_is_allocated (pm_peer_id_t peer_id)
 Function for finding out whether a peer ID is in use.
pm_peer_id_t peer_id_next_id_get (pm_peer_id_t prev_peer_id)
 Function for getting the next peer ID in the sequence of all used peer IDs.
uint32_t peer_id_n_ids (void)
 Function for querying the number of valid peer IDs available.

Detailed Description

An internal module of Peer_manager.

This module keeps track of which peer IDs are in use and which are free.


Function Documentation

pm_peer_id_t peer_id_allocate ( pm_peer_id_t  peer_id )

Function for claiming an unused peer ID.

Parameters:
peer_idThe peer ID to allocate. If this is PM_PEER_ID_INVALID, the first available will be allocated.
Returns:
The allocated peer ID.
Return values:
PM_PEER_ID_INVALIDIf no peer ID could be allocated or module is not initialized.

Definition at line 65 of file peer_id.c.

void peer_id_free ( pm_peer_id_t  peer_id )

Function for freeing a peer ID and clearing all data associated with it in persistent storage.

Parameters:
[in]peer_idPeer ID to free.

Definition at line 85 of file peer_id.c.

void peer_id_init ( void   )

Function for initializing the module.

Definition at line 58 of file peer_id.c.

bool peer_id_is_allocated ( pm_peer_id_t  peer_id )

Function for finding out whether a peer ID is in use.

Parameters:
[in]peer_idThe peer ID to inquire about.
Return values:
truepeer_id is in use.
falsepeer_id is free, or the module is not initialized.

Definition at line 94 of file peer_id.c.

uint32_t peer_id_n_ids ( void   )

Function for querying the number of valid peer IDs available.

I.E the number of peers in persistent storage.

Returns:
The number of valid peer IDs, or 0 if module is not initialized.

Definition at line 119 of file peer_id.c.

pm_peer_id_t peer_id_next_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 ordinary peer ID.
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 ordinary peer ID or the module is not initialized.

Definition at line 104 of file peer_id.c.