Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

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