Nordic stack and drivers for the mbed BLE API

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more

Committer:
Vincent Coubard
Date:
Wed Sep 14 14:39:43 2016 +0100
Revision:
638:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vincent Coubard 638:c90ae1400bf2 1 /*
Vincent Coubard 638:c90ae1400bf2 2 * Copyright (c) Nordic Semiconductor ASA
Vincent Coubard 638:c90ae1400bf2 3 * All rights reserved.
Vincent Coubard 638:c90ae1400bf2 4 *
Vincent Coubard 638:c90ae1400bf2 5 * Redistribution and use in source and binary forms, with or without modification,
Vincent Coubard 638:c90ae1400bf2 6 * are permitted provided that the following conditions are met:
Vincent Coubard 638:c90ae1400bf2 7 *
Vincent Coubard 638:c90ae1400bf2 8 * 1. Redistributions of source code must retain the above copyright notice, this
Vincent Coubard 638:c90ae1400bf2 9 * list of conditions and the following disclaimer.
Vincent Coubard 638:c90ae1400bf2 10 *
Vincent Coubard 638:c90ae1400bf2 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
Vincent Coubard 638:c90ae1400bf2 12 * list of conditions and the following disclaimer in the documentation and/or
Vincent Coubard 638:c90ae1400bf2 13 * other materials provided with the distribution.
Vincent Coubard 638:c90ae1400bf2 14 *
Vincent Coubard 638:c90ae1400bf2 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
Vincent Coubard 638:c90ae1400bf2 16 * contributors to this software may be used to endorse or promote products
Vincent Coubard 638:c90ae1400bf2 17 * derived from this software without specific prior written permission.
Vincent Coubard 638:c90ae1400bf2 18 *
Vincent Coubard 638:c90ae1400bf2 19 *
Vincent Coubard 638:c90ae1400bf2 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Vincent Coubard 638:c90ae1400bf2 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Vincent Coubard 638:c90ae1400bf2 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Vincent Coubard 638:c90ae1400bf2 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
Vincent Coubard 638:c90ae1400bf2 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Vincent Coubard 638:c90ae1400bf2 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Vincent Coubard 638:c90ae1400bf2 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Vincent Coubard 638:c90ae1400bf2 27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Vincent Coubard 638:c90ae1400bf2 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Vincent Coubard 638:c90ae1400bf2 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Vincent Coubard 638:c90ae1400bf2 30 *
Vincent Coubard 638:c90ae1400bf2 31 */
Vincent Coubard 638:c90ae1400bf2 32
Vincent Coubard 638:c90ae1400bf2 33 /**
Vincent Coubard 638:c90ae1400bf2 34 * @file
Vincent Coubard 638:c90ae1400bf2 35 *
Vincent Coubard 638:c90ae1400bf2 36 * @defgroup ble_conn_state Connection state
Vincent Coubard 638:c90ae1400bf2 37 * @ingroup ble_sdk_lib
Vincent Coubard 638:c90ae1400bf2 38 * @{
Vincent Coubard 638:c90ae1400bf2 39 * @brief Module for storing data on BLE connections.
Vincent Coubard 638:c90ae1400bf2 40 *
Vincent Coubard 638:c90ae1400bf2 41 * @details This module stores certain states for each connection, which can be queried by
Vincent Coubard 638:c90ae1400bf2 42 * connection handle. The module uses BLE events to keep the states updated.
Vincent Coubard 638:c90ae1400bf2 43 *
Vincent Coubard 638:c90ae1400bf2 44 * In addition to the preprogrammed states, this module can also keep track of a number of
Vincent Coubard 638:c90ae1400bf2 45 * binary user states, or <i>user flags</i>. These are reset to 0 for new connections, but
Vincent Coubard 638:c90ae1400bf2 46 * otherwise not touched by this module.
Vincent Coubard 638:c90ae1400bf2 47 *
Vincent Coubard 638:c90ae1400bf2 48 * This module uses the @ref sdk_mapped_flags module, with connection handles as keys and
Vincent Coubard 638:c90ae1400bf2 49 * the connection states as flags.
Vincent Coubard 638:c90ae1400bf2 50 *
Vincent Coubard 638:c90ae1400bf2 51 * @note A connection handle is not immediately invalidated when it is disconnected. Certain states,
Vincent Coubard 638:c90ae1400bf2 52 * such as the role, can still be queried until the next time a new connection is established
Vincent Coubard 638:c90ae1400bf2 53 * to any device.
Vincent Coubard 638:c90ae1400bf2 54 *
Vincent Coubard 638:c90ae1400bf2 55 * To function properly, this module must be provided with BLE events from the SoftDevice
Vincent Coubard 638:c90ae1400bf2 56 * through the @ref ble_conn_state_on_ble_evt() function. This module should be the first
Vincent Coubard 638:c90ae1400bf2 57 * to receive BLE events if they are dispatched to multiple modules.
Vincent Coubard 638:c90ae1400bf2 58 */
Vincent Coubard 638:c90ae1400bf2 59
Vincent Coubard 638:c90ae1400bf2 60 #ifndef BLE_CONN_STATE_H__
Vincent Coubard 638:c90ae1400bf2 61 #define BLE_CONN_STATE_H__
Vincent Coubard 638:c90ae1400bf2 62
Vincent Coubard 638:c90ae1400bf2 63 #include <stdbool.h>
Vincent Coubard 638:c90ae1400bf2 64 #include <stdint.h>
Vincent Coubard 638:c90ae1400bf2 65 #include "nrf_ble.h"
Vincent Coubard 638:c90ae1400bf2 66 #include "sdk_mapped_flags.h"
Vincent Coubard 638:c90ae1400bf2 67
Vincent Coubard 638:c90ae1400bf2 68 /**@brief Connection handle statuses.
Vincent Coubard 638:c90ae1400bf2 69 */
Vincent Coubard 638:c90ae1400bf2 70 typedef enum
Vincent Coubard 638:c90ae1400bf2 71 {
Vincent Coubard 638:c90ae1400bf2 72 BLE_CONN_STATUS_INVALID, /**< The connection handle is invalid. */
Vincent Coubard 638:c90ae1400bf2 73 BLE_CONN_STATUS_DISCONNECTED, /**< The connection handle refers to a connection that has been disconnected, but not yet invalidated. */
Vincent Coubard 638:c90ae1400bf2 74 BLE_CONN_STATUS_CONNECTED, /**< The connection handle refers to an active connection. */
Vincent Coubard 638:c90ae1400bf2 75 } ble_conn_state_status_t;
Vincent Coubard 638:c90ae1400bf2 76
Vincent Coubard 638:c90ae1400bf2 77 #define BLE_CONN_STATE_N_USER_FLAGS 16 /**< The number of available user flags. */
Vincent Coubard 638:c90ae1400bf2 78
Vincent Coubard 638:c90ae1400bf2 79
Vincent Coubard 638:c90ae1400bf2 80 /**@brief One ID for each user flag collection.
Vincent Coubard 638:c90ae1400bf2 81 *
Vincent Coubard 638:c90ae1400bf2 82 * @details These IDs are used to identify user flag collections in the API calls.
Vincent Coubard 638:c90ae1400bf2 83 */
Vincent Coubard 638:c90ae1400bf2 84 typedef enum
Vincent Coubard 638:c90ae1400bf2 85 {
Vincent Coubard 638:c90ae1400bf2 86 BLE_CONN_STATE_USER_FLAG0 = 0,
Vincent Coubard 638:c90ae1400bf2 87 BLE_CONN_STATE_USER_FLAG1,
Vincent Coubard 638:c90ae1400bf2 88 BLE_CONN_STATE_USER_FLAG2,
Vincent Coubard 638:c90ae1400bf2 89 BLE_CONN_STATE_USER_FLAG3,
Vincent Coubard 638:c90ae1400bf2 90 BLE_CONN_STATE_USER_FLAG4,
Vincent Coubard 638:c90ae1400bf2 91 BLE_CONN_STATE_USER_FLAG5,
Vincent Coubard 638:c90ae1400bf2 92 BLE_CONN_STATE_USER_FLAG6,
Vincent Coubard 638:c90ae1400bf2 93 BLE_CONN_STATE_USER_FLAG7,
Vincent Coubard 638:c90ae1400bf2 94 BLE_CONN_STATE_USER_FLAG8,
Vincent Coubard 638:c90ae1400bf2 95 BLE_CONN_STATE_USER_FLAG9,
Vincent Coubard 638:c90ae1400bf2 96 BLE_CONN_STATE_USER_FLAG10,
Vincent Coubard 638:c90ae1400bf2 97 BLE_CONN_STATE_USER_FLAG11,
Vincent Coubard 638:c90ae1400bf2 98 BLE_CONN_STATE_USER_FLAG12,
Vincent Coubard 638:c90ae1400bf2 99 BLE_CONN_STATE_USER_FLAG13,
Vincent Coubard 638:c90ae1400bf2 100 BLE_CONN_STATE_USER_FLAG14,
Vincent Coubard 638:c90ae1400bf2 101 BLE_CONN_STATE_USER_FLAG15,
Vincent Coubard 638:c90ae1400bf2 102 BLE_CONN_STATE_USER_FLAG_INVALID,
Vincent Coubard 638:c90ae1400bf2 103 } ble_conn_state_user_flag_id_t;
Vincent Coubard 638:c90ae1400bf2 104
Vincent Coubard 638:c90ae1400bf2 105
Vincent Coubard 638:c90ae1400bf2 106 /**
Vincent Coubard 638:c90ae1400bf2 107 * @defgroup ble_conn_state_functions BLE connection state functions
Vincent Coubard 638:c90ae1400bf2 108 * @{
Vincent Coubard 638:c90ae1400bf2 109 */
Vincent Coubard 638:c90ae1400bf2 110
Vincent Coubard 638:c90ae1400bf2 111
Vincent Coubard 638:c90ae1400bf2 112 /**@brief Function for initializing or resetting the module.
Vincent Coubard 638:c90ae1400bf2 113 *
Vincent Coubard 638:c90ae1400bf2 114 * @details This function sets all states to their default, removing all records of connection handles.
Vincent Coubard 638:c90ae1400bf2 115 */
Vincent Coubard 638:c90ae1400bf2 116 void ble_conn_state_init(void);
Vincent Coubard 638:c90ae1400bf2 117
Vincent Coubard 638:c90ae1400bf2 118
Vincent Coubard 638:c90ae1400bf2 119 /**@brief Function for providing BLE SoftDevice events to the connection state module.
Vincent Coubard 638:c90ae1400bf2 120 *
Vincent Coubard 638:c90ae1400bf2 121 * @param[in] p_ble_evt The SoftDevice event.
Vincent Coubard 638:c90ae1400bf2 122 */
Vincent Coubard 638:c90ae1400bf2 123 void ble_conn_state_on_ble_evt(ble_evt_t * p_ble_evt);
Vincent Coubard 638:c90ae1400bf2 124
Vincent Coubard 638:c90ae1400bf2 125
Vincent Coubard 638:c90ae1400bf2 126 /**@brief Function for querying whether a connection handle represents a valid connection.
Vincent Coubard 638:c90ae1400bf2 127 *
Vincent Coubard 638:c90ae1400bf2 128 * @details A connection might be valid and have a BLE_CONN_STATUS_DISCONNECTED status.
Vincent Coubard 638:c90ae1400bf2 129 * Those connections are invalidated after a new connection occurs.
Vincent Coubard 638:c90ae1400bf2 130 *
Vincent Coubard 638:c90ae1400bf2 131 * @param[in] conn_handle Handle of the connection.
Vincent Coubard 638:c90ae1400bf2 132 *
Vincent Coubard 638:c90ae1400bf2 133 * @retval true If conn_handle represents a valid connection, thus a connection for which
Vincent Coubard 638:c90ae1400bf2 134 we have a record.
Vincent Coubard 638:c90ae1400bf2 135 * @retval false If conn_handle is @ref BLE_GAP_ROLE_INVALID, or if it has never been recorded.
Vincent Coubard 638:c90ae1400bf2 136 */
Vincent Coubard 638:c90ae1400bf2 137 bool ble_conn_state_valid(uint16_t conn_handle);
Vincent Coubard 638:c90ae1400bf2 138
Vincent Coubard 638:c90ae1400bf2 139
Vincent Coubard 638:c90ae1400bf2 140 /**@brief Function for querying the role of the local device in a connection.
Vincent Coubard 638:c90ae1400bf2 141 *
Vincent Coubard 638:c90ae1400bf2 142 * @param[in] conn_handle Handle of the connection to get the role for.
Vincent Coubard 638:c90ae1400bf2 143 *
Vincent Coubard 638:c90ae1400bf2 144 * @return The role of the local device in the connection (see @ref BLE_GAP_ROLES).
Vincent Coubard 638:c90ae1400bf2 145 * If conn_handle is not valid, the function returns BLE_GAP_ROLE_INVALID.
Vincent Coubard 638:c90ae1400bf2 146 */
Vincent Coubard 638:c90ae1400bf2 147 uint8_t ble_conn_state_role(uint16_t conn_handle);
Vincent Coubard 638:c90ae1400bf2 148
Vincent Coubard 638:c90ae1400bf2 149
Vincent Coubard 638:c90ae1400bf2 150 /**@brief Function for querying the status of a connection.
Vincent Coubard 638:c90ae1400bf2 151 *
Vincent Coubard 638:c90ae1400bf2 152 * @param[in] conn_handle Handle of the connection.
Vincent Coubard 638:c90ae1400bf2 153 *
Vincent Coubard 638:c90ae1400bf2 154 * @return The status of the connection.
Vincent Coubard 638:c90ae1400bf2 155 * If conn_handle is not valid, the function returns BLE_CONN_STATE_INVALID.
Vincent Coubard 638:c90ae1400bf2 156 */
Vincent Coubard 638:c90ae1400bf2 157 ble_conn_state_status_t ble_conn_state_status(uint16_t conn_handle);
Vincent Coubard 638:c90ae1400bf2 158
Vincent Coubard 638:c90ae1400bf2 159
Vincent Coubard 638:c90ae1400bf2 160 /**@brief Function for querying whether a connection is encrypted.
Vincent Coubard 638:c90ae1400bf2 161 *
Vincent Coubard 638:c90ae1400bf2 162 * @param[in] conn_handle Handle of connection to get the encryption state for.
Vincent Coubard 638:c90ae1400bf2 163 *
Vincent Coubard 638:c90ae1400bf2 164 * @retval true If the connection is encrypted.
Vincent Coubard 638:c90ae1400bf2 165 * @retval false If the connection is not encrypted or conn_handle is invalid.
Vincent Coubard 638:c90ae1400bf2 166 */
Vincent Coubard 638:c90ae1400bf2 167 bool ble_conn_state_encrypted(uint16_t conn_handle);
Vincent Coubard 638:c90ae1400bf2 168
Vincent Coubard 638:c90ae1400bf2 169
Vincent Coubard 638:c90ae1400bf2 170 /**@brief Function for querying whether a connection encryption is protected from Man in the Middle
Vincent Coubard 638:c90ae1400bf2 171 * attacks.
Vincent Coubard 638:c90ae1400bf2 172 *
Vincent Coubard 638:c90ae1400bf2 173 * @param[in] conn_handle Handle of connection to get the MITM state for.
Vincent Coubard 638:c90ae1400bf2 174 *
Vincent Coubard 638:c90ae1400bf2 175 * @retval true If the connection is encrypted with MITM protection.
Vincent Coubard 638:c90ae1400bf2 176 * @retval false If the connection is not encrypted, or encryption is not MITM protected, or
Vincent Coubard 638:c90ae1400bf2 177 * conn_handle is invalid.
Vincent Coubard 638:c90ae1400bf2 178 */
Vincent Coubard 638:c90ae1400bf2 179 bool ble_conn_state_mitm_protected(uint16_t conn_handle);
Vincent Coubard 638:c90ae1400bf2 180
Vincent Coubard 638:c90ae1400bf2 181
Vincent Coubard 638:c90ae1400bf2 182 /**@brief Function for querying the total number of connections.
Vincent Coubard 638:c90ae1400bf2 183 *
Vincent Coubard 638:c90ae1400bf2 184 * @return The total number of valid connections for which the module has a record.
Vincent Coubard 638:c90ae1400bf2 185 */
Vincent Coubard 638:c90ae1400bf2 186 uint32_t ble_conn_state_n_connections(void);
Vincent Coubard 638:c90ae1400bf2 187
Vincent Coubard 638:c90ae1400bf2 188
Vincent Coubard 638:c90ae1400bf2 189 /**@brief Function for querying the total number of connections in which the role of the local
Vincent Coubard 638:c90ae1400bf2 190 * device is @ref BLE_GAP_ROLE_CENTRAL.
Vincent Coubard 638:c90ae1400bf2 191 *
Vincent Coubard 638:c90ae1400bf2 192 * @return The number of connections in which the role of the local device is
Vincent Coubard 638:c90ae1400bf2 193 * @ref BLE_GAP_ROLE_CENTRAL.
Vincent Coubard 638:c90ae1400bf2 194 */
Vincent Coubard 638:c90ae1400bf2 195 uint32_t ble_conn_state_n_centrals(void);
Vincent Coubard 638:c90ae1400bf2 196
Vincent Coubard 638:c90ae1400bf2 197
Vincent Coubard 638:c90ae1400bf2 198 /**@brief Function for querying the total number of connections in which the role of the local
Vincent Coubard 638:c90ae1400bf2 199 * device is @ref BLE_GAP_ROLE_PERIPH.
Vincent Coubard 638:c90ae1400bf2 200 *
Vincent Coubard 638:c90ae1400bf2 201 * @return The number of connections in which the role of the local device is
Vincent Coubard 638:c90ae1400bf2 202 * @ref BLE_GAP_ROLE_PERIPH.
Vincent Coubard 638:c90ae1400bf2 203 */
Vincent Coubard 638:c90ae1400bf2 204 uint32_t ble_conn_state_n_peripherals(void);
Vincent Coubard 638:c90ae1400bf2 205
Vincent Coubard 638:c90ae1400bf2 206
Vincent Coubard 638:c90ae1400bf2 207 /**@brief Function for obtaining a list of all connection handles for which the module has a record.
Vincent Coubard 638:c90ae1400bf2 208 *
Vincent Coubard 638:c90ae1400bf2 209 * @details This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED.
Vincent Coubard 638:c90ae1400bf2 210 *
Vincent Coubard 638:c90ae1400bf2 211 * @return A list of all valid connection handles for which the module has a record.
Vincent Coubard 638:c90ae1400bf2 212 */
Vincent Coubard 638:c90ae1400bf2 213 sdk_mapped_flags_key_list_t ble_conn_state_conn_handles(void);
Vincent Coubard 638:c90ae1400bf2 214
Vincent Coubard 638:c90ae1400bf2 215
Vincent Coubard 638:c90ae1400bf2 216 /**@brief Function for obtaining a list of connection handles in which the role of the local
Vincent Coubard 638:c90ae1400bf2 217 * device is @ref BLE_GAP_ROLE_CENTRAL.
Vincent Coubard 638:c90ae1400bf2 218 *
Vincent Coubard 638:c90ae1400bf2 219 * @details This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED.
Vincent Coubard 638:c90ae1400bf2 220 *
Vincent Coubard 638:c90ae1400bf2 221 * @return A list of all valid connection handles for which the module has a record and in which
Vincent Coubard 638:c90ae1400bf2 222 * the role of local device is @ref BLE_GAP_ROLE_CENTRAL.
Vincent Coubard 638:c90ae1400bf2 223 */
Vincent Coubard 638:c90ae1400bf2 224 sdk_mapped_flags_key_list_t ble_conn_state_central_handles(void);
Vincent Coubard 638:c90ae1400bf2 225
Vincent Coubard 638:c90ae1400bf2 226
Vincent Coubard 638:c90ae1400bf2 227 /**@brief Function for obtaining the handle for the connection in which the role of the local device
Vincent Coubard 638:c90ae1400bf2 228 * is @ref BLE_GAP_ROLE_PERIPH.
Vincent Coubard 638:c90ae1400bf2 229 *
Vincent Coubard 638:c90ae1400bf2 230 * @details This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED.
Vincent Coubard 638:c90ae1400bf2 231 *
Vincent Coubard 638:c90ae1400bf2 232 * @return A list of all valid connection handles for which the module has a record and in which
Vincent Coubard 638:c90ae1400bf2 233 * the role of local device is @ref BLE_GAP_ROLE_PERIPH.
Vincent Coubard 638:c90ae1400bf2 234 */
Vincent Coubard 638:c90ae1400bf2 235 sdk_mapped_flags_key_list_t ble_conn_state_periph_handles(void);
Vincent Coubard 638:c90ae1400bf2 236
Vincent Coubard 638:c90ae1400bf2 237
Vincent Coubard 638:c90ae1400bf2 238 /**@brief Function for obtaining exclusive access to one of the user flag collections.
Vincent Coubard 638:c90ae1400bf2 239 *
Vincent Coubard 638:c90ae1400bf2 240 * @details The acquired collection contains one flag for each connection. These flags can be set
Vincent Coubard 638:c90ae1400bf2 241 * and read individually for each connection.
Vincent Coubard 638:c90ae1400bf2 242 *
Vincent Coubard 638:c90ae1400bf2 243 * The state of user flags will not be modified by the connection state module, except to
Vincent Coubard 638:c90ae1400bf2 244 * set it to 0 for a connection when that connection is invalidated.
Vincent Coubard 638:c90ae1400bf2 245 *
Vincent Coubard 638:c90ae1400bf2 246 * @return The ID of the acquired flag, or BLE_CONN_STATE_USER_FLAG_INVALID if none are available.
Vincent Coubard 638:c90ae1400bf2 247 */
Vincent Coubard 638:c90ae1400bf2 248 ble_conn_state_user_flag_id_t ble_conn_state_user_flag_acquire(void);
Vincent Coubard 638:c90ae1400bf2 249
Vincent Coubard 638:c90ae1400bf2 250
Vincent Coubard 638:c90ae1400bf2 251 /**@brief Function for reading the value of a user flag.
Vincent Coubard 638:c90ae1400bf2 252 *
Vincent Coubard 638:c90ae1400bf2 253 * @param[in] conn_handle Handle of connection to get the flag state for.
Vincent Coubard 638:c90ae1400bf2 254 * @param[in] flag_id Which flag to get the state for.
Vincent Coubard 638:c90ae1400bf2 255 *
Vincent Coubard 638:c90ae1400bf2 256 * @return The state of the flag. If conn_handle is invalid, the function returns false.
Vincent Coubard 638:c90ae1400bf2 257 */
Vincent Coubard 638:c90ae1400bf2 258 bool ble_conn_state_user_flag_get(uint16_t conn_handle, ble_conn_state_user_flag_id_t flag_id);
Vincent Coubard 638:c90ae1400bf2 259
Vincent Coubard 638:c90ae1400bf2 260
Vincent Coubard 638:c90ae1400bf2 261 /**@brief Function for setting the value of a user flag.
Vincent Coubard 638:c90ae1400bf2 262 *
Vincent Coubard 638:c90ae1400bf2 263 * @param[in] conn_handle Handle of connection to set the flag state for.
Vincent Coubard 638:c90ae1400bf2 264 * @param[in] flag_id Which flag to set the state for.
Vincent Coubard 638:c90ae1400bf2 265 * @param[in] value Value to set the flag state to.
Vincent Coubard 638:c90ae1400bf2 266 */
Vincent Coubard 638:c90ae1400bf2 267 void ble_conn_state_user_flag_set(uint16_t conn_handle,
Vincent Coubard 638:c90ae1400bf2 268 ble_conn_state_user_flag_id_t flag_id,
Vincent Coubard 638:c90ae1400bf2 269 bool value);
Vincent Coubard 638:c90ae1400bf2 270
Vincent Coubard 638:c90ae1400bf2 271
Vincent Coubard 638:c90ae1400bf2 272 /**@brief Function for getting the state of a user flag for all connection handles.
Vincent Coubard 638:c90ae1400bf2 273 *
Vincent Coubard 638:c90ae1400bf2 274 * @details The returned collection can be used with the @ref sdk_mapped_flags API. The returned
Vincent Coubard 638:c90ae1400bf2 275 * collection is a copy, so modifying it has no effect on the conn_state module.
Vincent Coubard 638:c90ae1400bf2 276 *
Vincent Coubard 638:c90ae1400bf2 277 * @param[in] flag_id Which flag to get states for.
Vincent Coubard 638:c90ae1400bf2 278 *
Vincent Coubard 638:c90ae1400bf2 279 * @return The collection of flag states. The collection is always all zeros when the flag_id is
Vincent Coubard 638:c90ae1400bf2 280 * unregistered.
Vincent Coubard 638:c90ae1400bf2 281 */
Vincent Coubard 638:c90ae1400bf2 282 sdk_mapped_flags_t ble_conn_state_user_flag_collection(ble_conn_state_user_flag_id_t flag_id);
Vincent Coubard 638:c90ae1400bf2 283
Vincent Coubard 638:c90ae1400bf2 284 /** @} */
Vincent Coubard 638:c90ae1400bf2 285 /** @} */
Vincent Coubard 638:c90ae1400bf2 286
Vincent Coubard 638:c90ae1400bf2 287 #endif /* BLE_CONN_STATE_H__ */