An internal module of Peer Manager. A module for keeping track of peer identities (IRK and peer address).
More...
An internal module of Peer Manager. A module for keeping track of peer identities (IRK and peer address).
typedef void(* im_evt_handler_t)(im_evt_t const *p_event) |
Event handler for events from the ID Manager module.
- Parameters
-
[in] | p_event | The event that has happened. |
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 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_addr | A random resolvable address. |
[in] | p_irk | An identity resolution key (IRK). |
- Return values
-
true | The irk used matched the one used to create the address. |
false | The irk used did not match the one used to create the address, or an argument was NULL. |
Function for getting the BLE address used by the peer when connecting.
- Parameters
-
[in] | conn_handle | The connection handle. |
[out] | p_ble_addr | The BLE address used by the peer when the connection specified by conn_handle was established. |
- Return values
-
NRF_SUCCESS | The address was found and copied. |
NRF_ERROR_INVALID_STATE | Module not initialized. |
BLE_ERROR_CONN_HANDLE_INVALID | conn_handle does not refer to an active connection. |
NRF_ERROR_NULL | p_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_evt | The SoftDevice event. |
Function for getting the corresponding connection handle from a peer ID.
- Parameters
-
- Returns
- The corresponding connection handle, or BLE_CONN_HANDLE_INVALID if none could be resolved.
Function for checking whether a master ID is valid or invalid.
- Parameters
-
[in] | p_master_id | The master ID. |
- Return values
-
true | The master id is valid. |
true | The 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_handle | The connection. |
[in] | peer_id | The 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_handle | The 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_idx | The IRK match index. |
- Returns
- The corresponding peer ID, or PM_PEER_ID_INVALID if none could be resolved.
Function for getting the corresponding peer ID from a master ID (EDIV and rand).
- Parameters
-
[in] | p_master_id | The master ID. |
- Returns
- The corresponding peer ID, or PM_PEER_ID_INVALID if none could be resolved.
Function for registering for events from the ID Manager module.
- Note
- This will also initialize the module if needed.
- Parameters
-
[in] | evt_handler | Callback for events from the ID Manager module. |
- Return values
-
NRF_SUCCESS | Registration was successful. |
NRF_ERROR_NO_MEM | No more registrations possible. |
NRF_ERROR_NULL | evt_handler was NULL. |
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_ids | The ids of the peers to be added to the whitelist. |
[in] | n_peer_ids | The number of peer ids in p_peer_ids. |
[in,out] | p_whitelist | The 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_SUCCESS | Whitelist successfully created. |
NRF_ERROR_NULL | p_whitelist was NULL. |
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_whitelist | The whitelist. |
- Return values
-
NRF_SUCCESS | Whitelist successfully set. |
NRF_ERROR_NULL | p_whitelist was NULL. |
NRF_ERROR_NOT_FOUND | One or more of the whitelists irks was not found in the peer_database. |