Connection state

nRF5 SDK v17.1.0

Module for storing data on BLE connections. More...

Data Structures

struct ble_conn_state_conn_handle_list_t
Type used to present a list of conn_handles. More...

Typedefs

typedef void(* ble_conn_state_user_function_t )(uint16_t conn_handle, void *p_context)
Function to be called when a flag ID is set. See ble_conn_state_for_each_set_user_flag . More...

Enumerations

enum ble_conn_state_status_t {
BLE_CONN_STATUS_INVALID ,
BLE_CONN_STATUS_DISCONNECTED ,
BLE_CONN_STATUS_CONNECTED
}
Connection handle statuses. More...
enum ble_conn_state_user_flag_id_t {
BLE_CONN_STATE_USER_FLAG0 = 0,
BLE_CONN_STATE_USER_FLAG1 ,
BLE_CONN_STATE_USER_FLAG2 ,
BLE_CONN_STATE_USER_FLAG3 ,
BLE_CONN_STATE_USER_FLAG4 ,
BLE_CONN_STATE_USER_FLAG5 ,
BLE_CONN_STATE_USER_FLAG6 ,
BLE_CONN_STATE_USER_FLAG7 ,
BLE_CONN_STATE_USER_FLAG8 ,
BLE_CONN_STATE_USER_FLAG9 ,
BLE_CONN_STATE_USER_FLAG10 ,
BLE_CONN_STATE_USER_FLAG11 ,
BLE_CONN_STATE_USER_FLAG12 ,
BLE_CONN_STATE_USER_FLAG13 ,
BLE_CONN_STATE_USER_FLAG14 ,
BLE_CONN_STATE_USER_FLAG15 ,
BLE_CONN_STATE_USER_FLAG16 ,
BLE_CONN_STATE_USER_FLAG17 ,
BLE_CONN_STATE_USER_FLAG18 ,
BLE_CONN_STATE_USER_FLAG19 ,
BLE_CONN_STATE_USER_FLAG20 ,
BLE_CONN_STATE_USER_FLAG21 ,
BLE_CONN_STATE_USER_FLAG22 ,
BLE_CONN_STATE_USER_FLAG23 ,
BLE_CONN_STATE_USER_FLAG_INVALID
}
One ID for each user flag collection. More...

Detailed Description

Module for storing data on BLE connections.

This module stores certain states for each connection, which can be queried by connection handle. The module uses BLE events to keep the states updated.

In addition to the preprogrammed states, this module can also keep track of a number of binary user states, or user flags . These are reset to 0 for new connections, but otherwise not touched by this module.

This module uses the Atomic operations API module to make the flag operations thread-safe.

Note
A connection handle is not immediately invalidated when it is disconnected. Certain states, such as the role, can still be queried until the next time a new connection is established to any device.

Macro Definition Documentation

#define BLE_CONN_STATE_MAX_CONNECTIONS BLE_GAP_ROLE_COUNT_COMBINED_MAX

The maximum number of connections supported.

#define BLE_CONN_STATE_USER_FLAG_COUNT   24

The number of available user flags.

Typedef Documentation

typedef void(* ble_conn_state_user_function_t)(uint16_t conn_handle, void *p_context)

Function to be called when a flag ID is set. See ble_conn_state_for_each_set_user_flag .

Parameters
[in] conn_handle The connection the flag is set for.
[in] p_context Arbitrary pointer provided by the caller of ble_conn_state_for_each_set_user_flag .

Enumeration Type Documentation

Connection handle statuses.

Enumerator
BLE_CONN_STATUS_INVALID

The connection handle is invalid.

BLE_CONN_STATUS_DISCONNECTED

The connection handle refers to a connection that has been disconnected, but not yet invalidated.

BLE_CONN_STATUS_CONNECTED

The connection handle refers to an active connection.

One ID for each user flag collection.

These IDs are used to identify user flag collections in the API calls.