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_event The event that has happened.
Enumeration Type Documentation
| enum im_evt_id_t |
Events that can come from the ID Manager module.
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_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.
| 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_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.
| 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_id The 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_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.
| 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_id The 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_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.
| 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_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.
| 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_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.