Lancaster University fork of the Nordic nrf51-SDK repository, which actually lives on github: https://github.com/lancaster-university/nrf51-sdk
BLE connection state functions
[Connection state]
Functions | |
void | ble_conn_state_init (void) |
Function for initializing or resetting the module. | |
void | ble_conn_state_on_ble_evt (ble_evt_t *p_ble_evt) |
Function for providing BLE SoftDevice events to the connection state module. | |
bool | ble_conn_state_valid (uint16_t conn_handle) |
Function for querying whether a connection handle represents a valid connection. | |
uint8_t | ble_conn_state_role (uint16_t conn_handle) |
Function for querying the role of the local device in a connection. | |
ble_conn_state_status_t | ble_conn_state_status (uint16_t conn_handle) |
Function for querying the status of a connection. | |
bool | ble_conn_state_encrypted (uint16_t conn_handle) |
Function for querying whether a connection is encrypted. | |
bool | ble_conn_state_mitm_protected (uint16_t conn_handle) |
Function for querying whether a connection encryption is protected from Man in the Middle attacks. | |
uint32_t | ble_conn_state_n_connections (void) |
Function for querying the total number of connections. | |
uint32_t | ble_conn_state_n_centrals (void) |
Function for querying the total number of connections in which the role of the local device is BLE_GAP_ROLE_CENTRAL. | |
uint32_t | ble_conn_state_n_peripherals (void) |
Function for querying the total number of connections in which the role of the local device is BLE_GAP_ROLE_PERIPH. | |
sdk_mapped_flags_key_list_t | ble_conn_state_conn_handles (void) |
Function for obtaining a list of all connection handles for which the module has a record. | |
sdk_mapped_flags_key_list_t | ble_conn_state_central_handles (void) |
Function for obtaining a list of connection handles in which the role of the local device is BLE_GAP_ROLE_CENTRAL. | |
sdk_mapped_flags_key_list_t | ble_conn_state_periph_handles (void) |
Function for obtaining the handle for the connection in which the role of the local device is BLE_GAP_ROLE_PERIPH. | |
ble_conn_state_user_flag_id_t | ble_conn_state_user_flag_acquire (void) |
Function for obtaining exclusive access to one of the user flag collections. | |
bool | ble_conn_state_user_flag_get (uint16_t conn_handle, ble_conn_state_user_flag_id_t flag_id) |
Function for reading the value of a user flag. | |
void | ble_conn_state_user_flag_set (uint16_t conn_handle, ble_conn_state_user_flag_id_t flag_id, bool value) |
Function for setting the value of a user flag. | |
sdk_mapped_flags_t | ble_conn_state_user_flag_collection (ble_conn_state_user_flag_id_t flag_id) |
Function for getting the state of a user flag for all connection handles. |
Function Documentation
sdk_mapped_flags_key_list_t ble_conn_state_central_handles | ( | void | ) |
Function for obtaining a list of connection handles in which the role of the local device is BLE_GAP_ROLE_CENTRAL.
This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED.
- Returns:
- A list of all valid connection handles for which the module has a record and in which the role of local device is BLE_GAP_ROLE_CENTRAL.
Definition at line 343 of file ble_conn_state.c.
sdk_mapped_flags_key_list_t ble_conn_state_conn_handles | ( | void | ) |
Function for obtaining a list of all connection handles for which the module has a record.
This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED.
- Returns:
- A list of all valid connection handles for which the module has a record.
Definition at line 337 of file ble_conn_state.c.
bool ble_conn_state_encrypted | ( | uint16_t | conn_handle ) |
Function for querying whether a connection is encrypted.
- Parameters:
-
[in] conn_handle Handle of connection to get the encryption state for.
- Return values:
-
true If the connection is encrypted. false If the connection is not encrypted or conn_handle is invalid.
Definition at line 303 of file ble_conn_state.c.
void ble_conn_state_init | ( | void | ) |
Function for initializing or resetting the module.
This function sets all states to their default, removing all records of connection handles.
Definition at line 201 of file ble_conn_state.c.
bool ble_conn_state_mitm_protected | ( | uint16_t | conn_handle ) |
Function for querying whether a connection encryption is protected from Man in the Middle attacks.
- Parameters:
-
[in] conn_handle Handle of connection to get the MITM state for.
- Return values:
-
true If the connection is encrypted with MITM protection. false If the connection is not encrypted, or encryption is not MITM protected, or conn_handle is invalid.
Definition at line 311 of file ble_conn_state.c.
uint32_t ble_conn_state_n_centrals | ( | void | ) |
Function for querying the total number of connections in which the role of the local device is BLE_GAP_ROLE_CENTRAL.
- Returns:
- The number of connections in which the role of the local device is BLE_GAP_ROLE_CENTRAL.
Definition at line 325 of file ble_conn_state.c.
uint32_t ble_conn_state_n_connections | ( | void | ) |
Function for querying the total number of connections.
- Returns:
- The total number of valid connections for which the module has a record.
Definition at line 319 of file ble_conn_state.c.
uint32_t ble_conn_state_n_peripherals | ( | void | ) |
Function for querying the total number of connections in which the role of the local device is BLE_GAP_ROLE_PERIPH.
- Returns:
- The number of connections in which the role of the local device is BLE_GAP_ROLE_PERIPH.
Definition at line 331 of file ble_conn_state.c.
void ble_conn_state_on_ble_evt | ( | ble_evt_t * | p_ble_evt ) |
Function for providing BLE SoftDevice events to the connection state module.
- Parameters:
-
[in] p_ble_evt The SoftDevice event.
Definition at line 207 of file ble_conn_state.c.
sdk_mapped_flags_key_list_t ble_conn_state_periph_handles | ( | void | ) |
Function for obtaining the handle for the connection in which the role of the local device is BLE_GAP_ROLE_PERIPH.
This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED.
- Returns:
- A list of all valid connection handles for which the module has a record and in which the role of local device is BLE_GAP_ROLE_PERIPH.
Definition at line 350 of file ble_conn_state.c.
uint8_t ble_conn_state_role | ( | uint16_t | conn_handle ) |
Function for querying the role of the local device in a connection.
- Parameters:
-
[in] conn_handle Handle of the connection to get the role for.
- Returns:
- The role of the local device in the connection (see GAP Roles). If conn_handle is not valid, the function returns BLE_GAP_ROLE_INVALID.
Definition at line 266 of file ble_conn_state.c.
ble_conn_state_status_t ble_conn_state_status | ( | uint16_t | conn_handle ) |
Function for querying the status of a connection.
- Parameters:
-
[in] conn_handle Handle of the connection.
- Returns:
- The status of the connection. If conn_handle is not valid, the function returns BLE_CONN_STATE_INVALID.
Definition at line 283 of file ble_conn_state.c.
ble_conn_state_user_flag_id_t ble_conn_state_user_flag_acquire | ( | void | ) |
Function for obtaining exclusive access to one of the user flag collections.
The acquired collection contains one flag for each connection. These flags can be set and read individually for each connection.
The state of user flags will not be modified by the connection state module, except to set it to 0 for a connection when that connection is invalidated.
- Returns:
- The ID of the acquired flag, or BLE_CONN_STATE_USER_FLAG_INVALID if none are available.
Definition at line 357 of file ble_conn_state.c.
sdk_mapped_flags_t ble_conn_state_user_flag_collection | ( | ble_conn_state_user_flag_id_t | flag_id ) |
Function for getting the state of a user flag for all connection handles.
The returned collection can be used with the Mapped flags API. The returned collection is a copy, so modifying it has no effect on the conn_state module.
- Parameters:
-
[in] flag_id Which flag to get states for.
- Returns:
- The collection of flag states. The collection is always all zeros when the flag_id is unregistered.
Definition at line 403 of file ble_conn_state.c.
bool ble_conn_state_user_flag_get | ( | uint16_t | conn_handle, |
ble_conn_state_user_flag_id_t | flag_id | ||
) |
Function for reading the value of a user flag.
- Parameters:
-
[in] conn_handle Handle of connection to get the flag state for. [in] flag_id Which flag to get the state for.
- Returns:
- The state of the flag. If conn_handle is invalid, the function returns false.
Definition at line 374 of file ble_conn_state.c.
void ble_conn_state_user_flag_set | ( | uint16_t | conn_handle, |
ble_conn_state_user_flag_id_t | flag_id, | ||
bool | value | ||
) |
Function for setting the value of a user flag.
- Parameters:
-
[in] conn_handle Handle of connection to set the flag state for. [in] flag_id Which flag to set the state for. [in] value Value to set the flag state to.
Definition at line 389 of file ble_conn_state.c.
bool ble_conn_state_valid | ( | uint16_t | conn_handle ) |
Function for querying whether a connection handle represents a valid connection.
A connection might be valid and have a BLE_CONN_STATUS_DISCONNECTED status. Those connections are invalidated after a new connection occurs.
- Parameters:
-
[in] conn_handle Handle of the connection.
- Return values:
-
true If conn_handle represents a valid connection, thus a connection for which we have a record. false If conn_handle is BLE_GAP_ROLE_INVALID, or if it has never been recorded.
Definition at line 258 of file ble_conn_state.c.
Generated on Tue Jul 12 2022 15:07:15 by 1.7.2