Glimworm Beacons / nRF51822

Fork of nRF51822 by Nordic Semiconductor

Committer:
GlimwormBeacons
Date:
Sat Oct 10 09:19:50 2015 +0000
Revision:
448:b71e96a821de
Parent:
445:8328a7d1eac2
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 371:8f7d2137727a 1 /*
rgrover1 371:8f7d2137727a 2 * Copyright (c) Nordic Semiconductor ASA
rgrover1 371:8f7d2137727a 3 * All rights reserved.
rgrover1 371:8f7d2137727a 4 *
rgrover1 371:8f7d2137727a 5 * Redistribution and use in source and binary forms, with or without modification,
rgrover1 371:8f7d2137727a 6 * are permitted provided that the following conditions are met:
rgrover1 371:8f7d2137727a 7 *
rgrover1 371:8f7d2137727a 8 * 1. Redistributions of source code must retain the above copyright notice, this
rgrover1 371:8f7d2137727a 9 * list of conditions and the following disclaimer.
rgrover1 371:8f7d2137727a 10 *
rgrover1 371:8f7d2137727a 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
rgrover1 371:8f7d2137727a 12 * list of conditions and the following disclaimer in the documentation and/or
rgrover1 371:8f7d2137727a 13 * other materials provided with the distribution.
rgrover1 371:8f7d2137727a 14 *
rgrover1 371:8f7d2137727a 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
rgrover1 371:8f7d2137727a 16 * contributors to this software may be used to endorse or promote products
rgrover1 371:8f7d2137727a 17 * derived from this software without specific prior written permission.
rgrover1 371:8f7d2137727a 18 *
rgrover1 371:8f7d2137727a 19 *
rgrover1 371:8f7d2137727a 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
rgrover1 371:8f7d2137727a 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
rgrover1 371:8f7d2137727a 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
rgrover1 371:8f7d2137727a 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
rgrover1 371:8f7d2137727a 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
rgrover1 371:8f7d2137727a 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
rgrover1 371:8f7d2137727a 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
rgrover1 371:8f7d2137727a 27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
rgrover1 371:8f7d2137727a 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
rgrover1 371:8f7d2137727a 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
rgrover1 371:8f7d2137727a 30 *
rgrover1 371:8f7d2137727a 31 */
rgrover1 371:8f7d2137727a 32
rgrover1 371:8f7d2137727a 33 /**
rgrover1 371:8f7d2137727a 34 @addtogroup BLE_GAP Generic Access Profile (GAP)
rgrover1 371:8f7d2137727a 35 @{
rgrover1 371:8f7d2137727a 36 @brief Definitions and prototypes for the GAP interface.
rgrover1 371:8f7d2137727a 37 */
rgrover1 371:8f7d2137727a 38
rgrover1 371:8f7d2137727a 39 #ifndef BLE_GAP_H__
rgrover1 371:8f7d2137727a 40 #define BLE_GAP_H__
rgrover1 371:8f7d2137727a 41
rgrover1 371:8f7d2137727a 42 #include "ble_types.h"
rgrover1 371:8f7d2137727a 43 #include "ble_ranges.h"
rgrover1 371:8f7d2137727a 44 #include "nrf_svc.h"
rgrover1 371:8f7d2137727a 45
rgrover1 371:8f7d2137727a 46 /**@addtogroup BLE_GAP_ENUMERATIONS Enumerations
rgrover1 371:8f7d2137727a 47 * @{ */
rgrover1 371:8f7d2137727a 48
rgrover1 371:8f7d2137727a 49 /**@brief GAP API SVC numbers.
rgrover1 371:8f7d2137727a 50 */
rgrover1 371:8f7d2137727a 51 enum BLE_GAP_SVCS
rgrover1 371:8f7d2137727a 52 {
rgrover1 371:8f7d2137727a 53 SD_BLE_GAP_ADDRESS_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */
rgrover1 371:8f7d2137727a 54 SD_BLE_GAP_ADDRESS_GET, /**< Get own Bluetooth Address. */
rgrover1 371:8f7d2137727a 55 SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */
rgrover1 371:8f7d2137727a 56 SD_BLE_GAP_ADV_START, /**< Start Advertising. */
rgrover1 371:8f7d2137727a 57 SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */
rgrover1 371:8f7d2137727a 58 SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */
rgrover1 371:8f7d2137727a 59 SD_BLE_GAP_DISCONNECT, /**< Disconnect. */
rgrover1 371:8f7d2137727a 60 SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */
rgrover1 371:8f7d2137727a 61 SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */
rgrover1 371:8f7d2137727a 62 SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */
rgrover1 371:8f7d2137727a 63 SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */
rgrover1 371:8f7d2137727a 64 SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */
rgrover1 371:8f7d2137727a 65 SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */
rgrover1 371:8f7d2137727a 66 SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */
rgrover1 371:8f7d2137727a 67 SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */
rgrover1 371:8f7d2137727a 68 SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */
rgrover1 371:8f7d2137727a 69 SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */
rgrover1 371:8f7d2137727a 70 SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */
rgrover1 371:8f7d2137727a 71 SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */
rgrover1 371:8f7d2137727a 72 SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */
rgrover1 371:8f7d2137727a 73 SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */
rgrover1 371:8f7d2137727a 74 SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */
rgrover1 371:8f7d2137727a 75 SD_BLE_GAP_SCAN_START, /**< Start Scanning. */
rgrover1 371:8f7d2137727a 76 SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */
rgrover1 371:8f7d2137727a 77 SD_BLE_GAP_CONNECT, /**< Connect. */
rgrover1 371:8f7d2137727a 78 SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */
rgrover1 371:8f7d2137727a 79 SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */
rgrover1 371:8f7d2137727a 80 };
rgrover1 371:8f7d2137727a 81
rgrover1 371:8f7d2137727a 82 /**@brief GAP Event IDs.
rgrover1 371:8f7d2137727a 83 * IDs that uniquely identify an event coming from the stack to the application.
rgrover1 371:8f7d2137727a 84 */
rgrover1 371:8f7d2137727a 85 enum BLE_GAP_EVTS
rgrover1 371:8f7d2137727a 86 {
rgrover1 371:8f7d2137727a 87 BLE_GAP_EVT_CONNECTED = BLE_GAP_EVT_BASE, /**< Connection established. @ref ble_gap_evt_connected_t */
rgrover1 371:8f7d2137727a 88 BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. @ref ble_gap_evt_disconnected_t */
rgrover1 371:8f7d2137727a 89 BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. ble_gap_evt_conn_param_update_t */
rgrover1 371:8f7d2137727a 90 BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. @ref ble_gap_evt_sec_params_request_t */
rgrover1 371:8f7d2137727a 91 BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. @ref ble_gap_evt_sec_info_request_t */
rgrover1 371:8f7d2137727a 92 BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. @ref ble_gap_evt_passkey_display_t */
rgrover1 371:8f7d2137727a 93 BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. @ref ble_gap_evt_auth_key_request_t */
rgrover1 371:8f7d2137727a 94 BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. @ref ble_gap_evt_auth_status_t */
rgrover1 371:8f7d2137727a 95 BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. @ref ble_gap_evt_conn_sec_update_t */
rgrover1 371:8f7d2137727a 96 BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. @ref ble_gap_evt_timeout_t */
rgrover1 371:8f7d2137727a 97 BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. @ref ble_gap_evt_rssi_changed_t */
rgrover1 371:8f7d2137727a 98 BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. @ref ble_gap_evt_adv_report_t */
rgrover1 371:8f7d2137727a 99 BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. @ref ble_gap_evt_sec_request_t */
rgrover1 371:8f7d2137727a 100 BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. @ref ble_gap_evt_conn_param_update_request_t */
rgrover1 371:8f7d2137727a 101 BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_evt_scan_req_report_t */
rgrover1 371:8f7d2137727a 102 };
rgrover1 371:8f7d2137727a 103
rgrover1 371:8f7d2137727a 104 /**@brief GAP Option IDs.
rgrover1 371:8f7d2137727a 105 * IDs that uniquely identify a GAP option.
rgrover1 371:8f7d2137727a 106 */
rgrover1 371:8f7d2137727a 107 enum BLE_GAP_OPTS
rgrover1 371:8f7d2137727a 108 {
rgrover1 371:8f7d2137727a 109 BLE_GAP_OPT_CH_MAP = BLE_GAP_OPT_BASE, /**< Channel Map. @ref ble_gap_opt_ch_map_t */
rgrover1 371:8f7d2137727a 110 BLE_GAP_OPT_LOCAL_CONN_LATENCY, /**< Local connection latency. @ref ble_gap_opt_local_conn_latency_t */
rgrover1 371:8f7d2137727a 111 BLE_GAP_OPT_PASSKEY, /**< Set passkey. @ref ble_gap_opt_passkey_t */
rgrover1 371:8f7d2137727a 112 BLE_GAP_OPT_PRIVACY, /**< Custom privacy. @ref ble_gap_opt_privacy_t */
rgrover1 371:8f7d2137727a 113 BLE_GAP_OPT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_opt_scan_req_report_t */
rgrover1 371:8f7d2137727a 114 BLE_GAP_OPT_COMPAT_MODE /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */
rgrover1 371:8f7d2137727a 115 };
rgrover1 371:8f7d2137727a 116 /** @} */
rgrover1 371:8f7d2137727a 117
rgrover1 371:8f7d2137727a 118 /**@addtogroup BLE_GAP_DEFINES Defines
rgrover1 371:8f7d2137727a 119 * @{ */
rgrover1 371:8f7d2137727a 120
rgrover1 371:8f7d2137727a 121 /**@defgroup BLE_ERRORS_GAP SVC return values specific to GAP
rgrover1 371:8f7d2137727a 122 * @{ */
rgrover1 371:8f7d2137727a 123 #define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */
rgrover1 371:8f7d2137727a 124 #define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */
rgrover1 371:8f7d2137727a 125 #define BLE_ERROR_GAP_INVALID_BLE_ADDR (NRF_GAP_ERR_BASE + 0x002) /**< The upper two bits of the address do not correspond to the specified address type. */
rgrover1 371:8f7d2137727a 126 #define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to overwrite the whitelist while already in use by another operation. */
rgrover1 371:8f7d2137727a 127 /**@} */
rgrover1 371:8f7d2137727a 128
rgrover1 371:8f7d2137727a 129
rgrover1 371:8f7d2137727a 130 /**@defgroup BLE_GAP_ROLES GAP Roles
rgrover1 371:8f7d2137727a 131 * @note Not explicitly used in peripheral API, but will be relevant for central API.
rgrover1 371:8f7d2137727a 132 * @{ */
rgrover1 371:8f7d2137727a 133 #define BLE_GAP_ROLE_INVALID 0x0 /**< Invalid Role. */
rgrover1 371:8f7d2137727a 134 #define BLE_GAP_ROLE_PERIPH 0x1 /**< Peripheral Role. */
rgrover1 371:8f7d2137727a 135 #define BLE_GAP_ROLE_CENTRAL 0x2 /**< Central Role. */
rgrover1 371:8f7d2137727a 136 /**@} */
rgrover1 371:8f7d2137727a 137
rgrover1 371:8f7d2137727a 138
rgrover1 371:8f7d2137727a 139 /**@defgroup BLE_GAP_TIMEOUT_SOURCES GAP Timeout sources
rgrover1 371:8f7d2137727a 140 * @{ */
rgrover1 371:8f7d2137727a 141 #define BLE_GAP_TIMEOUT_SRC_ADVERTISING 0x00 /**< Advertising timeout. */
rgrover1 371:8f7d2137727a 142 #define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */
rgrover1 371:8f7d2137727a 143 #define BLE_GAP_TIMEOUT_SRC_SCAN 0x02 /**< Scanning timeout. */
rgrover1 371:8f7d2137727a 144 #define BLE_GAP_TIMEOUT_SRC_CONN 0x03 /**< Connection timeout. */
rgrover1 371:8f7d2137727a 145 /**@} */
rgrover1 371:8f7d2137727a 146
rgrover1 371:8f7d2137727a 147
rgrover1 371:8f7d2137727a 148 /**@defgroup BLE_GAP_ADDR_TYPES GAP Address types
rgrover1 371:8f7d2137727a 149 * @{ */
rgrover1 371:8f7d2137727a 150 #define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */
rgrover1 371:8f7d2137727a 151 #define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random Static address. */
rgrover1 371:8f7d2137727a 152 #define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Private Resolvable address. */
rgrover1 371:8f7d2137727a 153 #define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Private Non-Resolvable address. */
rgrover1 371:8f7d2137727a 154 /**@} */
rgrover1 371:8f7d2137727a 155
rgrover1 371:8f7d2137727a 156 /**@defgroup BLE_GAP_ADDR_CYCLE_MODES GAP Address cycle modes
rgrover1 371:8f7d2137727a 157 * @{ */
rgrover1 371:8f7d2137727a 158 #define BLE_GAP_ADDR_CYCLE_MODE_NONE 0x00 /**< Set addresses directly, no automatic address cycling. */
rgrover1 371:8f7d2137727a 159 #define BLE_GAP_ADDR_CYCLE_MODE_AUTO 0x01 /**< Automatically generate and update private addresses. */
rgrover1 371:8f7d2137727a 160 /** @} */
rgrover1 371:8f7d2137727a 161
rgrover1 371:8f7d2137727a 162 /**@brief The default interval in seconds at which a private address is refreshed when address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. */
rgrover1 371:8f7d2137727a 163 #define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (60 * 15)
rgrover1 371:8f7d2137727a 164
rgrover1 371:8f7d2137727a 165 /** @brief BLE address length. */
rgrover1 371:8f7d2137727a 166 #define BLE_GAP_ADDR_LEN 6
rgrover1 371:8f7d2137727a 167
rgrover1 371:8f7d2137727a 168
rgrover1 371:8f7d2137727a 169 /**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format
rgrover1 371:8f7d2137727a 170 * @note Found at https://www.bluetooth.org/Technical/AssignedNumbers/generic_access_profile.htm
rgrover1 371:8f7d2137727a 171 * @{ */
rgrover1 371:8f7d2137727a 172 #define BLE_GAP_AD_TYPE_FLAGS 0x01 /**< Flags for discoverability. */
rgrover1 371:8f7d2137727a 173 #define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE 0x02 /**< Partial list of 16 bit service UUIDs. */
rgrover1 371:8f7d2137727a 174 #define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE 0x03 /**< Complete list of 16 bit service UUIDs. */
rgrover1 371:8f7d2137727a 175 #define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE 0x04 /**< Partial list of 32 bit service UUIDs. */
rgrover1 371:8f7d2137727a 176 #define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE 0x05 /**< Complete list of 32 bit service UUIDs. */
rgrover1 371:8f7d2137727a 177 #define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE 0x06 /**< Partial list of 128 bit service UUIDs. */
rgrover1 371:8f7d2137727a 178 #define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE 0x07 /**< Complete list of 128 bit service UUIDs. */
rgrover1 371:8f7d2137727a 179 #define BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME 0x08 /**< Short local device name. */
rgrover1 371:8f7d2137727a 180 #define BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME 0x09 /**< Complete local device name. */
rgrover1 371:8f7d2137727a 181 #define BLE_GAP_AD_TYPE_TX_POWER_LEVEL 0x0A /**< Transmit power level. */
rgrover1 371:8f7d2137727a 182 #define BLE_GAP_AD_TYPE_CLASS_OF_DEVICE 0x0D /**< Class of device. */
rgrover1 371:8f7d2137727a 183 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C 0x0E /**< Simple Pairing Hash C. */
rgrover1 371:8f7d2137727a 184 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R 0x0F /**< Simple Pairing Randomizer R. */
rgrover1 371:8f7d2137727a 185 #define BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE 0x10 /**< Security Manager TK Value. */
rgrover1 371:8f7d2137727a 186 #define BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS 0x11 /**< Security Manager Out Of Band Flags. */
rgrover1 371:8f7d2137727a 187 #define BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 /**< Slave Connection Interval Range. */
rgrover1 371:8f7d2137727a 188 #define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT 0x14 /**< List of 16-bit Service Solicitation UUIDs. */
rgrover1 371:8f7d2137727a 189 #define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT 0x15 /**< List of 128-bit Service Solicitation UUIDs. */
rgrover1 371:8f7d2137727a 190 #define BLE_GAP_AD_TYPE_SERVICE_DATA 0x16 /**< Service Data - 16-bit UUID. */
rgrover1 371:8f7d2137727a 191 #define BLE_GAP_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 /**< Public Target Address. */
rgrover1 371:8f7d2137727a 192 #define BLE_GAP_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 /**< Random Target Address. */
rgrover1 371:8f7d2137727a 193 #define BLE_GAP_AD_TYPE_APPEARANCE 0x19 /**< Appearance. */
rgrover1 371:8f7d2137727a 194 #define BLE_GAP_AD_TYPE_ADVERTISING_INTERVAL 0x1A /**< Advertising Interval. */
rgrover1 371:8f7d2137727a 195 #define BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS 0x1B /**< LE Bluetooth Device Address. */
rgrover1 371:8f7d2137727a 196 #define BLE_GAP_AD_TYPE_LE_ROLE 0x1C /**< LE Role. */
rgrover1 371:8f7d2137727a 197 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C256 0x1D /**< Simple Pairing Hash C-256. */
rgrover1 371:8f7d2137727a 198 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256 0x1E /**< Simple Pairing Randomizer R-256. */
rgrover1 371:8f7d2137727a 199 #define BLE_GAP_AD_TYPE_SERVICE_DATA_32BIT_UUID 0x20 /**< Service Data - 32-bit UUID. */
rgrover1 371:8f7d2137727a 200 #define BLE_GAP_AD_TYPE_SERVICE_DATA_128BIT_UUID 0x21 /**< Service Data - 128-bit UUID. */
rgrover1 371:8f7d2137727a 201 #define BLE_GAP_AD_TYPE_3D_INFORMATION_DATA 0x3D /**< 3D Information Data. */
rgrover1 371:8f7d2137727a 202 #define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF /**< Manufacturer Specific Data. */
rgrover1 371:8f7d2137727a 203 /**@} */
rgrover1 371:8f7d2137727a 204
rgrover1 371:8f7d2137727a 205
rgrover1 371:8f7d2137727a 206 /**@defgroup BLE_GAP_ADV_FLAGS GAP Advertisement Flags
rgrover1 371:8f7d2137727a 207 * @{ */
rgrover1 371:8f7d2137727a 208 #define BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE (0x01) /**< LE Limited Discoverable Mode. */
rgrover1 371:8f7d2137727a 209 #define BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02) /**< LE General Discoverable Mode. */
rgrover1 371:8f7d2137727a 210 #define BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04) /**< BR/EDR not supported. */
rgrover1 371:8f7d2137727a 211 #define BLE_GAP_ADV_FLAG_LE_BR_EDR_CONTROLLER (0x08) /**< Simultaneous LE and BR/EDR, Controller. */
rgrover1 371:8f7d2137727a 212 #define BLE_GAP_ADV_FLAG_LE_BR_EDR_HOST (0x10) /**< Simultaneous LE and BR/EDR, Host. */
rgrover1 371:8f7d2137727a 213 #define BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE (BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE Limited Discoverable Mode, BR/EDR not supported. */
rgrover1 371:8f7d2137727a 214 #define BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE General Discoverable Mode, BR/EDR not supported. */
rgrover1 371:8f7d2137727a 215 /**@} */
rgrover1 371:8f7d2137727a 216
rgrover1 371:8f7d2137727a 217
rgrover1 371:8f7d2137727a 218 /**@defgroup BLE_GAP_ADV_INTERVALS GAP Advertising interval max and min
rgrover1 371:8f7d2137727a 219 * @{ */
rgrover1 371:8f7d2137727a 220 #define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */
rgrover1 371:8f7d2137727a 221 #define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */
rgrover1 371:8f7d2137727a 222 #define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */
rgrover1 371:8f7d2137727a 223 /**@} */
rgrover1 371:8f7d2137727a 224
rgrover1 371:8f7d2137727a 225
rgrover1 371:8f7d2137727a 226 /**@defgroup BLE_GAP_SCAN_INTERVALS GAP Scan interval max and min
rgrover1 371:8f7d2137727a 227 * @{ */
rgrover1 371:8f7d2137727a 228 #define BLE_GAP_SCAN_INTERVAL_MIN 0x0004 /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */
rgrover1 371:8f7d2137727a 229 #define BLE_GAP_SCAN_INTERVAL_MAX 0x4000 /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */
rgrover1 371:8f7d2137727a 230 /** @} */
rgrover1 371:8f7d2137727a 231
rgrover1 371:8f7d2137727a 232
rgrover1 371:8f7d2137727a 233 /**@defgroup BLE_GAP_SCAN_WINDOW GAP Scan window max and min
rgrover1 371:8f7d2137727a 234 * @{ */
rgrover1 371:8f7d2137727a 235 #define BLE_GAP_SCAN_WINDOW_MIN 0x0004 /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */
rgrover1 371:8f7d2137727a 236 #define BLE_GAP_SCAN_WINDOW_MAX 0x4000 /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */
rgrover1 371:8f7d2137727a 237 /** @} */
rgrover1 371:8f7d2137727a 238
rgrover1 371:8f7d2137727a 239
rgrover1 371:8f7d2137727a 240 /**@defgroup BLE_GAP_SCAN_TIMEOUT GAP Scan timeout max and min
rgrover1 371:8f7d2137727a 241 * @{ */
rgrover1 371:8f7d2137727a 242 #define BLE_GAP_SCAN_TIMEOUT_MIN 0x0001 /**< Minimum Scan timeout in seconds. */
rgrover1 371:8f7d2137727a 243 #define BLE_GAP_SCAN_TIMEOUT_MAX 0xFFFF /**< Maximum Scan timeout in seconds. */
rgrover1 371:8f7d2137727a 244 /** @} */
rgrover1 371:8f7d2137727a 245
rgrover1 371:8f7d2137727a 246
rgrover1 371:8f7d2137727a 247 /**@brief Maximum size of advertising data in octets. */
rgrover1 371:8f7d2137727a 248 #define BLE_GAP_ADV_MAX_SIZE 31
rgrover1 371:8f7d2137727a 249
rgrover1 371:8f7d2137727a 250
rgrover1 371:8f7d2137727a 251 /**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types
rgrover1 371:8f7d2137727a 252 * @{ */
rgrover1 371:8f7d2137727a 253 #define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */
rgrover1 371:8f7d2137727a 254 #define BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01 /**< Connectable directed. */
rgrover1 371:8f7d2137727a 255 #define BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 /**< Scannable undirected. */
rgrover1 371:8f7d2137727a 256 #define BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 /**< Non connectable undirected. */
rgrover1 371:8f7d2137727a 257 /**@} */
rgrover1 371:8f7d2137727a 258
rgrover1 371:8f7d2137727a 259
rgrover1 371:8f7d2137727a 260 /**@defgroup BLE_GAP_ADV_FILTER_POLICIES GAP Advertising filter policies
rgrover1 371:8f7d2137727a 261 * @{ */
rgrover1 371:8f7d2137727a 262 #define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */
rgrover1 371:8f7d2137727a 263 #define BLE_GAP_ADV_FP_FILTER_SCANREQ 0x01 /**< Filter scan requests with whitelist. */
rgrover1 371:8f7d2137727a 264 #define BLE_GAP_ADV_FP_FILTER_CONNREQ 0x02 /**< Filter connect requests with whitelist. */
rgrover1 371:8f7d2137727a 265 #define BLE_GAP_ADV_FP_FILTER_BOTH 0x03 /**< Filter both scan and connect requests with whitelist. */
rgrover1 371:8f7d2137727a 266 /**@} */
rgrover1 371:8f7d2137727a 267
rgrover1 371:8f7d2137727a 268
rgrover1 371:8f7d2137727a 269 /**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values
rgrover1 371:8f7d2137727a 270 * @{ */
rgrover1 371:8f7d2137727a 271 #define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX 180 /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */
rgrover1 371:8f7d2137727a 272 #define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED 0 /**< Unlimited advertising in general discoverable mode. */
rgrover1 371:8f7d2137727a 273 /**@} */
rgrover1 371:8f7d2137727a 274
rgrover1 371:8f7d2137727a 275
rgrover1 371:8f7d2137727a 276 /**@defgroup BLE_GAP_DISC_MODES GAP Discovery modes
rgrover1 371:8f7d2137727a 277 * @{ */
rgrover1 371:8f7d2137727a 278 #define BLE_GAP_DISC_MODE_NOT_DISCOVERABLE 0x00 /**< Not discoverable discovery Mode. */
rgrover1 371:8f7d2137727a 279 #define BLE_GAP_DISC_MODE_LIMITED 0x01 /**< Limited Discovery Mode. */
rgrover1 371:8f7d2137727a 280 #define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */
rgrover1 371:8f7d2137727a 281 /**@} */
rgrover1 371:8f7d2137727a 282
rgrover1 371:8f7d2137727a 283 /**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities
rgrover1 371:8f7d2137727a 284 * @{ */
rgrover1 371:8f7d2137727a 285 #define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */
rgrover1 371:8f7d2137727a 286 #define BLE_GAP_IO_CAPS_DISPLAY_YESNO 0x01 /**< Display and Yes/No entry. */
rgrover1 371:8f7d2137727a 287 #define BLE_GAP_IO_CAPS_KEYBOARD_ONLY 0x02 /**< Keyboard Only. */
rgrover1 371:8f7d2137727a 288 #define BLE_GAP_IO_CAPS_NONE 0x03 /**< No I/O capabilities. */
rgrover1 371:8f7d2137727a 289 #define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */
rgrover1 371:8f7d2137727a 290 /**@} */
rgrover1 371:8f7d2137727a 291
rgrover1 371:8f7d2137727a 292
rgrover1 371:8f7d2137727a 293 /**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types
rgrover1 371:8f7d2137727a 294 * @{ */
rgrover1 371:8f7d2137727a 295 #define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */
rgrover1 371:8f7d2137727a 296 #define BLE_GAP_AUTH_KEY_TYPE_PASSKEY 0x01 /**< 6-digit Passkey. */
rgrover1 371:8f7d2137727a 297 #define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */
rgrover1 371:8f7d2137727a 298 /**@} */
rgrover1 371:8f7d2137727a 299
rgrover1 371:8f7d2137727a 300 /**@defgroup BLE_GAP_SEC_STATUS GAP Security status
rgrover1 371:8f7d2137727a 301 * @{ */
rgrover1 371:8f7d2137727a 302 #define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Procedure completed with success. */
rgrover1 371:8f7d2137727a 303 #define BLE_GAP_SEC_STATUS_TIMEOUT 0x01 /**< Procedure timed out. */
rgrover1 371:8f7d2137727a 304 #define BLE_GAP_SEC_STATUS_PDU_INVALID 0x02 /**< Invalid PDU received. */
rgrover1 371:8f7d2137727a 305 #define BLE_GAP_SEC_STATUS_RFU_RANGE1_BEGIN 0x03 /**< Reserved for Future Use range #1 begin. */
rgrover1 371:8f7d2137727a 306 #define BLE_GAP_SEC_STATUS_RFU_RANGE1_END 0x80 /**< Reserved for Future Use range #1 end. */
rgrover1 371:8f7d2137727a 307 #define BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED 0x81 /**< Passkey entry failed (user cancelled or other). */
rgrover1 371:8f7d2137727a 308 #define BLE_GAP_SEC_STATUS_OOB_NOT_AVAILABLE 0x82 /**< Out of Band Key not available. */
rgrover1 371:8f7d2137727a 309 #define BLE_GAP_SEC_STATUS_AUTH_REQ 0x83 /**< Authentication requirements not met. */
rgrover1 371:8f7d2137727a 310 #define BLE_GAP_SEC_STATUS_CONFIRM_VALUE 0x84 /**< Confirm value failed. */
rgrover1 371:8f7d2137727a 311 #define BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP 0x85 /**< Pairing not supported. */
rgrover1 371:8f7d2137727a 312 #define BLE_GAP_SEC_STATUS_ENC_KEY_SIZE 0x86 /**< Encryption key size. */
rgrover1 371:8f7d2137727a 313 #define BLE_GAP_SEC_STATUS_SMP_CMD_UNSUPPORTED 0x87 /**< Unsupported SMP command. */
rgrover1 371:8f7d2137727a 314 #define BLE_GAP_SEC_STATUS_UNSPECIFIED 0x88 /**< Unspecified reason. */
rgrover1 371:8f7d2137727a 315 #define BLE_GAP_SEC_STATUS_REPEATED_ATTEMPTS 0x89 /**< Too little time elapsed since last attempt. */
rgrover1 371:8f7d2137727a 316 #define BLE_GAP_SEC_STATUS_INVALID_PARAMS 0x8A /**< Invalid parameters. */
rgrover1 371:8f7d2137727a 317 #define BLE_GAP_SEC_STATUS_RFU_RANGE2_BEGIN 0x8B /**< Reserved for Future Use range #2 begin. */
rgrover1 371:8f7d2137727a 318 #define BLE_GAP_SEC_STATUS_RFU_RANGE2_END 0xFF /**< Reserved for Future Use range #2 end. */
rgrover1 371:8f7d2137727a 319 /**@} */
rgrover1 371:8f7d2137727a 320
rgrover1 371:8f7d2137727a 321 /**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources
rgrover1 371:8f7d2137727a 322 * @{ */
rgrover1 371:8f7d2137727a 323 #define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */
rgrover1 371:8f7d2137727a 324 #define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */
rgrover1 371:8f7d2137727a 325 /**@} */
rgrover1 371:8f7d2137727a 326
rgrover1 371:8f7d2137727a 327 /**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits
rgrover1 371:8f7d2137727a 328 * @{ */
rgrover1 371:8f7d2137727a 329 #define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connction interval specified in connect parameters. */
rgrover1 371:8f7d2137727a 330 #define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest mimimum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */
rgrover1 371:8f7d2137727a 331 #define BLE_GAP_CP_MIN_CONN_INTVL_MAX 0x0C80 /**< Highest minimum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */
rgrover1 371:8f7d2137727a 332 #define BLE_GAP_CP_MAX_CONN_INTVL_NONE 0xFFFF /**< No new maximum connction interval specified in connect parameters. */
rgrover1 371:8f7d2137727a 333 #define BLE_GAP_CP_MAX_CONN_INTVL_MIN 0x0006 /**< Lowest maximum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */
rgrover1 371:8f7d2137727a 334 #define BLE_GAP_CP_MAX_CONN_INTVL_MAX 0x0C80 /**< Highest maximum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */
rgrover1 371:8f7d2137727a 335 #define BLE_GAP_CP_SLAVE_LATENCY_MAX 0x01F3 /**< Highest slave latency permitted, in connection events. */
rgrover1 371:8f7d2137727a 336 #define BLE_GAP_CP_CONN_SUP_TIMEOUT_NONE 0xFFFF /**< No new supervision timeout specified in connect parameters. */
rgrover1 371:8f7d2137727a 337 #define BLE_GAP_CP_CONN_SUP_TIMEOUT_MIN 0x000A /**< Lowest supervision timeout permitted, in units of 10 ms, i.e. 100 ms. */
rgrover1 371:8f7d2137727a 338 #define BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX 0x0C80 /**< Highest supervision timeout permitted, in units of 10 ms, i.e. 32 s. */
rgrover1 371:8f7d2137727a 339 /**@} */
rgrover1 371:8f7d2137727a 340
rgrover1 371:8f7d2137727a 341
rgrover1 371:8f7d2137727a 342 /**@brief GAP device name maximum length. */
rgrover1 371:8f7d2137727a 343 #define BLE_GAP_DEVNAME_MAX_LEN 31
rgrover1 371:8f7d2137727a 344
rgrover1 371:8f7d2137727a 345 /**@brief Disable RSSI events for connections */
rgrover1 371:8f7d2137727a 346 #define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF
rgrover1 371:8f7d2137727a 347
rgrover1 371:8f7d2137727a 348 /**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters
rgrover1 371:8f7d2137727a 349 *
rgrover1 371:8f7d2137727a 350 * See @ref ble_gap_conn_sec_mode_t.
rgrover1 371:8f7d2137727a 351 * @{ */
rgrover1 371:8f7d2137727a 352 /**@brief Set sec_mode pointed to by ptr to have no access rights.*/
rgrover1 371:8f7d2137727a 353 #define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr) do {(ptr)->sm = 0; (ptr)->lv = 0;} while(0)
rgrover1 371:8f7d2137727a 354 /**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/
rgrover1 371:8f7d2137727a 355 #define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr) do {(ptr)->sm = 1; (ptr)->lv = 1;} while(0)
rgrover1 371:8f7d2137727a 356 /**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/
rgrover1 371:8f7d2137727a 357 #define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 2;} while(0)
rgrover1 371:8f7d2137727a 358 /**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/
rgrover1 371:8f7d2137727a 359 #define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 3;} while(0)
rgrover1 371:8f7d2137727a 360 /**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/
rgrover1 371:8f7d2137727a 361 #define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 1;} while(0)
rgrover1 371:8f7d2137727a 362 /**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/
rgrover1 371:8f7d2137727a 363 #define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 2;} while(0)
rgrover1 371:8f7d2137727a 364 /**@} */
rgrover1 371:8f7d2137727a 365
rgrover1 371:8f7d2137727a 366
rgrover1 371:8f7d2137727a 367 /**@brief GAP Security Random Number Length. */
rgrover1 371:8f7d2137727a 368 #define BLE_GAP_SEC_RAND_LEN 8
rgrover1 371:8f7d2137727a 369
rgrover1 371:8f7d2137727a 370 /**@brief GAP Security Key Length. */
rgrover1 371:8f7d2137727a 371 #define BLE_GAP_SEC_KEY_LEN 16
rgrover1 371:8f7d2137727a 372
rgrover1 371:8f7d2137727a 373 /**@brief GAP Passkey Length. */
rgrover1 371:8f7d2137727a 374 #define BLE_GAP_PASSKEY_LEN 6
rgrover1 371:8f7d2137727a 375
rgrover1 371:8f7d2137727a 376 /**@brief Maximum amount of addresses in a whitelist. */
rgrover1 371:8f7d2137727a 377 #define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8)
rgrover1 371:8f7d2137727a 378
rgrover1 371:8f7d2137727a 379 /**@brief Maximum amount of IRKs in a whitelist.
rgrover1 371:8f7d2137727a 380 * @note The number of IRKs is limited to 8, even if the hardware supports more.
rgrover1 371:8f7d2137727a 381 */
rgrover1 371:8f7d2137727a 382 #define BLE_GAP_WHITELIST_IRK_MAX_COUNT (8)
rgrover1 371:8f7d2137727a 383
rgrover1 371:8f7d2137727a 384 /**@defgroup GAP_SEC_MODES GAP Security Modes
rgrover1 371:8f7d2137727a 385 * @{ */
rgrover1 371:8f7d2137727a 386 #define BLE_GAP_SEC_MODE 0x00 /**< No key (may be used to reject). */
rgrover1 371:8f7d2137727a 387 /**@} */
rgrover1 371:8f7d2137727a 388
rgrover1 371:8f7d2137727a 389 /**@} */
rgrover1 371:8f7d2137727a 390
rgrover1 371:8f7d2137727a 391 /**@addtogroup BLE_GAP_STRUCTURES Structures
rgrover1 371:8f7d2137727a 392 * @{ */
rgrover1 371:8f7d2137727a 393
rgrover1 371:8f7d2137727a 394 /**@brief Bluetooth Low Energy address. */
rgrover1 371:8f7d2137727a 395 typedef struct
rgrover1 371:8f7d2137727a 396 {
rgrover1 371:8f7d2137727a 397 uint8_t addr_type; /**< See @ref BLE_GAP_ADDR_TYPES. */
rgrover1 371:8f7d2137727a 398 uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */
rgrover1 371:8f7d2137727a 399 } ble_gap_addr_t;
rgrover1 371:8f7d2137727a 400
rgrover1 371:8f7d2137727a 401
rgrover1 371:8f7d2137727a 402 /**@brief GAP connection parameters.
rgrover1 371:8f7d2137727a 403 *
rgrover1 371:8f7d2137727a 404 * @note When ble_conn_params_t is received in an event, both min_conn_interval and
rgrover1 371:8f7d2137727a 405 * max_conn_interval will be equal to the connection interval set by the central.
rgrover1 371:8f7d2137727a 406 *
rgrover1 371:8f7d2137727a 407 * @note If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies:
rgrover1 371:8f7d2137727a 408 * conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval
rgrover1 371:8f7d2137727a 409 * that corresponds to the following Bluetooth Spec requirement:
rgrover1 371:8f7d2137727a 410 * The Supervision_Timeout in milliseconds shall be larger than
rgrover1 371:8f7d2137727a 411 * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds.
rgrover1 371:8f7d2137727a 412 */
rgrover1 371:8f7d2137727a 413 typedef struct
rgrover1 371:8f7d2137727a 414 {
rgrover1 371:8f7d2137727a 415 uint16_t min_conn_interval; /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/
rgrover1 371:8f7d2137727a 416 uint16_t max_conn_interval; /**< Maximum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/
rgrover1 371:8f7d2137727a 417 uint16_t slave_latency; /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/
rgrover1 371:8f7d2137727a 418 uint16_t conn_sup_timeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/
rgrover1 371:8f7d2137727a 419 } ble_gap_conn_params_t;
rgrover1 371:8f7d2137727a 420
rgrover1 371:8f7d2137727a 421
rgrover1 371:8f7d2137727a 422 /**@brief GAP connection security modes.
rgrover1 371:8f7d2137727a 423 *
rgrover1 371:8f7d2137727a 424 * Security Mode 0 Level 0: No access permissions at all (this level is not defined by the Bluetooth Core specification).\n
rgrover1 371:8f7d2137727a 425 * Security Mode 1 Level 1: No security is needed (aka open link).\n
rgrover1 371:8f7d2137727a 426 * Security Mode 1 Level 2: Encrypted link required, MITM protection not necessary.\n
rgrover1 371:8f7d2137727a 427 * Security Mode 1 Level 3: MITM protected encrypted link required.\n
rgrover1 371:8f7d2137727a 428 * Security Mode 2 Level 1: Signing or encryption required, MITM protection not necessary.\n
rgrover1 371:8f7d2137727a 429 * Security Mode 2 Level 2: MITM protected signing required, unless link is MITM protected encrypted.\n
rgrover1 371:8f7d2137727a 430 */
rgrover1 371:8f7d2137727a 431 typedef struct
rgrover1 371:8f7d2137727a 432 {
rgrover1 371:8f7d2137727a 433 uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */
rgrover1 371:8f7d2137727a 434 uint8_t lv : 4; /**< Level (1, 2 or 3), 0 for no permissions at all. */
rgrover1 371:8f7d2137727a 435
rgrover1 371:8f7d2137727a 436 } ble_gap_conn_sec_mode_t;
rgrover1 371:8f7d2137727a 437
rgrover1 371:8f7d2137727a 438
rgrover1 371:8f7d2137727a 439 /**@brief GAP connection security status.*/
rgrover1 371:8f7d2137727a 440 typedef struct
rgrover1 371:8f7d2137727a 441 {
rgrover1 371:8f7d2137727a 442 ble_gap_conn_sec_mode_t sec_mode; /**< Currently active security mode for this connection.*/
rgrover1 371:8f7d2137727a 443 uint8_t encr_key_size; /**< Length of currently active encryption key, 7 to 16 octets (only applicable for bonding procedures). */
rgrover1 371:8f7d2137727a 444 } ble_gap_conn_sec_t;
rgrover1 371:8f7d2137727a 445
rgrover1 371:8f7d2137727a 446
rgrover1 371:8f7d2137727a 447 /**@brief Identity Resolving Key. */
rgrover1 371:8f7d2137727a 448 typedef struct
rgrover1 371:8f7d2137727a 449 {
rgrover1 371:8f7d2137727a 450 uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing IRK. */
rgrover1 371:8f7d2137727a 451 } ble_gap_irk_t;
rgrover1 371:8f7d2137727a 452
rgrover1 371:8f7d2137727a 453
rgrover1 371:8f7d2137727a 454 /**@brief Whitelist structure. */
rgrover1 371:8f7d2137727a 455 typedef struct
rgrover1 371:8f7d2137727a 456 {
rgrover1 371:8f7d2137727a 457 ble_gap_addr_t **pp_addrs; /**< Pointer to an array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */
rgrover1 371:8f7d2137727a 458 uint8_t addr_count; /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */
rgrover1 371:8f7d2137727a 459 ble_gap_irk_t **pp_irks; /**< Pointer to an array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are given. */
rgrover1 371:8f7d2137727a 460 uint8_t irk_count; /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */
rgrover1 371:8f7d2137727a 461 } ble_gap_whitelist_t;
rgrover1 371:8f7d2137727a 462
rgrover1 371:8f7d2137727a 463 /**@brief Channel mask for RF channels used in advertising and scanning. */
rgrover1 371:8f7d2137727a 464 typedef struct
rgrover1 371:8f7d2137727a 465 {
rgrover1 371:8f7d2137727a 466 uint8_t ch_37_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 37 */
rgrover1 371:8f7d2137727a 467 uint8_t ch_38_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 38 */
rgrover1 371:8f7d2137727a 468 uint8_t ch_39_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 39 */
rgrover1 371:8f7d2137727a 469 } ble_gap_adv_ch_mask_t;
rgrover1 371:8f7d2137727a 470
rgrover1 371:8f7d2137727a 471 /**@brief GAP advertising parameters.*/
rgrover1 371:8f7d2137727a 472 typedef struct
rgrover1 371:8f7d2137727a 473 {
rgrover1 371:8f7d2137727a 474 uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */
rgrover1 371:8f7d2137727a 475 ble_gap_addr_t *p_peer_addr; /**< For @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND mode only, known peer address. */
rgrover1 371:8f7d2137727a 476 uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */
rgrover1 371:8f7d2137727a 477 ble_gap_whitelist_t *p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */
rgrover1 371:8f7d2137727a 478 uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS.
rgrover1 371:8f7d2137727a 479 - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for high duty cycle directed advertising.
rgrover1 371:8f7d2137727a 480 - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, set @ref BLE_GAP_ADV_INTERVAL_MIN <= interval <= @ref BLE_GAP_ADV_INTERVAL_MAX for low duty cycle advertising.*/
rgrover1 371:8f7d2137727a 481 uint16_t timeout; /**< Advertising timeout between 0x0001 and 0x3FFF in seconds, 0x0000 disables timeout. See also @ref BLE_GAP_ADV_TIMEOUT_VALUES. If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for High duty cycle directed advertising. */
rgrover1 371:8f7d2137727a 482 ble_gap_adv_ch_mask_t channel_mask; /**< Advertising channel mask. @see ble_gap_channel_mask_t for documentation. */
rgrover1 371:8f7d2137727a 483 } ble_gap_adv_params_t;
rgrover1 371:8f7d2137727a 484
rgrover1 371:8f7d2137727a 485
rgrover1 371:8f7d2137727a 486 /**@brief GAP scanning parameters. */
rgrover1 371:8f7d2137727a 487 typedef struct
rgrover1 371:8f7d2137727a 488 {
rgrover1 371:8f7d2137727a 489 uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */
rgrover1 371:8f7d2137727a 490 uint8_t selective : 1; /**< If 1, ignore unknown devices (non whitelisted). */
rgrover1 371:8f7d2137727a 491 ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */
rgrover1 371:8f7d2137727a 492 uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
rgrover1 371:8f7d2137727a 493 uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
rgrover1 371:8f7d2137727a 494 uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
rgrover1 371:8f7d2137727a 495 } ble_gap_scan_params_t;
rgrover1 371:8f7d2137727a 496
rgrover1 371:8f7d2137727a 497
rgrover1 371:8f7d2137727a 498 /** @brief Keys that can be exchanged during a bonding procedure. */
rgrover1 371:8f7d2137727a 499 typedef struct
rgrover1 371:8f7d2137727a 500 {
rgrover1 371:8f7d2137727a 501 uint8_t enc : 1; /**< Long Term Key and Master Identification. */
rgrover1 371:8f7d2137727a 502 uint8_t id : 1; /**< Identity Resolving Key and Identity Address Information. */
rgrover1 371:8f7d2137727a 503 uint8_t sign : 1; /**< Connection Signature Resolving Key. */
rgrover1 371:8f7d2137727a 504 } ble_gap_sec_kdist_t;
rgrover1 371:8f7d2137727a 505
rgrover1 371:8f7d2137727a 506
rgrover1 371:8f7d2137727a 507 /**@brief GAP security parameters. */
rgrover1 371:8f7d2137727a 508 typedef struct
rgrover1 371:8f7d2137727a 509 {
rgrover1 371:8f7d2137727a 510 uint8_t bond : 1; /**< Perform bonding. */
rgrover1 371:8f7d2137727a 511 uint8_t mitm : 1; /**< Man In The Middle protection required. */
rgrover1 371:8f7d2137727a 512 uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */
rgrover1 371:8f7d2137727a 513 uint8_t oob : 1; /**< Out Of Band data available. */
rgrover1 371:8f7d2137727a 514 uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */
rgrover1 371:8f7d2137727a 515 uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */
rgrover1 371:8f7d2137727a 516 ble_gap_sec_kdist_t kdist_periph; /**< Key distribution bitmap: keys that the peripheral device will distribute. */
rgrover1 371:8f7d2137727a 517 ble_gap_sec_kdist_t kdist_central; /**< Key distribution bitmap: keys that the central device will distribute. */
rgrover1 371:8f7d2137727a 518 } ble_gap_sec_params_t;
rgrover1 371:8f7d2137727a 519
rgrover1 371:8f7d2137727a 520
rgrover1 371:8f7d2137727a 521 /**@brief GAP Encryption Information. */
rgrover1 371:8f7d2137727a 522 typedef struct
rgrover1 371:8f7d2137727a 523 {
rgrover1 371:8f7d2137727a 524 uint8_t ltk[BLE_GAP_SEC_KEY_LEN]; /**< Long Term Key. */
rgrover1 371:8f7d2137727a 525 uint8_t auth : 1; /**< Authenticated Key. */
rgrover1 371:8f7d2137727a 526 uint8_t ltk_len : 7; /**< LTK length in octets. */
rgrover1 371:8f7d2137727a 527 } ble_gap_enc_info_t;
rgrover1 371:8f7d2137727a 528
rgrover1 371:8f7d2137727a 529
rgrover1 371:8f7d2137727a 530 /**@brief GAP Master Identification. */
rgrover1 371:8f7d2137727a 531 typedef struct
rgrover1 371:8f7d2137727a 532 {
rgrover1 371:8f7d2137727a 533 uint16_t ediv; /**< Encrypted Diversifier. */
rgrover1 371:8f7d2137727a 534 uint8_t rand[BLE_GAP_SEC_RAND_LEN]; /**< Random Number. */
rgrover1 371:8f7d2137727a 535 } ble_gap_master_id_t;
rgrover1 371:8f7d2137727a 536
rgrover1 371:8f7d2137727a 537
rgrover1 371:8f7d2137727a 538 /**@brief GAP Signing Information. */
rgrover1 371:8f7d2137727a 539 typedef struct
rgrover1 371:8f7d2137727a 540 {
rgrover1 371:8f7d2137727a 541 uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /**< Connection Signature Resolving Key. */
rgrover1 371:8f7d2137727a 542 } ble_gap_sign_info_t;
rgrover1 371:8f7d2137727a 543
rgrover1 371:8f7d2137727a 544
rgrover1 371:8f7d2137727a 545 /**@brief Event structure for @ref BLE_GAP_EVT_CONNECTED. */
rgrover1 371:8f7d2137727a 546 typedef struct
rgrover1 371:8f7d2137727a 547 {
rgrover1 371:8f7d2137727a 548 ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
rgrover1 371:8f7d2137727a 549 ble_gap_addr_t own_addr; /**< Bluetooth address of the local device used during connection setup. */
rgrover1 445:8328a7d1eac2 550 #if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
rgrover1 371:8f7d2137727a 551 uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */
rgrover1 398:b1dbc4eb89a9 552 #endif
rgrover1 371:8f7d2137727a 553 uint8_t irk_match :1; /**< If 1, peer device's address resolved using an IRK. */
rgrover1 371:8f7d2137727a 554 uint8_t irk_match_idx :7; /**< Index in IRK list where the address was matched. */
rgrover1 371:8f7d2137727a 555 ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */
rgrover1 371:8f7d2137727a 556 } ble_gap_evt_connected_t;
rgrover1 371:8f7d2137727a 557
rgrover1 371:8f7d2137727a 558
rgrover1 371:8f7d2137727a 559 /**@brief Event structure for @ref BLE_GAP_EVT_DISCONNECTED. */
rgrover1 371:8f7d2137727a 560 typedef struct
rgrover1 371:8f7d2137727a 561 {
rgrover1 371:8f7d2137727a 562 uint8_t reason; /**< HCI error code, see @ref BLE_HCI_STATUS_CODES. */
rgrover1 371:8f7d2137727a 563 } ble_gap_evt_disconnected_t;
rgrover1 371:8f7d2137727a 564
rgrover1 371:8f7d2137727a 565
rgrover1 371:8f7d2137727a 566 /**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE. */
rgrover1 371:8f7d2137727a 567 typedef struct
rgrover1 371:8f7d2137727a 568 {
rgrover1 371:8f7d2137727a 569 ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */
rgrover1 371:8f7d2137727a 570 } ble_gap_evt_conn_param_update_t;
rgrover1 371:8f7d2137727a 571
rgrover1 371:8f7d2137727a 572
rgrover1 371:8f7d2137727a 573 /**@brief Event structure for @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. */
rgrover1 371:8f7d2137727a 574 typedef struct
rgrover1 371:8f7d2137727a 575 {
rgrover1 371:8f7d2137727a 576 ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */
rgrover1 371:8f7d2137727a 577 } ble_gap_evt_sec_params_request_t;
rgrover1 371:8f7d2137727a 578
rgrover1 371:8f7d2137727a 579
rgrover1 371:8f7d2137727a 580 /**@brief Event structure for @ref BLE_GAP_EVT_SEC_INFO_REQUEST. */
rgrover1 371:8f7d2137727a 581 typedef struct
rgrover1 371:8f7d2137727a 582 {
rgrover1 371:8f7d2137727a 583 ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
rgrover1 371:8f7d2137727a 584 ble_gap_master_id_t master_id; /**< Master Identification for LTK lookup. */
rgrover1 371:8f7d2137727a 585 uint8_t enc_info : 1; /**< If 1, Encryption Information required. */
rgrover1 371:8f7d2137727a 586 uint8_t id_info : 1; /**< If 1, Identity Information required. */
rgrover1 371:8f7d2137727a 587 uint8_t sign_info : 1; /**< If 1, Signing Information required. */
rgrover1 371:8f7d2137727a 588 } ble_gap_evt_sec_info_request_t;
rgrover1 371:8f7d2137727a 589
rgrover1 371:8f7d2137727a 590
rgrover1 371:8f7d2137727a 591 /**@brief Event structure for @ref BLE_GAP_EVT_PASSKEY_DISPLAY. */
rgrover1 371:8f7d2137727a 592 typedef struct
rgrover1 371:8f7d2137727a 593 {
rgrover1 371:8f7d2137727a 594 uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */
rgrover1 371:8f7d2137727a 595 } ble_gap_evt_passkey_display_t;
rgrover1 371:8f7d2137727a 596
rgrover1 371:8f7d2137727a 597
rgrover1 371:8f7d2137727a 598 /**@brief Event structure for @ref BLE_GAP_EVT_AUTH_KEY_REQUEST. */
rgrover1 371:8f7d2137727a 599 typedef struct
rgrover1 371:8f7d2137727a 600 {
rgrover1 371:8f7d2137727a 601 uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */
rgrover1 371:8f7d2137727a 602 } ble_gap_evt_auth_key_request_t;
rgrover1 371:8f7d2137727a 603
rgrover1 371:8f7d2137727a 604
rgrover1 371:8f7d2137727a 605 /**@brief Security levels supported.
rgrover1 371:8f7d2137727a 606 * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10.
rgrover1 371:8f7d2137727a 607 */
rgrover1 371:8f7d2137727a 608 typedef struct
rgrover1 371:8f7d2137727a 609 {
rgrover1 371:8f7d2137727a 610 uint8_t lv1 : 1; /**< If 1: Level 1 is supported. */
rgrover1 371:8f7d2137727a 611 uint8_t lv2 : 1; /**< If 1: Level 2 is supported. */
rgrover1 371:8f7d2137727a 612 uint8_t lv3 : 1; /**< If 1: Level 3 is supported. */
rgrover1 371:8f7d2137727a 613 } ble_gap_sec_levels_t;
rgrover1 371:8f7d2137727a 614
rgrover1 371:8f7d2137727a 615
rgrover1 371:8f7d2137727a 616 /**@brief Encryption Key. */
rgrover1 371:8f7d2137727a 617 typedef struct
rgrover1 371:8f7d2137727a 618 {
rgrover1 371:8f7d2137727a 619 ble_gap_enc_info_t enc_info; /**< Encryption Information. */
rgrover1 371:8f7d2137727a 620 ble_gap_master_id_t master_id; /**< Master Identification. */
rgrover1 371:8f7d2137727a 621 } ble_gap_enc_key_t;
rgrover1 371:8f7d2137727a 622
rgrover1 371:8f7d2137727a 623
rgrover1 371:8f7d2137727a 624 /**@brief Identity Key. */
rgrover1 371:8f7d2137727a 625 typedef struct
rgrover1 371:8f7d2137727a 626 {
rgrover1 371:8f7d2137727a 627 ble_gap_irk_t id_info; /**< Identity Information. */
rgrover1 371:8f7d2137727a 628 ble_gap_addr_t id_addr_info; /**< Identity Address Information. */
rgrover1 371:8f7d2137727a 629 } ble_gap_id_key_t;
rgrover1 371:8f7d2137727a 630
rgrover1 371:8f7d2137727a 631
rgrover1 371:8f7d2137727a 632 /**@brief Security Keys. */
rgrover1 371:8f7d2137727a 633 typedef struct
rgrover1 371:8f7d2137727a 634 {
rgrover1 371:8f7d2137727a 635 ble_gap_enc_key_t *p_enc_key; /**< Encryption Key, or NULL. */
rgrover1 371:8f7d2137727a 636 ble_gap_id_key_t *p_id_key; /**< Identity Key, or NULL. */
rgrover1 371:8f7d2137727a 637 ble_gap_sign_info_t *p_sign_key; /**< Signing Key, or NULL. */
rgrover1 371:8f7d2137727a 638 } ble_gap_sec_keys_t;
rgrover1 371:8f7d2137727a 639
rgrover1 371:8f7d2137727a 640
rgrover1 371:8f7d2137727a 641 /**@brief Security key set (both Peripheral and Central keys).
rgrover1 371:8f7d2137727a 642 * Note that when distributing Bluetooth addresses pertaining to the local device those
rgrover1 371:8f7d2137727a 643 * will have to be filled in by the user. */
rgrover1 371:8f7d2137727a 644 typedef struct
rgrover1 371:8f7d2137727a 645 {
rgrover1 371:8f7d2137727a 646 ble_gap_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */
rgrover1 371:8f7d2137727a 647 ble_gap_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */
rgrover1 371:8f7d2137727a 648 } ble_gap_sec_keyset_t;
rgrover1 371:8f7d2137727a 649
rgrover1 371:8f7d2137727a 650
rgrover1 371:8f7d2137727a 651 /**@brief Event structure for @ref BLE_GAP_EVT_AUTH_STATUS. */
rgrover1 371:8f7d2137727a 652 typedef struct
rgrover1 371:8f7d2137727a 653 {
rgrover1 371:8f7d2137727a 654 uint8_t auth_status; /**< Authentication status, see @ref BLE_GAP_SEC_STATUS. */
rgrover1 371:8f7d2137727a 655 uint8_t error_src : 2; /**< On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */
rgrover1 371:8f7d2137727a 656 uint8_t bonded : 1; /**< Procedure resulted in a bond. */
rgrover1 371:8f7d2137727a 657 ble_gap_sec_levels_t sm1_levels; /**< Levels supported in Security Mode 1. */
rgrover1 371:8f7d2137727a 658 ble_gap_sec_levels_t sm2_levels; /**< Levels supported in Security Mode 2. */
rgrover1 371:8f7d2137727a 659 ble_gap_sec_kdist_t kdist_periph; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */
rgrover1 371:8f7d2137727a 660 ble_gap_sec_kdist_t kdist_central; /**< Bitmap stating which keys were exchanged (distributed) by the central. */
rgrover1 371:8f7d2137727a 661 } ble_gap_evt_auth_status_t;
rgrover1 371:8f7d2137727a 662
rgrover1 371:8f7d2137727a 663
rgrover1 371:8f7d2137727a 664 /**@brief Event structure for @ref BLE_GAP_EVT_CONN_SEC_UPDATE. */
rgrover1 371:8f7d2137727a 665 typedef struct
rgrover1 371:8f7d2137727a 666 {
rgrover1 371:8f7d2137727a 667 ble_gap_conn_sec_t conn_sec; /**< Connection security level. */
rgrover1 371:8f7d2137727a 668 } ble_gap_evt_conn_sec_update_t;
rgrover1 371:8f7d2137727a 669
rgrover1 371:8f7d2137727a 670
rgrover1 371:8f7d2137727a 671 /**@brief Event structure for @ref BLE_GAP_EVT_TIMEOUT. */
rgrover1 371:8f7d2137727a 672 typedef struct
rgrover1 371:8f7d2137727a 673 {
rgrover1 371:8f7d2137727a 674 uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */
rgrover1 371:8f7d2137727a 675 } ble_gap_evt_timeout_t;
rgrover1 371:8f7d2137727a 676
rgrover1 371:8f7d2137727a 677
rgrover1 371:8f7d2137727a 678 /**@brief Event structure for @ref BLE_GAP_EVT_RSSI_CHANGED. */
rgrover1 371:8f7d2137727a 679 typedef struct
rgrover1 371:8f7d2137727a 680 {
rgrover1 371:8f7d2137727a 681 int8_t rssi; /**< Received Signal Strength Indication in dBm. */
rgrover1 371:8f7d2137727a 682 } ble_gap_evt_rssi_changed_t;
rgrover1 371:8f7d2137727a 683
rgrover1 371:8f7d2137727a 684
rgrover1 371:8f7d2137727a 685 /**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT. */
rgrover1 371:8f7d2137727a 686 typedef struct
rgrover1 371:8f7d2137727a 687 {
rgrover1 371:8f7d2137727a 688 ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
rgrover1 371:8f7d2137727a 689 int8_t rssi; /**< Received Signal Strength Indication in dBm. */
rgrover1 371:8f7d2137727a 690 uint8_t scan_rsp : 1; /**< If 1, the report corresponds to a scan response and the type field may be ignored. */
rgrover1 371:8f7d2137727a 691 uint8_t type : 2; /**< See @ref BLE_GAP_ADV_TYPES. Only valid if the scan_rsp field is 0. */
rgrover1 371:8f7d2137727a 692 uint8_t dlen : 5; /**< Advertising or scan response data length. */
rgrover1 371:8f7d2137727a 693 uint8_t data[BLE_GAP_ADV_MAX_SIZE]; /**< Advertising or scan response data. */
rgrover1 371:8f7d2137727a 694 } ble_gap_evt_adv_report_t;
rgrover1 371:8f7d2137727a 695
rgrover1 371:8f7d2137727a 696
rgrover1 371:8f7d2137727a 697 /**@brief Event structure for @ref BLE_GAP_EVT_SEC_REQUEST. */
rgrover1 371:8f7d2137727a 698 typedef struct
rgrover1 371:8f7d2137727a 699 {
rgrover1 371:8f7d2137727a 700 uint8_t bond : 1; /**< Perform bonding. */
rgrover1 371:8f7d2137727a 701 uint8_t mitm : 1; /**< Man In The Middle protection required. */
rgrover1 371:8f7d2137727a 702 } ble_gap_evt_sec_request_t;
rgrover1 371:8f7d2137727a 703
rgrover1 371:8f7d2137727a 704
rgrover1 371:8f7d2137727a 705 /**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST. */
rgrover1 371:8f7d2137727a 706 typedef struct
rgrover1 371:8f7d2137727a 707 {
rgrover1 371:8f7d2137727a 708 ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */
rgrover1 371:8f7d2137727a 709 } ble_gap_evt_conn_param_update_request_t;
rgrover1 371:8f7d2137727a 710
rgrover1 371:8f7d2137727a 711
rgrover1 371:8f7d2137727a 712 /**@brief Event structure for @ref BLE_GAP_EVT_SCAN_REQ_REPORT. */
rgrover1 371:8f7d2137727a 713 typedef struct
rgrover1 371:8f7d2137727a 714 {
rgrover1 371:8f7d2137727a 715 int8_t rssi; /**< Received Signal Strength Indication in dBm. */
rgrover1 371:8f7d2137727a 716 ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
rgrover1 371:8f7d2137727a 717 } ble_gap_evt_scan_req_report_t;
rgrover1 371:8f7d2137727a 718
rgrover1 371:8f7d2137727a 719
rgrover1 371:8f7d2137727a 720
rgrover1 371:8f7d2137727a 721 /**@brief GAP event structure. */
rgrover1 371:8f7d2137727a 722 typedef struct
rgrover1 371:8f7d2137727a 723 {
rgrover1 371:8f7d2137727a 724 uint16_t conn_handle; /**< Connection Handle on which event occured. */
rgrover1 371:8f7d2137727a 725 union /**< union alternative identified by evt_id in enclosing struct. */
rgrover1 371:8f7d2137727a 726 {
rgrover1 371:8f7d2137727a 727 ble_gap_evt_connected_t connected; /**< Connected Event Parameters. */
rgrover1 371:8f7d2137727a 728 ble_gap_evt_disconnected_t disconnected; /**< Disconnected Event Parameters. */
rgrover1 371:8f7d2137727a 729 ble_gap_evt_conn_param_update_t conn_param_update; /**< Connection Parameter Update Parameters. */
rgrover1 371:8f7d2137727a 730 ble_gap_evt_sec_params_request_t sec_params_request; /**< Security Parameters Request Event Parameters. */
rgrover1 371:8f7d2137727a 731 ble_gap_evt_sec_info_request_t sec_info_request; /**< Security Information Request Event Parameters. */
rgrover1 371:8f7d2137727a 732 ble_gap_evt_passkey_display_t passkey_display; /**< Passkey Display Event Parameters. */
rgrover1 371:8f7d2137727a 733 ble_gap_evt_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */
rgrover1 371:8f7d2137727a 734 ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */
rgrover1 371:8f7d2137727a 735 ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */
rgrover1 371:8f7d2137727a 736 ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */
rgrover1 371:8f7d2137727a 737 ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event parameters. */
rgrover1 371:8f7d2137727a 738 ble_gap_evt_adv_report_t adv_report; /**< Advertising Report Event Parameters. */
rgrover1 371:8f7d2137727a 739 ble_gap_evt_sec_request_t sec_request; /**< Security Request Event Parameters. */
rgrover1 371:8f7d2137727a 740 ble_gap_evt_conn_param_update_request_t conn_param_update_request; /**< Connection Parameter Update Parameters. */
rgrover1 371:8f7d2137727a 741 ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report parameters. */
rgrover1 371:8f7d2137727a 742 } params; /**< Event Parameters. */
rgrover1 371:8f7d2137727a 743
rgrover1 371:8f7d2137727a 744 } ble_gap_evt_t;
rgrover1 371:8f7d2137727a 745
rgrover1 371:8f7d2137727a 746
rgrover1 371:8f7d2137727a 747 /**@brief Channel Map option.
rgrover1 371:8f7d2137727a 748 * Used with @ref sd_ble_opt_get to get the current channel map
rgrover1 371:8f7d2137727a 749 * or @ref sd_ble_opt_set to set a new channel map. When setting the
rgrover1 371:8f7d2137727a 750 * channel map, it applies to all current and future connections. When getting the
rgrover1 371:8f7d2137727a 751 * current channel map, it applies to a single connection and the connection handle
rgrover1 371:8f7d2137727a 752 * must be supplied.
rgrover1 371:8f7d2137727a 753 *
rgrover1 371:8f7d2137727a 754 * @note Setting the channel map may take some time, depending on connection parameters.
rgrover1 371:8f7d2137727a 755 * The time taken may be different for each connection and the get operation will
rgrover1 371:8f7d2137727a 756 * return the previous channel map until the new one has taken effect.
rgrover1 371:8f7d2137727a 757 *
rgrover1 371:8f7d2137727a 758 * @note After setting the channel map, by spec it can not be set again until at least 1 s has passed.
rgrover1 371:8f7d2137727a 759 * See Bluetooth Specification Version 4.1 Volume 2, Part E, Section 7.3.46.
rgrover1 371:8f7d2137727a 760 *
rgrover1 371:8f7d2137727a 761 * @retval ::NRF_SUCCESS Get or set successful.
rgrover1 371:8f7d2137727a 762 * @retval ::NRF_ERROR_BUSY Channel map was set again before enough time had passed.
rgrover1 371:8f7d2137727a 763 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 764 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied for get.
rgrover1 371:8f7d2137727a 765 * @retval ::NRF_ERROR_NOT_SUPPORTED Returned by sd_ble_opt_set in peripheral-only SoftDevices.
rgrover1 371:8f7d2137727a 766 *
rgrover1 371:8f7d2137727a 767 */
rgrover1 371:8f7d2137727a 768 typedef struct
rgrover1 371:8f7d2137727a 769 {
rgrover1 371:8f7d2137727a 770 uint16_t conn_handle; /**< Connection Handle (only applicable for get) */
rgrover1 371:8f7d2137727a 771 uint8_t ch_map[5]; /**< Channel Map (37-bit). */
rgrover1 371:8f7d2137727a 772 } ble_gap_opt_ch_map_t;
rgrover1 371:8f7d2137727a 773
rgrover1 371:8f7d2137727a 774
rgrover1 371:8f7d2137727a 775 /**@brief Local connection latency option.
rgrover1 371:8f7d2137727a 776 *
rgrover1 371:8f7d2137727a 777 * Local connection latency is a feature which enables the slave to improve
rgrover1 371:8f7d2137727a 778 * current consumption by ignoring the slave latency set by the peer. The
rgrover1 371:8f7d2137727a 779 * local connection latency can only be set to a multiple of the slave latency,
rgrover1 371:8f7d2137727a 780 * and cannot be longer than half of the supervision timeout.
rgrover1 371:8f7d2137727a 781 *
rgrover1 371:8f7d2137727a 782 * Used with @ref sd_ble_opt_set to set the local connection latency. The
rgrover1 371:8f7d2137727a 783 * @ref sd_ble_opt_get is not supported for this option, but the actual
rgrover1 371:8f7d2137727a 784 * local connection latency (unless set to NULL) is set as a return parameter
rgrover1 371:8f7d2137727a 785 * when setting the option.
rgrover1 371:8f7d2137727a 786 *
rgrover1 371:8f7d2137727a 787 * @note The latency set will be truncated down to the closest slave latency event
rgrover1 371:8f7d2137727a 788 * multiple, or the nearest multiple before half of the supervision timeout.
rgrover1 371:8f7d2137727a 789 *
rgrover1 371:8f7d2137727a 790 * @note The local connection latency is disabled by default, and needs to be enabled for new
rgrover1 371:8f7d2137727a 791 * connections and whenever the connection is updated.
rgrover1 371:8f7d2137727a 792 *
rgrover1 371:8f7d2137727a 793 * @retval ::NRF_SUCCESS Set successfully.
rgrover1 371:8f7d2137727a 794 * @retval ::NRF_ERROR_NOT_SUPPORTED Get is not supported.
rgrover1 371:8f7d2137727a 795 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter.
rgrover1 371:8f7d2137727a 796 */
rgrover1 371:8f7d2137727a 797 typedef struct
rgrover1 371:8f7d2137727a 798 {
rgrover1 371:8f7d2137727a 799 uint16_t conn_handle; /**< Connection Handle */
rgrover1 371:8f7d2137727a 800 uint16_t requested_latency; /**< Requested local connection latency. */
rgrover1 371:8f7d2137727a 801 uint16_t * p_actual_latency; /**< Pointer to storage for the actual local connection latency (can be set to NULL to skip return value). */
rgrover1 371:8f7d2137727a 802 } ble_gap_opt_local_conn_latency_t;
rgrover1 371:8f7d2137727a 803
rgrover1 371:8f7d2137727a 804
rgrover1 371:8f7d2137727a 805 /**@brief Passkey Option.
rgrover1 371:8f7d2137727a 806 *
rgrover1 371:8f7d2137727a 807 * Structure containing the passkey to be used during pairing. This can be used with @ref
rgrover1 371:8f7d2137727a 808 * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication
rgrover1 371:8f7d2137727a 809 * instead of generating a random one.
rgrover1 371:8f7d2137727a 810 *
rgrover1 371:8f7d2137727a 811 * @note @ref sd_ble_opt_get is not supported for this option.
rgrover1 371:8f7d2137727a 812 *
rgrover1 371:8f7d2137727a 813 */
rgrover1 371:8f7d2137727a 814 typedef struct
rgrover1 371:8f7d2137727a 815 {
rgrover1 371:8f7d2137727a 816 uint8_t * p_passkey; /**< Pointer to 6-digit ASCII string (digit 0..9 only, no NULL termination) passkey to be used during pairing. If this is NULL, the SoftDevice will generate a random passkey if required.*/
rgrover1 371:8f7d2137727a 817 } ble_gap_opt_passkey_t;
rgrover1 371:8f7d2137727a 818
rgrover1 371:8f7d2137727a 819
rgrover1 371:8f7d2137727a 820 /**@brief Custom Privacy Option.
rgrover1 371:8f7d2137727a 821 *
rgrover1 371:8f7d2137727a 822 * This structure is used with both @ref sd_ble_opt_set (as input) and with
rgrover1 371:8f7d2137727a 823 * @ref sd_ble_opt_get (as output).
rgrover1 371:8f7d2137727a 824 *
rgrover1 371:8f7d2137727a 825 * Structure containing:
rgrover1 371:8f7d2137727a 826 * - A pointer to an IRK to set (if input), or a place to store a read IRK (if output).
rgrover1 371:8f7d2137727a 827 * - A private address refresh cycle.
rgrover1 371:8f7d2137727a 828 *
rgrover1 371:8f7d2137727a 829 * @note The specified address cycle interval is used when the address cycle mode is
rgrover1 371:8f7d2137727a 830 * @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. If 0 is given, the address will not be automatically
rgrover1 371:8f7d2137727a 831 * refreshed at all. The default interval is @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S.
rgrover1 371:8f7d2137727a 832 *
rgrover1 371:8f7d2137727a 833 * @note If the current address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address will immediately be
rgrover1 371:8f7d2137727a 834 * refreshed when a custom privacy option is set. A new address can be generated manually by calling
rgrover1 371:8f7d2137727a 835 * @ref sd_ble_gap_address_set with the same type again.
rgrover1 371:8f7d2137727a 836 *
rgrover1 371:8f7d2137727a 837 * @note If the IRK is updated, the new IRK becomes the one to be distributed in all
rgrover1 371:8f7d2137727a 838 * bonding procedures performed after @ref sd_ble_opt_set returns.
rgrover1 371:8f7d2137727a 839 *
rgrover1 371:8f7d2137727a 840 * @retval ::NRF_SUCCESS Set or read successfully.
rgrover1 371:8f7d2137727a 841 * @retval ::NRF_ERROR_INVALID_ADDR The pointer to IRK storage is invalid.
rgrover1 371:8f7d2137727a 842 */
rgrover1 371:8f7d2137727a 843 typedef struct
rgrover1 371:8f7d2137727a 844 {
rgrover1 371:8f7d2137727a 845 ble_gap_irk_t * p_irk; /**< When input: Pointer to custom IRK, or NULL to use/reset to the device's default IRK. When output: Pointer to where the current IRK is to be stored, or NULL to not read out the IRK. */
rgrover1 371:8f7d2137727a 846 uint16_t interval_s; /**< When input: Custom private address cycle interval in seconds. When output: The current private address cycle interval. */
rgrover1 371:8f7d2137727a 847 } ble_gap_opt_privacy_t;
rgrover1 371:8f7d2137727a 848
rgrover1 371:8f7d2137727a 849
rgrover1 371:8f7d2137727a 850 /**@brief Scan request report option.
rgrover1 371:8f7d2137727a 851 *
rgrover1 371:8f7d2137727a 852 * This can be used with @ref sd_ble_opt_set to make the SoftDevice send
rgrover1 371:8f7d2137727a 853 * @ref BLE_GAP_EVT_SCAN_REQ_REPORT events.
rgrover1 371:8f7d2137727a 854 *
rgrover1 371:8f7d2137727a 855 * @note Due to the limited space reserved for scan request report events,
rgrover1 371:8f7d2137727a 856 * not all received scan requests will be reported.
rgrover1 371:8f7d2137727a 857 *
rgrover1 371:8f7d2137727a 858 * @note If whitelisting is used, only whitelisted requests are reported.
rgrover1 371:8f7d2137727a 859 *
rgrover1 371:8f7d2137727a 860 * @retval ::NRF_SUCCESS Set successfully.
rgrover1 371:8f7d2137727a 861 * @retval ::NRF_ERROR_INVALID_STATE When advertising is ongoing while the option is set.
rgrover1 371:8f7d2137727a 862 */
rgrover1 371:8f7d2137727a 863 typedef struct
rgrover1 371:8f7d2137727a 864 {
rgrover1 371:8f7d2137727a 865 uint8_t enable : 1; /**< Enable scan request reports. */
rgrover1 371:8f7d2137727a 866 } ble_gap_opt_scan_req_report_t;
rgrover1 371:8f7d2137727a 867
rgrover1 371:8f7d2137727a 868 /**@brief Compatibility mode option.
rgrover1 371:8f7d2137727a 869 *
rgrover1 371:8f7d2137727a 870 * This can be used with @ref sd_ble_opt_set to enable and disable
rgrover1 371:8f7d2137727a 871 * compatibility modes. Compatibility modes are disabled by default.
rgrover1 371:8f7d2137727a 872 *
rgrover1 371:8f7d2137727a 873 * @note Compatibility mode 1 enables interoperability with devices that do not support
rgrover1 371:8f7d2137727a 874 * a value of 0 for the WinOffset parameter in the Link Layer CONNECT_REQ packet.
rgrover1 371:8f7d2137727a 875 *
rgrover1 371:8f7d2137727a 876 * @retval ::NRF_SUCCESS Set successfully.
rgrover1 371:8f7d2137727a 877 * @retval ::NRF_ERROR_INVALID_STATE When connection creation is ongoing while mode 1 is set.
rgrover1 371:8f7d2137727a 878 */
rgrover1 371:8f7d2137727a 879 typedef struct
rgrover1 371:8f7d2137727a 880 {
rgrover1 371:8f7d2137727a 881 uint8_t mode_1_enable : 1; /**< Enable compatibility mode 1.*/
rgrover1 371:8f7d2137727a 882 } ble_gap_opt_compat_mode_t;
rgrover1 371:8f7d2137727a 883
rgrover1 371:8f7d2137727a 884
rgrover1 371:8f7d2137727a 885 /**@brief Option structure for GAP options. */
rgrover1 371:8f7d2137727a 886 typedef union
rgrover1 371:8f7d2137727a 887 {
rgrover1 371:8f7d2137727a 888 ble_gap_opt_ch_map_t ch_map; /**< Parameters for the Channel Map option. */
rgrover1 371:8f7d2137727a 889 ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Parameters for the Local connection latency option */
rgrover1 371:8f7d2137727a 890 ble_gap_opt_passkey_t passkey; /**< Parameters for the Passkey option.*/
rgrover1 371:8f7d2137727a 891 ble_gap_opt_privacy_t privacy; /**< Parameters for the Custom privacy option. */
rgrover1 371:8f7d2137727a 892 ble_gap_opt_scan_req_report_t scan_req_report; /**< Parameters for the scan request report option.*/
rgrover1 371:8f7d2137727a 893 ble_gap_opt_compat_mode_t compat_mode; /**< Parameters for the compatibility mode option.*/
rgrover1 371:8f7d2137727a 894 } ble_gap_opt_t;
rgrover1 371:8f7d2137727a 895 /**@} */
rgrover1 371:8f7d2137727a 896
rgrover1 371:8f7d2137727a 897
rgrover1 371:8f7d2137727a 898 /**@addtogroup BLE_GAP_FUNCTIONS Functions
rgrover1 371:8f7d2137727a 899 * @{ */
rgrover1 371:8f7d2137727a 900
rgrover1 371:8f7d2137727a 901 /**@brief Set local Bluetooth address.
rgrover1 371:8f7d2137727a 902 *
rgrover1 371:8f7d2137727a 903 * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to
rgrover1 371:8f7d2137727a 904 * be @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or
rgrover1 371:8f7d2137727a 905 * @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the
rgrover1 371:8f7d2137727a 906 * SoftDevice will generate a new private address automatically every
rgrover1 371:8f7d2137727a 907 * @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds. If this API
rgrover1 371:8f7d2137727a 908 * call is used again with the same parameters, the SoftDevice will immediately
rgrover1 371:8f7d2137727a 909 * generate a new private address to replace the current address.
rgrover1 371:8f7d2137727a 910 *
rgrover1 371:8f7d2137727a 911 * @note If the application wishes to use a @ref BLE_GAP_ADDR_TYPE_PUBLIC or
rgrover1 371:8f7d2137727a 912 * @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be
rgrover1 371:8f7d2137727a 913 * @ref BLE_GAP_ADDR_CYCLE_MODE_NONE.
rgrover1 371:8f7d2137727a 914 *
rgrover1 371:8f7d2137727a 915 * @note If this API function is called while advertising or scanning, the softdevice will immediately update the
rgrover1 371:8f7d2137727a 916 * advertising or scanning address without the need to stop the procedure in the following cases:
rgrover1 371:8f7d2137727a 917 * - If the previously set address is of type @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address
rgrover1 371:8f7d2137727a 918 * is also of type @ref BLE_GAP_ADDR_TYPE_PUBLIC
rgrover1 371:8f7d2137727a 919 * - If the previously set address is not @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address is
rgrover1 371:8f7d2137727a 920 * also not @ref BLE_GAP_ADDR_TYPE_PUBLIC.
rgrover1 371:8f7d2137727a 921 * If the address is changed from a @ref BLE_GAP_ADDR_TYPE_PUBLIC address to another type or from
rgrover1 371:8f7d2137727a 922 * another type to a @ref BLE_GAP_ADDR_TYPE_PUBLIC address, the change will take effect the next
rgrover1 371:8f7d2137727a 923 * time an advertising or scanning procedure is started.
rgrover1 371:8f7d2137727a 924 *
rgrover1 371:8f7d2137727a 925 * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_NONE and the application is
rgrover1 371:8f7d2137727a 926 * using privacy, the application must take care to generate and set new private addresses
rgrover1 371:8f7d2137727a 927 * periodically to comply with the Privacy specification in Bluetooth Core Spec.
rgrover1 371:8f7d2137727a 928 *
rgrover1 371:8f7d2137727a 929 * @param[in] addr_cycle_mode Address cycle mode, see @ref BLE_GAP_ADDR_CYCLE_MODES.
rgrover1 371:8f7d2137727a 930 * @param[in] p_addr Pointer to address structure.
rgrover1 371:8f7d2137727a 931 *
rgrover1 371:8f7d2137727a 932 * @retval ::NRF_SUCCESS Address successfully set.
rgrover1 371:8f7d2137727a 933 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 934 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters.
rgrover1 371:8f7d2137727a 935 * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address.
rgrover1 371:8f7d2137727a 936 * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry.
rgrover1 371:8f7d2137727a 937 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 938 */
rgrover1 371:8f7d2137727a 939 SVCALL(SD_BLE_GAP_ADDRESS_SET, uint32_t, sd_ble_gap_address_set(uint8_t addr_cycle_mode, const ble_gap_addr_t *p_addr));
rgrover1 371:8f7d2137727a 940
rgrover1 371:8f7d2137727a 941
rgrover1 371:8f7d2137727a 942 /**@brief Get local Bluetooth address.
rgrover1 371:8f7d2137727a 943 *
rgrover1 371:8f7d2137727a 944 * @param[out] p_addr Pointer to address structure to be filled in.
rgrover1 371:8f7d2137727a 945 *
rgrover1 371:8f7d2137727a 946 * @retval ::NRF_SUCCESS Address successfully retrieved.
rgrover1 371:8f7d2137727a 947 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 948 */
rgrover1 371:8f7d2137727a 949 SVCALL(SD_BLE_GAP_ADDRESS_GET, uint32_t, sd_ble_gap_address_get(ble_gap_addr_t *p_addr));
rgrover1 371:8f7d2137727a 950
rgrover1 371:8f7d2137727a 951
rgrover1 371:8f7d2137727a 952 /**@brief Set, clear or update advertising and scan response data.
rgrover1 371:8f7d2137727a 953 *
rgrover1 371:8f7d2137727a 954 * @note The format of the advertising data will be checked by this call to ensure interoperability.
rgrover1 371:8f7d2137727a 955 * Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and
rgrover1 371:8f7d2137727a 956 * duplicating the local name in the advertising data and scan response data.
rgrover1 371:8f7d2137727a 957 *
rgrover1 371:8f7d2137727a 958 * @note To clear the advertising data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding
rgrover1 371:8f7d2137727a 959 * length (dlen/srdlen) set to 0.
rgrover1 371:8f7d2137727a 960 *
rgrover1 371:8f7d2137727a 961 * @note The call will fail if p_data and p_sr_data are both NULL since this would have no effect.
rgrover1 371:8f7d2137727a 962 *
rgrover1 371:8f7d2137727a 963 * @param[in] p_data Raw data to be placed in advertising packet. If NULL, no changes are made to the current advertising packet data.
rgrover1 371:8f7d2137727a 964 * @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_data is NULL, can be 0 if p_data is not NULL.
rgrover1 371:8f7d2137727a 965 * @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL, no changes are made to the current scan response packet data.
rgrover1 371:8f7d2137727a 966 * @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL.
rgrover1 371:8f7d2137727a 967 *
rgrover1 371:8f7d2137727a 968 * @retval ::NRF_SUCCESS Advertising data successfully updated or cleared.
rgrover1 371:8f7d2137727a 969 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 970 * @retval ::NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied.
rgrover1 371:8f7d2137727a 971 * @retval ::NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification.
rgrover1 371:8f7d2137727a 972 * @retval ::NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied.
rgrover1 371:8f7d2137727a 973 * @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported data type.
rgrover1 371:8f7d2137727a 974 * @retval ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied.
rgrover1 371:8f7d2137727a 975 */
rgrover1 371:8f7d2137727a 976 SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen));
rgrover1 371:8f7d2137727a 977
rgrover1 371:8f7d2137727a 978
rgrover1 371:8f7d2137727a 979 /**@brief Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).
rgrover1 371:8f7d2137727a 980 *
rgrover1 371:8f7d2137727a 981 * @note An application can start an advertising procedure for broadcasting purposes while a connection
rgrover1 371:8f7d2137727a 982 * is active. After a @ref BLE_GAP_EVT_CONNECTED event is received, this function may therefore
rgrover1 371:8f7d2137727a 983 * be called to start a broadcast advertising procedure. The advertising procedure
rgrover1 371:8f7d2137727a 984 * cannot however be connectable (it must be of type @ref BLE_GAP_ADV_TYPE_ADV_SCAN_IND or
rgrover1 371:8f7d2137727a 985 * @ref BLE_GAP_ADV_TYPE_ADV_NONCONN_IND). @note Only one advertiser may be active at any time.
rgrover1 371:8f7d2137727a 986 *
rgrover1 371:8f7d2137727a 987 * @note To use the currently active whitelist set p_adv_params->p_whitelist to NULL.
rgrover1 371:8f7d2137727a 988 *
rgrover1 371:8f7d2137727a 989 * @param[in] p_adv_params Pointer to advertising parameters structure.
rgrover1 371:8f7d2137727a 990 *
rgrover1 371:8f7d2137727a 991 * @retval ::NRF_SUCCESS The BLE stack has started advertising.
rgrover1 371:8f7d2137727a 992 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 993 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 994 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits.
rgrover1 371:8f7d2137727a 995 * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied.
rgrover1 371:8f7d2137727a 996 * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible.
rgrover1 371:8f7d2137727a 997 * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry.
rgrover1 371:8f7d2137727a 998 * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it.
rgrover1 371:8f7d2137727a 999 */
rgrover1 371:8f7d2137727a 1000 SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params));
rgrover1 371:8f7d2137727a 1001
rgrover1 371:8f7d2137727a 1002
rgrover1 371:8f7d2137727a 1003 /**@brief Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).
rgrover1 371:8f7d2137727a 1004 *
rgrover1 371:8f7d2137727a 1005 * @retval ::NRF_SUCCESS The BLE stack has stopped advertising.
rgrover1 371:8f7d2137727a 1006 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state).
rgrover1 371:8f7d2137727a 1007 */
rgrover1 371:8f7d2137727a 1008 SVCALL(SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void));
rgrover1 371:8f7d2137727a 1009
rgrover1 371:8f7d2137727a 1010
rgrover1 371:8f7d2137727a 1011 /**@brief Update connection parameters.
rgrover1 371:8f7d2137727a 1012 *
rgrover1 371:8f7d2137727a 1013 * @details In the central role this will initiate a Link Layer connection parameter update procedure,
rgrover1 371:8f7d2137727a 1014 * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for
rgrover1 371:8f7d2137727a 1015 * the central to perform the procedure. In both cases, and regardless of success or failure, the application
rgrover1 371:8f7d2137727a 1016 * will be informed of the result with a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE event.
rgrover1 371:8f7d2137727a 1017 *
rgrover1 371:8f7d2137727a 1018 * @details This function can be used as a central both to reply to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested.
rgrover1 371:8f7d2137727a 1019 *
rgrover1 371:8f7d2137727a 1020 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1021 * @param[in] p_conn_params Pointer to desired connection parameters. If NULL is provided on a peripheral role,
rgrover1 371:8f7d2137727a 1022 * the parameters in the PPCP characteristic of the GAP service will be used instead.
rgrover1 371:8f7d2137727a 1023 * If NULL is provided on a central role and in response to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, the peripheral request will be rejected
rgrover1 371:8f7d2137727a 1024 *
rgrover1 371:8f7d2137727a 1025 * @retval ::NRF_SUCCESS The Connection Update procedure has been started successfully.
rgrover1 371:8f7d2137727a 1026 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1027 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
rgrover1 371:8f7d2137727a 1028 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1029 * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and wait for pending procedures to complete and retry.
rgrover1 371:8f7d2137727a 1030 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1031 * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
rgrover1 371:8f7d2137727a 1032 */
rgrover1 371:8f7d2137727a 1033 SVCALL(SD_BLE_GAP_CONN_PARAM_UPDATE, uint32_t, sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const *p_conn_params));
rgrover1 371:8f7d2137727a 1034
rgrover1 371:8f7d2137727a 1035
rgrover1 371:8f7d2137727a 1036 /**@brief Disconnect (GAP Link Termination).
rgrover1 371:8f7d2137727a 1037 *
rgrover1 371:8f7d2137727a 1038 * @details This call initiates the disconnection procedure, and its completion will be communicated to the application
rgrover1 371:8f7d2137727a 1039 * with a @ref BLE_GAP_EVT_DISCONNECTED event.
rgrover1 371:8f7d2137727a 1040 *
rgrover1 371:8f7d2137727a 1041 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1042 * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are @ref BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and @ref BLE_HCI_CONN_INTERVAL_UNACCEPTABLE).
rgrover1 371:8f7d2137727a 1043 *
rgrover1 371:8f7d2137727a 1044 * @retval ::NRF_SUCCESS The disconnection procedure has been started successfully.
rgrover1 371:8f7d2137727a 1045 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1046 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1047 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress).
rgrover1 371:8f7d2137727a 1048 */
rgrover1 371:8f7d2137727a 1049 SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code));
rgrover1 371:8f7d2137727a 1050
rgrover1 371:8f7d2137727a 1051
rgrover1 371:8f7d2137727a 1052 /**@brief Set the radio's transmit power.
rgrover1 371:8f7d2137727a 1053 *
rgrover1 371:8f7d2137727a 1054 * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
rgrover1 371:8f7d2137727a 1055 *
rgrover1 371:8f7d2137727a 1056 * @note -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm.
rgrover1 371:8f7d2137727a 1057 *
rgrover1 371:8f7d2137727a 1058 * @retval ::NRF_SUCCESS Successfully changed the transmit power.
rgrover1 371:8f7d2137727a 1059 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1060 */
rgrover1 371:8f7d2137727a 1061 SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power));
rgrover1 371:8f7d2137727a 1062
rgrover1 371:8f7d2137727a 1063
rgrover1 371:8f7d2137727a 1064 /**@brief Set GAP Appearance value.
rgrover1 371:8f7d2137727a 1065 *
rgrover1 371:8f7d2137727a 1066 * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES.
rgrover1 371:8f7d2137727a 1067 *
rgrover1 371:8f7d2137727a 1068 * @retval ::NRF_SUCCESS Appearance value set successfully.
rgrover1 371:8f7d2137727a 1069 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1070 */
rgrover1 371:8f7d2137727a 1071 SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance));
rgrover1 371:8f7d2137727a 1072
rgrover1 371:8f7d2137727a 1073
rgrover1 371:8f7d2137727a 1074 /**@brief Get GAP Appearance value.
rgrover1 371:8f7d2137727a 1075 *
rgrover1 371:8f7d2137727a 1076 * @param[out] p_appearance Pointer to appearance (16-bit) to be filled in, see @ref BLE_APPEARANCES.
rgrover1 371:8f7d2137727a 1077 *
rgrover1 371:8f7d2137727a 1078 * @retval ::NRF_SUCCESS Appearance value retrieved successfully.
rgrover1 371:8f7d2137727a 1079 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1080 */
rgrover1 371:8f7d2137727a 1081 SVCALL(SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t *p_appearance));
rgrover1 371:8f7d2137727a 1082
rgrover1 371:8f7d2137727a 1083
rgrover1 371:8f7d2137727a 1084 /**@brief Set GAP Peripheral Preferred Connection Parameters.
rgrover1 371:8f7d2137727a 1085 *
rgrover1 371:8f7d2137727a 1086 * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the desired parameters.
rgrover1 371:8f7d2137727a 1087 *
rgrover1 371:8f7d2137727a 1088 * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully.
rgrover1 371:8f7d2137727a 1089 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1090 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1091 */
rgrover1 371:8f7d2137727a 1092 SVCALL(SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const *p_conn_params));
rgrover1 371:8f7d2137727a 1093
rgrover1 371:8f7d2137727a 1094
rgrover1 371:8f7d2137727a 1095 /**@brief Get GAP Peripheral Preferred Connection Parameters.
rgrover1 371:8f7d2137727a 1096 *
rgrover1 371:8f7d2137727a 1097 * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters will be stored.
rgrover1 371:8f7d2137727a 1098 *
rgrover1 371:8f7d2137727a 1099 * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully.
rgrover1 371:8f7d2137727a 1100 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1101 */
rgrover1 371:8f7d2137727a 1102 SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t *p_conn_params));
rgrover1 371:8f7d2137727a 1103
rgrover1 371:8f7d2137727a 1104
rgrover1 371:8f7d2137727a 1105 /**@brief Set GAP device name.
rgrover1 371:8f7d2137727a 1106 *
rgrover1 371:8f7d2137727a 1107 * @param[in] p_write_perm Write permissions for the Device Name characteristic, see @ref ble_gap_conn_sec_mode_t.
rgrover1 371:8f7d2137727a 1108 * @param[in] p_dev_name Pointer to a UTF-8 encoded, <b>non NULL-terminated</b> string.
rgrover1 371:8f7d2137727a 1109 * @param[in] len Length of the UTF-8, <b>non NULL-terminated</b> string pointed to by p_dev_name in octets (must be smaller or equal than @ref BLE_GAP_DEVNAME_MAX_LEN).
rgrover1 371:8f7d2137727a 1110 *
rgrover1 371:8f7d2137727a 1111 * @retval ::NRF_SUCCESS GAP device name and permissions set successfully.
rgrover1 371:8f7d2137727a 1112 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1113 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1114 * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
rgrover1 371:8f7d2137727a 1115 */
rgrover1 371:8f7d2137727a 1116 SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len));
rgrover1 371:8f7d2137727a 1117
rgrover1 371:8f7d2137727a 1118
rgrover1 371:8f7d2137727a 1119 /**@brief Get GAP device name.
rgrover1 371:8f7d2137727a 1120 *
rgrover1 371:8f7d2137727a 1121 * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 <b>non NULL-terminated</b> string will be placed. Set to NULL to obtain the complete device name length.
rgrover1 371:8f7d2137727a 1122 * @param[in,out] p_len Length of the buffer pointed by p_dev_name, complete device name length on output.
rgrover1 371:8f7d2137727a 1123 *
rgrover1 371:8f7d2137727a 1124 * @note If the device name is longer than the size of the supplied buffer,
rgrover1 371:8f7d2137727a 1125 * p_len will return the complete device name length,
rgrover1 371:8f7d2137727a 1126 * and not the number of bytes actually returned in p_dev_name.
rgrover1 371:8f7d2137727a 1127 * The application may use this information to allocate a suitable buffer size.
rgrover1 371:8f7d2137727a 1128 *
rgrover1 371:8f7d2137727a 1129 * @retval ::NRF_SUCCESS GAP device name retrieved successfully.
rgrover1 371:8f7d2137727a 1130 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1131 * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
rgrover1 371:8f7d2137727a 1132 */
rgrover1 371:8f7d2137727a 1133 SVCALL(SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len));
rgrover1 371:8f7d2137727a 1134
rgrover1 371:8f7d2137727a 1135
rgrover1 371:8f7d2137727a 1136 /**@brief Initiate the GAP Authentication procedure.
rgrover1 371:8f7d2137727a 1137 *
rgrover1 371:8f7d2137727a 1138 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1139 * @param[in] p_sec_params Pointer to the @ref ble_gap_sec_params_t structure with the security parameters to be used during the pairing or bonding procedure.
rgrover1 371:8f7d2137727a 1140 * In the peripheral role, only the timeout, bond and mitm fields of this structure are used.
rgrover1 371:8f7d2137727a 1141 * In the central role, this pointer may be NULL to reject a Security Request.
rgrover1 371:8f7d2137727a 1142 *
rgrover1 371:8f7d2137727a 1143 * @details In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected),
rgrover1 371:8f7d2137727a 1144 * otherwise in the peripheral role, an SMP Security Request will be sent.
rgrover1 371:8f7d2137727a 1145 *
rgrover1 371:8f7d2137727a 1146 * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST,
rgrover1 371:8f7d2137727a 1147 * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_CONN_SEC_UPDATE, @ref BLE_GAP_EVT_AUTH_STATUS.
rgrover1 371:8f7d2137727a 1148 *
rgrover1 371:8f7d2137727a 1149 *
rgrover1 371:8f7d2137727a 1150 * @retval ::NRF_SUCCESS Successfully initiated authentication procedure.
rgrover1 371:8f7d2137727a 1151 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1152 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1153 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1154 * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry.
rgrover1 371:8f7d2137727a 1155 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1156 * @retval ::NRF_ERROR_TIMEOUT A SMP timout has occured, and further SMP operations on this link is prohibited.
rgrover1 371:8f7d2137727a 1157 */
rgrover1 371:8f7d2137727a 1158 SVCALL(SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params));
rgrover1 371:8f7d2137727a 1159
rgrover1 371:8f7d2137727a 1160
rgrover1 371:8f7d2137727a 1161 /**@brief Reply with GAP security parameters.
rgrover1 371:8f7d2137727a 1162 *
rgrover1 371:8f7d2137727a 1163 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1164 * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS.
rgrover1 371:8f7d2137727a 1165 * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters structure. In the central role this must be set to NULL, as the parameters have
rgrover1 371:8f7d2137727a 1166 * already been provided during a previous call to @ref sd_ble_gap_authenticate.
rgrover1 371:8f7d2137727a 1167 * @param[in,out] p_sec_keyset Pointer to a @ref ble_gap_sec_keyset_t security keyset structure. Any keys distributed as a result of the ongoing security procedure
rgrover1 371:8f7d2137727a 1168 * will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application
rgrover1 371:8f7d2137727a 1169 * upon reception of a @ref BLE_GAP_EVT_AUTH_STATUS event.
rgrover1 371:8f7d2137727a 1170 * The pointer to the ID key data distributed by the <b>local device</b> constitutes however an exception. It can either point to ID key data
rgrover1 371:8f7d2137727a 1171 * filled in by the user before calling this function, in which case a user-supplied Bluetooth address and IRK will be distributed,
rgrover1 371:8f7d2137727a 1172 * or the pointer to the ID key data structure can be NULL, in which case the device's configured (or default, if none is configured)
rgrover1 371:8f7d2137727a 1173 * Bluetooth address and IRK will be distributed.
rgrover1 371:8f7d2137727a 1174 *
rgrover1 371:8f7d2137727a 1175 * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE.
rgrover1 371:8f7d2137727a 1176 * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
rgrover1 371:8f7d2137727a 1177 *
rgrover1 371:8f7d2137727a 1178 * @retval ::NRF_SUCCESS Successfully accepted security parameter from the application.
rgrover1 371:8f7d2137727a 1179 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1180 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1181 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1182 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1183 */
rgrover1 371:8f7d2137727a 1184 SVCALL(SD_BLE_GAP_SEC_PARAMS_REPLY, uint32_t, sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset));
rgrover1 371:8f7d2137727a 1185
rgrover1 371:8f7d2137727a 1186
rgrover1 371:8f7d2137727a 1187 /**@brief Reply with an authentication key.
rgrover1 371:8f7d2137727a 1188 *
rgrover1 371:8f7d2137727a 1189 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1190 * @param[in] key_type See @ref BLE_GAP_AUTH_KEY_TYPES.
rgrover1 371:8f7d2137727a 1191 * @param[in] p_key If key type is @ref BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL.
rgrover1 371:8f7d2137727a 1192 * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination).
rgrover1 371:8f7d2137727a 1193 * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format.
rgrover1 371:8f7d2137727a 1194 *
rgrover1 371:8f7d2137727a 1195 * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE.
rgrover1 371:8f7d2137727a 1196 * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
rgrover1 371:8f7d2137727a 1197 *
rgrover1 371:8f7d2137727a 1198 * @retval ::NRF_SUCCESS Authentication key successfully set.
rgrover1 371:8f7d2137727a 1199 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1200 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1201 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1202 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1203 */
rgrover1 371:8f7d2137727a 1204 SVCALL(SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key));
rgrover1 371:8f7d2137727a 1205
rgrover1 371:8f7d2137727a 1206
rgrover1 371:8f7d2137727a 1207 /**@brief Initiate GAP Encryption procedure.
rgrover1 371:8f7d2137727a 1208 *
rgrover1 371:8f7d2137727a 1209 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1210 * @param[in] p_master_id Pointer to a @ref ble_gap_master_id_t master identification structure.
rgrover1 371:8f7d2137727a 1211 * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure.
rgrover1 371:8f7d2137727a 1212 *
rgrover1 371:8f7d2137727a 1213 * @details In the central role, this function will initiate the encryption procedure using the encryption information provided.
rgrover1 371:8f7d2137727a 1214 *
rgrover1 371:8f7d2137727a 1215 * @note Calling this function may result in the following event depending on the outcome and parameters: @ref BLE_GAP_EVT_CONN_SEC_UPDATE.
rgrover1 371:8f7d2137727a 1216 *
rgrover1 371:8f7d2137727a 1217 * @retval ::NRF_SUCCESS Successfully initiated authentication procedure.
rgrover1 371:8f7d2137727a 1218 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1219 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1220 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1221 * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role.
rgrover1 371:8f7d2137727a 1222 * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, wait for pending procedures to complete and retry.
rgrover1 371:8f7d2137727a 1223 */
rgrover1 371:8f7d2137727a 1224 SVCALL(SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info));
rgrover1 371:8f7d2137727a 1225
rgrover1 371:8f7d2137727a 1226
rgrover1 371:8f7d2137727a 1227 /**@brief Reply with GAP security information.
rgrover1 371:8f7d2137727a 1228 *
rgrover1 371:8f7d2137727a 1229 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1230 * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. May be NULL to signal none is available.
rgrover1 371:8f7d2137727a 1231 * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t identity information structure. May be NULL to signal none is available.
rgrover1 371:8f7d2137727a 1232 * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information structure. May be NULL to signal none is available.
rgrover1 371:8f7d2137727a 1233 *
rgrover1 371:8f7d2137727a 1234 * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in @ref NRF_ERROR_INVALID_STATE.
rgrover1 371:8f7d2137727a 1235 * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
rgrover1 371:8f7d2137727a 1236 * @note Data signing is not yet supported, and p_sign_info must therefore be NULL.
rgrover1 371:8f7d2137727a 1237 *
rgrover1 371:8f7d2137727a 1238 * @retval ::NRF_SUCCESS Successfully accepted security information.
rgrover1 371:8f7d2137727a 1239 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1240 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1241 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1242 */
rgrover1 371:8f7d2137727a 1243 SVCALL(SD_BLE_GAP_SEC_INFO_REPLY, uint32_t, sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t const *p_sign_info));
rgrover1 371:8f7d2137727a 1244
rgrover1 371:8f7d2137727a 1245
rgrover1 371:8f7d2137727a 1246 /**@brief Get the current connection security.
rgrover1 371:8f7d2137727a 1247 *
rgrover1 371:8f7d2137727a 1248 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1249 * @param[out] p_conn_sec Pointer to a @ref ble_gap_conn_sec_t structure to be filled in.
rgrover1 371:8f7d2137727a 1250 *
rgrover1 371:8f7d2137727a 1251 * @retval ::NRF_SUCCESS Current connection security successfully retrieved.
rgrover1 371:8f7d2137727a 1252 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1253 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1254 */
rgrover1 371:8f7d2137727a 1255 SVCALL(SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *p_conn_sec));
rgrover1 371:8f7d2137727a 1256
rgrover1 371:8f7d2137727a 1257
rgrover1 371:8f7d2137727a 1258 /**@brief Start reporting the received signal strength to the application.
rgrover1 371:8f7d2137727a 1259 *
rgrover1 371:8f7d2137727a 1260 * A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called.
rgrover1 371:8f7d2137727a 1261 *
rgrover1 371:8f7d2137727a 1262 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1263 * @param[in] threshold_dbm Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID.
rgrover1 371:8f7d2137727a 1264 * @param[in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new @ref BLE_GAP_EVT_RSSI_CHANGED event.
rgrover1 371:8f7d2137727a 1265 *
rgrover1 371:8f7d2137727a 1266 * @retval ::NRF_SUCCESS Successfully activated RSSI reporting.
rgrover1 371:8f7d2137727a 1267 * @retval ::NRF_ERROR_INVALID_STATE Disconnection in progress. Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1268 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1269 */
rgrover1 371:8f7d2137727a 1270 SVCALL(SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count));
rgrover1 371:8f7d2137727a 1271
rgrover1 371:8f7d2137727a 1272
rgrover1 371:8f7d2137727a 1273 /**@brief Stop reporting the received signal strength.
rgrover1 371:8f7d2137727a 1274 *
rgrover1 371:8f7d2137727a 1275 * @note An RSSI change detected before the call but not yet received by the application
rgrover1 371:8f7d2137727a 1276 * may be reported after @ref sd_ble_gap_rssi_stop has been called.
rgrover1 371:8f7d2137727a 1277 *
rgrover1 371:8f7d2137727a 1278 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1279 *
rgrover1 371:8f7d2137727a 1280 * @retval ::NRF_SUCCESS Successfully deactivated RSSI reporting.
rgrover1 371:8f7d2137727a 1281 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1282 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1283 */
rgrover1 371:8f7d2137727a 1284 SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle));
rgrover1 371:8f7d2137727a 1285
rgrover1 371:8f7d2137727a 1286
rgrover1 371:8f7d2137727a 1287 /**@brief Get the received signal strength for the last connection event.
rgrover1 371:8f7d2137727a 1288 *
rgrover1 371:8f7d2137727a 1289 * @param[in] conn_handle Connection handle.
rgrover1 371:8f7d2137727a 1290 * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored.
rgrover1 371:8f7d2137727a 1291 *
rgrover1 371:8f7d2137727a 1292 * @ref sd_ble_gap_rssi_start must be called to start reporting RSSI before using this function. @ref NRF_ERROR_NOT_FOUND
rgrover1 371:8f7d2137727a 1293 * will be returned until RSSI was sampled for the first time after calling @ref sd_ble_gap_rssi_start.
rgrover1 371:8f7d2137727a 1294 *
rgrover1 371:8f7d2137727a 1295 * @retval ::NRF_SUCCESS Successfully read the RSSI.
rgrover1 371:8f7d2137727a 1296 * @retval ::NRF_ERROR_NOT_FOUND No sample is available.
rgrover1 371:8f7d2137727a 1297 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1298 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
rgrover1 371:8f7d2137727a 1299 * @retval ::NRF_ERROR_INVALID_STATE RSSI reporting is not ongoing, or disconnection in progress.
rgrover1 371:8f7d2137727a 1300 */
rgrover1 371:8f7d2137727a 1301 SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi));
rgrover1 371:8f7d2137727a 1302
rgrover1 371:8f7d2137727a 1303
rgrover1 371:8f7d2137727a 1304 /**@brief Start scanning (GAP Discovery procedure, Observer Procedure).
rgrover1 371:8f7d2137727a 1305 *
rgrover1 371:8f7d2137727a 1306 * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL.
rgrover1 371:8f7d2137727a 1307 *
rgrover1 371:8f7d2137727a 1308 * @param[in] p_scan_params Pointer to scan parameters structure.
rgrover1 371:8f7d2137727a 1309 *
rgrover1 371:8f7d2137727a 1310 * @retval ::NRF_SUCCESS Successfully initiated scanning procedure.
rgrover1 371:8f7d2137727a 1311 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
rgrover1 371:8f7d2137727a 1312 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1313 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1314 * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry.
rgrover1 371:8f7d2137727a 1315 * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it.
rgrover1 371:8f7d2137727a 1316 */
rgrover1 371:8f7d2137727a 1317 SVCALL(SD_BLE_GAP_SCAN_START, uint32_t, sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params));
rgrover1 371:8f7d2137727a 1318
rgrover1 371:8f7d2137727a 1319
rgrover1 371:8f7d2137727a 1320 /**@brief Stop scanning (GAP Discovery procedure, Observer Procedure).
rgrover1 371:8f7d2137727a 1321 *
rgrover1 371:8f7d2137727a 1322 * @retval ::NRF_SUCCESS Successfully stopped scanning procedure.
rgrover1 371:8f7d2137727a 1323 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state).
rgrover1 371:8f7d2137727a 1324 */
rgrover1 371:8f7d2137727a 1325 SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void));
rgrover1 371:8f7d2137727a 1326
rgrover1 371:8f7d2137727a 1327
rgrover1 371:8f7d2137727a 1328 /**@brief Create a connection (GAP Link Establishment).
rgrover1 371:8f7d2137727a 1329 *
rgrover1 371:8f7d2137727a 1330 * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL.
rgrover1 371:8f7d2137727a 1331 *
rgrover1 371:8f7d2137727a 1332 * @param[in] p_peer_addr Pointer to peer address. If the selective bit is set in @ref ble_gap_scan_params_t, then this must be NULL.
rgrover1 371:8f7d2137727a 1333 * @param[in] p_scan_params Pointer to scan parameters structure.
rgrover1 371:8f7d2137727a 1334 * @param[in] p_conn_params Pointer to desired connection parameters.
rgrover1 371:8f7d2137727a 1335 *
rgrover1 371:8f7d2137727a 1336 * @retval ::NRF_SUCCESS Successfully initiated connection procedure.
rgrover1 371:8f7d2137727a 1337 * @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied.
rgrover1 371:8f7d2137727a 1338 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
rgrover1 371:8f7d2137727a 1339 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1340 * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address.
rgrover1 371:8f7d2137727a 1341 * @retval ::NRF_ERROR_NO_MEM limit of available connections reached.
rgrover1 371:8f7d2137727a 1342 * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established wait for the corresponding
rgrover1 371:8f7d2137727a 1343 * @ref BLE_GAP_EVT_CONNECTED event before calling again.
rgrover1 371:8f7d2137727a 1344 * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it.
rgrover1 371:8f7d2137727a 1345 */
rgrover1 371:8f7d2137727a 1346 SVCALL(SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params));
rgrover1 371:8f7d2137727a 1347
rgrover1 371:8f7d2137727a 1348
rgrover1 371:8f7d2137727a 1349 /**@brief Cancel a connection establishment.
rgrover1 371:8f7d2137727a 1350 *
rgrover1 371:8f7d2137727a 1351 * @retval ::NRF_SUCCESS Successfully cancelled an ongoing connection procedure.
rgrover1 371:8f7d2137727a 1352 * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
rgrover1 371:8f7d2137727a 1353 */
rgrover1 371:8f7d2137727a 1354 SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void));
rgrover1 371:8f7d2137727a 1355
rgrover1 371:8f7d2137727a 1356 /** @} */
rgrover1 371:8f7d2137727a 1357
rgrover1 371:8f7d2137727a 1358 #endif // BLE_GAP_H__
rgrover1 371:8f7d2137727a 1359
rgrover1 371:8f7d2137727a 1360 /**
rgrover1 371:8f7d2137727a 1361 @}
rgrover1 371:8f7d2137727a 1362 */