nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches
ble_conn_state.h
1/*
2 * Copyright (c) 2015 - 2025 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
25#ifndef BLE_CONN_STATE_H__
26#define BLE_CONN_STATE_H__
27
28#include <stdbool.h>
29#include <stdint.h>
30#include <ble.h>
31#include <ble_gap.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
48
50#define BLE_CONN_STATE_MAX_CONNECTIONS BLE_GAP_ROLE_COUNT_COMBINED_MAX
51
53#define BLE_CONN_STATE_USER_FLAG_INVALID CONFIG_BLE_CONN_STATE_USER_FLAG_COUNT
54
62
72typedef void (*ble_conn_state_user_function_t)(uint16_t conn_handle, void *ctx);
73
86
99bool ble_conn_state_valid(uint16_t conn_handle);
100
109uint8_t ble_conn_state_role(uint16_t conn_handle);
110
120
129bool ble_conn_state_encrypted(uint16_t conn_handle);
130
141bool ble_conn_state_mitm_protected(uint16_t conn_handle);
142
157bool ble_conn_state_lesc(uint16_t conn_handle);
158
165
174
183
193
205
217
231uint16_t ble_conn_state_conn_idx(uint16_t conn_handle);
232
246
255bool ble_conn_state_user_flag_get(uint16_t conn_handle, uint16_t flag_index);
256
264void ble_conn_state_user_flag_set(uint16_t conn_handle, uint16_t flag_index, bool value);
265
275 void *ctx);
276
286uint32_t ble_conn_state_for_each_set_user_flag(uint16_t flag_index,
287 ble_conn_state_user_function_t user_function,
288 void *ctx);
289
292#ifdef __cplusplus
293}
294#endif
295
296#endif /* BLE_CONN_STATE_H__ */
297
struct ble_conn_state_conn_handle_list ble_conn_state_central_handles(void)
Get a list of connection handles in which the role of the local device is BLE_GAP_ROLE_CENTRAL.
uint8_t ble_conn_state_role(uint16_t conn_handle)
Get the role of the local device in a connection.
int ble_conn_state_user_flag_acquire(void)
Obtain exclusive access to one of the user flag collections.
void ble_conn_state_user_flag_set(uint16_t conn_handle, uint16_t flag_index, bool value)
Set the value of a user flag.
uint16_t ble_conn_state_conn_idx(uint16_t conn_handle)
Translate a connection handle to a value that can be used as an array index.
uint32_t ble_conn_state_central_conn_count(void)
Get the total number of connections in which the role of the local device is BLE_GAP_ROLE_CENTRAL.
bool ble_conn_state_lesc(uint16_t conn_handle)
Check whether a connection was bonded using LE Secure Connections (LESC).
bool ble_conn_state_encrypted(uint16_t conn_handle)
Check whether a connection is encrypted.
void ble_conn_state_init(void)
Initialize or reset the module.
bool ble_conn_state_valid(uint16_t conn_handle)
Check whether a connection handle represents a valid connection.
uint32_t ble_conn_state_peripheral_conn_count(void)
Get the total number of connections in which the role of the local device is BLE_GAP_ROLE_PERIPH.
bool ble_conn_state_user_flag_get(uint16_t conn_handle, uint16_t flag_index)
Read the value of a user flag.
bool ble_conn_state_mitm_protected(uint16_t conn_handle)
Check whether a connection encryption is protected from Man in the Middle (MITM) attacks.
struct ble_conn_state_conn_handle_list ble_conn_state_conn_handles(void)
Get a list of all connection handles for which the module has a record.
uint32_t ble_conn_state_conn_count(void)
Get the total number of connections.
uint32_t ble_conn_state_for_each_set_user_flag(uint16_t flag_index, ble_conn_state_user_function_t user_function, void *ctx)
Run a function for each connection that has a user flag set.
struct ble_conn_state_conn_handle_list ble_conn_state_periph_handles(void)
Get the handle for the connection in which the role of the local device is BLE_GAP_ROLE_PERIPH.
uint32_t ble_conn_state_for_each_connected(ble_conn_state_user_function_t user_function, void *ctx)
Run a function for each active connection.
#define BLE_CONN_STATE_MAX_CONNECTIONS
Definition ble_conn_state.h:50
ble_conn_state_status
Connection handle statuses.
Definition ble_conn_state.h:38
@ BLE_CONN_STATUS_INVALID
Definition ble_conn_state.h:40
@ BLE_CONN_STATUS_CONNECTED
Definition ble_conn_state.h:46
@ BLE_CONN_STATUS_DISCONNECTED
Definition ble_conn_state.h:44
void(* ble_conn_state_user_function_t)(uint16_t conn_handle, void *ctx)
Function to be called when a flag ID is set.
Definition ble_conn_state.h:72
uint32_t len
Definition ble_conn_state.h:58
uint16_t conn_handles[BLE_GAP_ROLE_COUNT_COMBINED_MAX]
Definition ble_conn_state.h:60
Type used to present a list of conn_handles.
Definition ble_conn_state.h:56