nRF51 SDK v10.0.0
Data Structures | Typedefs | Enumerations | Functions
ID Manager

An internal module of Peer Manager. A module for keeping track of peer identities (IRK and peer address). More...

Data Structures

struct  im_evt_t
 

Typedefs

typedef void(* im_evt_handler_t )(im_evt_t const *p_event)
 Event handler for events from the ID Manager module. More...
 

Enumerations

enum  im_evt_id_t {
  IM_EVT_DUPLICATE_ID,
  IM_EVT_BONDED_PEER_CONNECTED
}
 Events that can come from the ID Manager module. More...
 

Functions

ret_code_t im_register (im_evt_handler_t evt_handler)
 Function for registering for events from the ID Manager module. More...
 
void im_ble_evt_handler (ble_evt_t *p_ble_evt)
 Function for dispatching SoftDevice events to the ID Manager module. More...
 
pm_peer_id_t im_peer_id_get_by_conn_handle (uint16_t conn_handle)
 Function for getting the corresponding peer ID from a connection handle. More...
 
pm_peer_id_t im_peer_id_get_by_master_id (ble_gap_master_id_t *p_master_id)
 Function for getting the corresponding peer ID from a master ID (EDIV and rand). More...
 
pm_peer_id_t im_peer_id_get_by_irk_match_idx (uint8_t irk_match_idx)
 Function for getting the corresponding peer ID from an IRK match index, see ble_gap_evt_connected_t. More...
 
uint16_t im_conn_handle_get (pm_peer_id_t peer_id)
 Function for getting the corresponding connection handle from a peer ID. More...
 
ret_code_t im_ble_addr_get (uint16_t conn_handle, ble_gap_addr_t *p_ble_addr)
 Function for getting the BLE address used by the peer when connecting. More...
 
bool im_master_id_is_valid (ble_gap_master_id_t const *p_master_id)
 Function for checking whether a master ID is valid or invalid. More...
 
void im_new_peer_id (uint16_t conn_handle, pm_peer_id_t peer_id)
 Function for reporting that a new peer ID has been allocated for a specified connection. More...
 
ret_code_t im_wlist_set (ble_gap_whitelist_t *p_whitelist)
 Function for informing this module of what whitelist will be used. More...
 
ret_code_t im_wlist_create (pm_peer_id_t *p_peer_ids, uint8_t n_peer_ids, ble_gap_whitelist_t *p_whitelist)
 Function for constructing a whitelist for use when advertising. More...
 
bool im_address_resolve (ble_gap_addr_t const *p_addr, ble_gap_irk_t const *p_irk)
 Function for resolving a resolvable address with an identity resolution key (IRK). More...
 

Detailed Description

An internal module of Peer Manager. A module for keeping track of peer identities (IRK and peer address).

Typedef Documentation

typedef void(* im_evt_handler_t)(im_evt_t const *p_event)

Event handler for events from the ID Manager module.

Parameters
[in]p_eventThe event that has happened.

Enumeration Type Documentation

Events that can come from the ID Manager module.

Enumerator
IM_EVT_DUPLICATE_ID 

The ID Manager module has detected that two stored peers represent the same peer.

IM_EVT_BONDED_PEER_CONNECTED 

A connected peer has been identified as one of the bonded peers. This can happen immediately on connection, or at a later time.

Function Documentation

bool im_address_resolve ( ble_gap_addr_t const *  p_addr,
ble_gap_irk_t const *  p_irk 
)

Function for resolving a resolvable address with an identity resolution key (IRK).

This function will use the ECB peripheral to resolve a resolvable address. This can be used to resolve the identity of a device distributing a random resolvable address based on any IRKs you have received earlier. If an address is resolved by an IRK, the device disributing the address must also know the IRK.

Parameters
[in]p_addrA random resolvable address.
[in]p_irkAn identity resolution key (IRK).
Return values
trueThe irk used matched the one used to create the address.
falseThe irk used did not match the one used to create the address, or an argument was NULL.
ret_code_t im_ble_addr_get ( uint16_t  conn_handle,
ble_gap_addr_t p_ble_addr 
)

Function for getting the BLE address used by the peer when connecting.

Parameters
[in]conn_handleThe connection handle.
[out]p_ble_addrThe BLE address used by the peer when the connection specified by conn_handle was established.
Return values
NRF_SUCCESSThe address was found and copied.
NRF_ERROR_INVALID_STATEModule not initialized.
BLE_ERROR_CONN_HANDLE_INVALIDconn_handle does not refer to an active connection.
NRF_ERROR_NULLp_ble_addr was NULL.
void im_ble_evt_handler ( ble_evt_t p_ble_evt)

