R1 code for micro:bit based train controller code, requires second micro:bit running rx code to operate - see https://meanderingpi.wordpress.com/ for more information

Fork of nrf51-sdk by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

Connection state

Connection state

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


 BLE connection state functions



Connection handle statuses.

enum  ble_conn_state_user_flag_id_t

One ID for each user flag collection.


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 Mapped flags module, with connection handles as keys and the connection states as flags.

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.

To function properly, this module must be provided with BLE events from the SoftDevice through the ble_conn_state_on_ble_evt() function. This module should be the first to receive BLE events if they are dispatched to multiple modules.

Enumeration Type Documentation

Connection handle statuses.


The connection handle is invalid.


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


The connection handle refers to an active connection.

Definition at line 70 of file ble_conn_state.h.

One ID for each user flag collection.

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

Definition at line 84 of file ble_conn_state.h.