The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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