Function for dispatching SoftDevice events to the ID Manager module.

Parameters
[in]p_ble_evtThe SoftDevice event.
uint16_t im_conn_handle_get ( pm_peer_id_t  peer_id)

Function for getting the corresponding connection handle from a peer ID.

Parameters
[in]peer_idThe peer ID.
Returns
The corresponding connection handle, or BLE_CONN_HANDLE_INVALID if none could be resolved.
bool im_master_id_is_valid ( ble_gap_master_id_t const *  p_master_id)

Function for checking whether a master ID is valid or invalid.

Parameters
[in]p_master_idThe master ID.
Return values
trueThe master id is valid.
trueThe master id is invalid (i.e. all zeros).
void im_new_peer_id ( uint16_t  conn_handle,
pm_peer_id_t  peer_id 
)

Function for reporting that a new peer ID has been allocated for a specified connection.

Parameters
[in]conn_handleThe connection.
[in]peer_idThe new peer ID.
pm_peer_id_t im_peer_id_get_by_conn_handle ( uint16_t  conn_handle)

Function for getting the corresponding peer ID from a connection handle.

Parameters
[in]conn_handleThe connection handle.
Returns
The corresponding peer ID, or PM_PEER_ID_INVALID if none could be resolved.
pm_peer_id_t im_peer_id_get_by_irk_match_idx ( uint8_t  irk_match_idx)

Function for getting the corresponding peer ID from an IRK match index, see ble_gap_evt_connected_t.

Parameters
[in]irk_match_idxThe IRK match index.
Returns
The corresponding peer ID, or PM_PEER_ID_INVALID if none could be resolved.
pm_peer_id_t im_peer_id_get_by_master_id ( ble_gap_master_id_t p_master_id)

Function for getting the corresponding peer ID from a master ID (EDIV and rand).

Parameters
[in]p_master_idThe master ID.
Returns
The corresponding peer ID, or PM_PEER_ID_INVALID if none could be resolved.
ret_code_t im_register ( im_evt_handler_t  evt_handler)

Function for registering for events from the ID Manager module.

Note
This will also initialize the module if needed.
Parameters
[in]evt_handlerCallback for events from the ID Manager module.
Return values
NRF_SUCCESSRegistration was successful.
NRF_ERROR_NO_MEMNo more registrations possible.
NRF_ERROR_NULLevt_handler was NULL.
ret_code_t im_wlist_create ( pm_peer_id_t p_peer_ids,
uint8_t  n_peer_ids,
ble_gap_whitelist_t p_whitelist 
)

Function for constructing a whitelist for use when advertising.

Note
When advertising with whitelist, always use the whitelist created/set by the most recent call to this function or to im_wlist_set, whichever happened most recently.
Do not call this function while advertising with another whitelist.
Parameters
[in]p_peer_idsThe ids of the peers to be added to the whitelist.
[in]n_peer_idsThe number of peer ids in p_peer_ids.
[in,out]p_whitelistThe constructed whitelist. Note that p_adv_whitelist->pp_addrs must be NULL or point to an array with size BLE_GAP_WHITELIST_ADDR_MAX_COUNT and p_adv_whitelist->pp_irks must be NULL or point to an array with size BLE_GAP_WHITELIST_IRK_MAX_COUNT.
Return values
NRF_SUCCESSWhitelist successfully created.
NRF_ERROR_NULLp_whitelist was NULL.
ret_code_t im_wlist_set ( ble_gap_whitelist_t p_whitelist)

Function for informing this module of what whitelist will be used.

This function is meant to be used when the app wants to use a custom whitelist. When using peer manager, this function must be used if a custom whitelist is used.

Note
When using a whitelist, always use the whitelist created/set by the most recent call to im_wlist_create or to this function, whichever happened most recently.
Do not call this function while scanning with another whitelist.
Do not add any irks to the whitelist that are not present in the bonding data of a peer in the peer database.
Parameters
[in]p_whitelistThe whitelist.
Return values
NRF_SUCCESSWhitelist successfully set.
NRF_ERROR_NULLp_whitelist was NULL.
NRF_ERROR_NOT_FOUNDOne or more of the whitelists irks was not found in the peer_database.

This document was last updated on Mon Nov 9 2015.
Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone.