Set write permission for 'write without response' characteristics.

Fork of nRF51822 by Nordic Semiconductor

Committer:
marcuschang
Date:
Fri Dec 12 17:12:35 2014 +0000
Revision:
85:17fe69405098
Parent:
37:c29c330d942c
Write permission was not set for 'write without response' characteristics.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
bogdanm 0:eff01767de02 2 *
bogdanm 0:eff01767de02 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
bogdanm 0:eff01767de02 4 * copying, transfer or disclosure of such information is prohibited except by express written
bogdanm 0:eff01767de02 5 * agreement with Nordic Semiconductor.
bogdanm 0:eff01767de02 6 *
bogdanm 0:eff01767de02 7 */
bogdanm 0:eff01767de02 8 /**
bogdanm 0:eff01767de02 9 @addtogroup BLE_GAP Generic Access Profile (GAP)
bogdanm 0:eff01767de02 10 @{
bogdanm 0:eff01767de02 11 @brief Definitions and prototypes for the GAP interface.
bogdanm 0:eff01767de02 12 */
bogdanm 0:eff01767de02 13
bogdanm 0:eff01767de02 14 #ifndef BLE_GAP_H__
bogdanm 0:eff01767de02 15 #define BLE_GAP_H__
bogdanm 0:eff01767de02 16
bogdanm 0:eff01767de02 17 #include "ble_types.h"
bogdanm 0:eff01767de02 18 #include "ble_ranges.h"
bogdanm 0:eff01767de02 19 #include "nrf_svc.h"
bogdanm 0:eff01767de02 20
Rohit Grover 37:c29c330d942c 21
Rohit Grover 37:c29c330d942c 22 /**@addtogroup BLE_GAP_ENUMERATIONS Enumerations
Rohit Grover 37:c29c330d942c 23 * @{ */
Rohit Grover 37:c29c330d942c 24
Rohit Grover 37:c29c330d942c 25 /**@brief GAP API SVC numbers.
bogdanm 0:eff01767de02 26 */
bogdanm 0:eff01767de02 27 enum BLE_GAP_SVCS
bogdanm 0:eff01767de02 28 {
bogdanm 0:eff01767de02 29 SD_BLE_GAP_ADDRESS_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */
bogdanm 0:eff01767de02 30 SD_BLE_GAP_ADDRESS_GET, /**< Get own Bluetooth Address. */
bogdanm 0:eff01767de02 31 SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertisement Data. */
bogdanm 0:eff01767de02 32 SD_BLE_GAP_ADV_START, /**< Start Advertising. */
bogdanm 0:eff01767de02 33 SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */
bogdanm 0:eff01767de02 34 SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */
bogdanm 0:eff01767de02 35 SD_BLE_GAP_DISCONNECT, /**< Disconnect. */
bogdanm 0:eff01767de02 36 SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */
bogdanm 0:eff01767de02 37 SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */
bogdanm 0:eff01767de02 38 SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */
bogdanm 0:eff01767de02 39 SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */
bogdanm 0:eff01767de02 40 SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */
bogdanm 0:eff01767de02 41 SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */
bogdanm 0:eff01767de02 42 SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */
bogdanm 0:eff01767de02 43 SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */
bogdanm 0:eff01767de02 44 SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */
bogdanm 0:eff01767de02 45 SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */
bogdanm 0:eff01767de02 46 SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */
bogdanm 0:eff01767de02 47 SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */
Rohit Grover 37:c29c330d942c 48 SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */
Rohit Grover 37:c29c330d942c 49 SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */
bogdanm 0:eff01767de02 50 };
Rohit Grover 37:c29c330d942c 51 /**@} */
bogdanm 0:eff01767de02 52
Rohit Grover 37:c29c330d942c 53 /**@addtogroup BLE_GAP_DEFINES Defines
bogdanm 0:eff01767de02 54 * @{ */
bogdanm 0:eff01767de02 55
Rohit Grover 37:c29c330d942c 56 /**@defgroup BLE_ERRORS_GAP SVC return values specific to GAP
bogdanm 0:eff01767de02 57 * @{ */
bogdanm 0:eff01767de02 58 #define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */
bogdanm 0:eff01767de02 59 #define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */
bogdanm 0:eff01767de02 60 #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. */
Rohit Grover 37:c29c330d942c 61 /**@} */
bogdanm 0:eff01767de02 62
bogdanm 0:eff01767de02 63
Rohit Grover 37:c29c330d942c 64 /**@defgroup BLE_GAP_ROLES GAP Roles
bogdanm 0:eff01767de02 65 * @note Not explicitly used in peripheral API, but will be relevant for central API.
bogdanm 0:eff01767de02 66 * @{ */
bogdanm 0:eff01767de02 67 #define BLE_GAP_ROLE_INVALID 0x0 /**< Invalid Role. */
bogdanm 0:eff01767de02 68 #define BLE_GAP_ROLE_PERIPH 0x1 /**< Peripheral Role. */
bogdanm 0:eff01767de02 69 #define BLE_GAP_ROLE_CENTRAL 0x2 /**< Central Role. */
Rohit Grover 37:c29c330d942c 70 /**@} */
bogdanm 0:eff01767de02 71
bogdanm 0:eff01767de02 72
Rohit Grover 37:c29c330d942c 73 /**@defgroup BLE_GAP_TIMEOUT_SOURCES GAP Timeout sources
bogdanm 0:eff01767de02 74 * @{ */
bogdanm 0:eff01767de02 75 #define BLE_GAP_TIMEOUT_SRC_ADVERTISEMENT 0x00 /**< Advertisement timeout. */
bogdanm 0:eff01767de02 76 #define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */
Rohit Grover 37:c29c330d942c 77 /**@} */
bogdanm 0:eff01767de02 78
bogdanm 0:eff01767de02 79
Rohit Grover 37:c29c330d942c 80 /**@defgroup BLE_GAP_ADDR_TYPES GAP Address types
bogdanm 0:eff01767de02 81 * @{ */
bogdanm 0:eff01767de02 82 #define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */
bogdanm 0:eff01767de02 83 #define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random Static address. */
bogdanm 0:eff01767de02 84 #define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Private Resolvable address. */
bogdanm 0:eff01767de02 85 #define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Private Non-Resolvable address. */
Rohit Grover 37:c29c330d942c 86 /**@} */
Rohit Grover 37:c29c330d942c 87
Rohit Grover 37:c29c330d942c 88 /**@defgroup BLE_GAP_ADDR_CYCLE_MODES GAP Address cycle modes
Rohit Grover 37:c29c330d942c 89 * @{ */
Rohit Grover 37:c29c330d942c 90 #define BLE_GAP_ADDR_CYCLE_MODE_NONE 0x00 /**< Set addresses directly, no automatic address cycling. */
Rohit Grover 37:c29c330d942c 91 #define BLE_GAP_ADDR_CYCLE_MODE_AUTO 0x01 /**< Automatically generate and update private addresses. */
bogdanm 0:eff01767de02 92 /** @} */
bogdanm 0:eff01767de02 93
Rohit Grover 37:c29c330d942c 94 /**@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. */
Rohit Grover 37:c29c330d942c 95 #define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (60 * 15)
bogdanm 0:eff01767de02 96
bogdanm 0:eff01767de02 97 /** @brief BLE address length. */
bogdanm 0:eff01767de02 98 #define BLE_GAP_ADDR_LEN 6
bogdanm 0:eff01767de02 99
bogdanm 0:eff01767de02 100
Rohit Grover 37:c29c330d942c 101 /**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format
Rohit Grover 37:c29c330d942c 102 * @note Found at https://www.bluetooth.org/Technical/AssignedNumbers/generic_access_profile.htm
bogdanm 0:eff01767de02 103 * @{ */
bogdanm 0:eff01767de02 104 #define BLE_GAP_AD_TYPE_FLAGS 0x01 /**< Flags for discoverability. */
bogdanm 0:eff01767de02 105 #define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE 0x02 /**< Partial list of 16 bit service UUIDs. */
bogdanm 0:eff01767de02 106 #define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE 0x03 /**< Complete list of 16 bit service UUIDs. */
bogdanm 0:eff01767de02 107 #define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE 0x04 /**< Partial list of 32 bit service UUIDs. */
bogdanm 0:eff01767de02 108 #define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE 0x05 /**< Complete list of 32 bit service UUIDs. */
bogdanm 0:eff01767de02 109 #define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE 0x06 /**< Partial list of 128 bit service UUIDs. */
bogdanm 0:eff01767de02 110 #define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE 0x07 /**< Complete list of 128 bit service UUIDs. */
bogdanm 0:eff01767de02 111 #define BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME 0x08 /**< Short local device name. */
bogdanm 0:eff01767de02 112 #define BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME 0x09 /**< Complete local device name. */
bogdanm 0:eff01767de02 113 #define BLE_GAP_AD_TYPE_TX_POWER_LEVEL 0x0A /**< Transmit power level. */
bogdanm 0:eff01767de02 114 #define BLE_GAP_AD_TYPE_CLASS_OF_DEVICE 0x0D /**< Class of device. */
bogdanm 0:eff01767de02 115 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C 0x0E /**< Simple Pairing Hash C. */
bogdanm 0:eff01767de02 116 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R 0x0F /**< Simple Pairing Randomizer R. */
bogdanm 0:eff01767de02 117 #define BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE 0x10 /**< Security Manager TK Value. */
bogdanm 0:eff01767de02 118 #define BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS 0x11 /**< Security Manager Out Of Band Flags. */
bogdanm 0:eff01767de02 119 #define BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 /**< Slave Connection Interval Range. */
bogdanm 0:eff01767de02 120 #define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT 0x14 /**< List of 16-bit Service Solicitation UUIDs. */
bogdanm 0:eff01767de02 121 #define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT 0x15 /**< List of 128-bit Service Solicitation UUIDs. */
Rohit Grover 37:c29c330d942c 122 #define BLE_GAP_AD_TYPE_SERVICE_DATA 0x16 /**< Service Data - 16-bit UUID. */
bogdanm 0:eff01767de02 123 #define BLE_GAP_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 /**< Public Target Address. */
bogdanm 0:eff01767de02 124 #define BLE_GAP_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 /**< Random Target Address. */
bogdanm 0:eff01767de02 125 #define BLE_GAP_AD_TYPE_APPEARANCE 0x19 /**< Appearance. */
Rohit Grover 37:c29c330d942c 126 #define BLE_GAP_AD_TYPE_ADVERTISING_INTERVAL 0x1A /**< Advertising Interval. */
Rohit Grover 37:c29c330d942c 127 #define BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS 0x1B /**< LE Bluetooth Device Address. */
Rohit Grover 37:c29c330d942c 128 #define BLE_GAP_AD_TYPE_LE_ROLE 0x1C /**< LE Role. */
Rohit Grover 37:c29c330d942c 129 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C256 0x1D /**< Simple Pairing Hash C-256. */
Rohit Grover 37:c29c330d942c 130 #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256 0x1E /**< Simple Pairing Randomizer R-256. */
Rohit Grover 37:c29c330d942c 131 #define BLE_GAP_AD_TYPE_SERVICE_DATA_32BIT_UUID 0x20 /**< Service Data - 32-bit UUID. */
Rohit Grover 37:c29c330d942c 132 #define BLE_GAP_AD_TYPE_SERVICE_DATA_128BIT_UUID 0x21 /**< Service Data - 128-bit UUID. */
Rohit Grover 37:c29c330d942c 133 #define BLE_GAP_AD_TYPE_3D_INFORMATION_DATA 0x3D /**< 3D Information Data. */
bogdanm 0:eff01767de02 134 #define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF /**< Manufacturer Specific Data. */
Rohit Grover 37:c29c330d942c 135 /**@} */
bogdanm 0:eff01767de02 136
bogdanm 0:eff01767de02 137
Rohit Grover 37:c29c330d942c 138 /**@defgroup BLE_GAP_ADV_FLAGS GAP Advertisement Flags
bogdanm 0:eff01767de02 139 * @{ */
bogdanm 0:eff01767de02 140 #define BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE (0x01) /**< LE Limited Discoverable Mode. */
bogdanm 0:eff01767de02 141 #define BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02) /**< LE General Discoverable Mode. */
bogdanm 0:eff01767de02 142 #define BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04) /**< BR/EDR not supported. */
bogdanm 0:eff01767de02 143 #define BLE_GAP_ADV_FLAG_LE_BR_EDR_CONTROLLER (0x08) /**< Simultaneous LE and BR/EDR, Controller. */
bogdanm 0:eff01767de02 144 #define BLE_GAP_ADV_FLAG_LE_BR_EDR_HOST (0x10) /**< Simultaneous LE and BR/EDR, Host. */
bogdanm 0:eff01767de02 145 #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. */
bogdanm 0:eff01767de02 146 #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. */
Rohit Grover 37:c29c330d942c 147 /**@} */
bogdanm 0:eff01767de02 148
bogdanm 0:eff01767de02 149
Rohit Grover 37:c29c330d942c 150 /**@defgroup BLE_GAP_ADV_INTERVALS GAP Advertising interval max and min
bogdanm 0:eff01767de02 151 * @{ */
bogdanm 0:eff01767de02 152 #define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */
bogdanm 0:eff01767de02 153 #define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */
bogdanm 0:eff01767de02 154 #define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */
Rohit Grover 37:c29c330d942c 155 /**@} */
bogdanm 0:eff01767de02 156
bogdanm 0:eff01767de02 157
Rohit Grover 37:c29c330d942c 158 /**@brief Maximum size of advertising data in octets. */
bogdanm 0:eff01767de02 159 #define BLE_GAP_ADV_MAX_SIZE 31
bogdanm 0:eff01767de02 160
bogdanm 0:eff01767de02 161
Rohit Grover 37:c29c330d942c 162 /**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types
bogdanm 0:eff01767de02 163 * @{ */
bogdanm 0:eff01767de02 164 #define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */
bogdanm 0:eff01767de02 165 #define BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01 /**< Connectable directed. */
bogdanm 0:eff01767de02 166 #define BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 /**< Scannable undirected. */
bogdanm 0:eff01767de02 167 #define BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 /**< Non connectable undirected. */
Rohit Grover 37:c29c330d942c 168 /**@} */
bogdanm 0:eff01767de02 169
bogdanm 0:eff01767de02 170
Rohit Grover 37:c29c330d942c 171 /**@defgroup BLE_GAP_ADV_FILTER_POLICIES GAP Advertising filter policies
bogdanm 0:eff01767de02 172 * @{ */
bogdanm 0:eff01767de02 173 #define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */
bogdanm 0:eff01767de02 174 #define BLE_GAP_ADV_FP_FILTER_SCANREQ 0x01 /**< Filter scan requests with whitelist. */
bogdanm 0:eff01767de02 175 #define BLE_GAP_ADV_FP_FILTER_CONNREQ 0x02 /**< Filter connect requests with whitelist. */
bogdanm 0:eff01767de02 176 #define BLE_GAP_ADV_FP_FILTER_BOTH 0x03 /**< Filter both scan and connect requests with whitelist. */
Rohit Grover 37:c29c330d942c 177 /**@} */
bogdanm 0:eff01767de02 178
bogdanm 0:eff01767de02 179
Rohit Grover 37:c29c330d942c 180 /**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values
bogdanm 0:eff01767de02 181 * @{ */
bogdanm 0:eff01767de02 182 #define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX 180 /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s in spec (Addendum 2)). */
bogdanm 0:eff01767de02 183 #define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED 0 /**< Unlimited advertising in general discoverable mode. */
Rohit Grover 37:c29c330d942c 184 /**@} */
bogdanm 0:eff01767de02 185
bogdanm 0:eff01767de02 186
Rohit Grover 37:c29c330d942c 187 /**@defgroup BLE_GAP_DISC_MODES GAP Discovery modes
bogdanm 0:eff01767de02 188 * @{ */
bogdanm 0:eff01767de02 189 #define BLE_GAP_DISC_MODE_NOT_DISCOVERABLE 0x00 /**< Not discoverable discovery Mode. */
bogdanm 0:eff01767de02 190 #define BLE_GAP_DISC_MODE_LIMITED 0x01 /**< Limited Discovery Mode. */
bogdanm 0:eff01767de02 191 #define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */
Rohit Grover 37:c29c330d942c 192 /**@} */
bogdanm 0:eff01767de02 193
Rohit Grover 37:c29c330d942c 194 /**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities
bogdanm 0:eff01767de02 195 * @{ */
bogdanm 0:eff01767de02 196 #define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */
bogdanm 0:eff01767de02 197 #define BLE_GAP_IO_CAPS_DISPLAY_YESNO 0x01 /**< Display and Yes/No entry. */
bogdanm 0:eff01767de02 198 #define BLE_GAP_IO_CAPS_KEYBOARD_ONLY 0x02 /**< Keyboard Only. */
bogdanm 0:eff01767de02 199 #define BLE_GAP_IO_CAPS_NONE 0x03 /**< No I/O capabilities. */
bogdanm 0:eff01767de02 200 #define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */
Rohit Grover 37:c29c330d942c 201 /**@} */
bogdanm 0:eff01767de02 202
bogdanm 0:eff01767de02 203
Rohit Grover 37:c29c330d942c 204 /**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types
bogdanm 0:eff01767de02 205 * @{ */
bogdanm 0:eff01767de02 206 #define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */
bogdanm 0:eff01767de02 207 #define BLE_GAP_AUTH_KEY_TYPE_PASSKEY 0x01 /**< 6-digit Passkey. */
bogdanm 0:eff01767de02 208 #define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */
Rohit Grover 37:c29c330d942c 209 /**@} */
bogdanm 0:eff01767de02 210
Rohit Grover 37:c29c330d942c 211 /**@defgroup BLE_GAP_SEC_STATUS GAP Security status
bogdanm 0:eff01767de02 212 * @{ */
bogdanm 0:eff01767de02 213 #define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Successful parameters. */
bogdanm 0:eff01767de02 214 #define BLE_GAP_SEC_STATUS_TIMEOUT 0x01 /**< Procedure timed out. */
bogdanm 0:eff01767de02 215 #define BLE_GAP_SEC_STATUS_PDU_INVALID 0x02 /**< Invalid PDU received. */
bogdanm 0:eff01767de02 216 #define BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED 0x81 /**< Passkey entry failed (user cancelled or other). */
bogdanm 0:eff01767de02 217 #define BLE_GAP_SEC_STATUS_OOB_NOT_AVAILABLE 0x82 /**< Out of Band Key not available. */
bogdanm 0:eff01767de02 218 #define BLE_GAP_SEC_STATUS_AUTH_REQ 0x83 /**< Authentication requirements not met. */
bogdanm 0:eff01767de02 219 #define BLE_GAP_SEC_STATUS_CONFIRM_VALUE 0x84 /**< Confirm value failed. */
bogdanm 0:eff01767de02 220 #define BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP 0x85 /**< Pairing not supported. */
bogdanm 0:eff01767de02 221 #define BLE_GAP_SEC_STATUS_ENC_KEY_SIZE 0x86 /**< Encryption key size. */
bogdanm 0:eff01767de02 222 #define BLE_GAP_SEC_STATUS_SMP_CMD_UNSUPPORTED 0x87 /**< Unsupported SMP command. */
bogdanm 0:eff01767de02 223 #define BLE_GAP_SEC_STATUS_UNSPECIFIED 0x88 /**< Unspecified reason. */
bogdanm 0:eff01767de02 224 #define BLE_GAP_SEC_STATUS_REPEATED_ATTEMPTS 0x89 /**< Too little time elapsed since last attempt. */
bogdanm 0:eff01767de02 225 #define BLE_GAP_SEC_STATUS_INVALID_PARAMS 0x8A /**< Invalid parameters. */
Rohit Grover 37:c29c330d942c 226 /**@} */
bogdanm 0:eff01767de02 227
Rohit Grover 37:c29c330d942c 228 /**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources
bogdanm 0:eff01767de02 229 * @{ */
bogdanm 0:eff01767de02 230 #define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */
bogdanm 0:eff01767de02 231 #define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */
Rohit Grover 37:c29c330d942c 232 /**@} */
bogdanm 0:eff01767de02 233
Rohit Grover 37:c29c330d942c 234 /**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits
bogdanm 0:eff01767de02 235 * @{ */
bogdanm 0:eff01767de02 236 #define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connction interval specified in connect parameters. */
bogdanm 0:eff01767de02 237 #define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest mimimum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */
bogdanm 0:eff01767de02 238 #define BLE_GAP_CP_MIN_CONN_INTVL_MAX 0x0C80 /**< Highest minimum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */
bogdanm 0:eff01767de02 239 #define BLE_GAP_CP_MAX_CONN_INTVL_NONE 0xFFFF /**< No new maximum connction interval specified in connect parameters. */
bogdanm 0:eff01767de02 240 #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. */
bogdanm 0:eff01767de02 241 #define BLE_GAP_CP_MAX_CONN_INTVL_MAX 0x0C80 /**< Highest maximum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */
bogdanm 0:eff01767de02 242 #define BLE_GAP_CP_SLAVE_LATENCY_MAX 0x03E8 /**< Highest slave latency permitted, in connection events. */
bogdanm 0:eff01767de02 243 #define BLE_GAP_CP_CONN_SUP_TIMEOUT_NONE 0xFFFF /**< No new supervision timeout specified in connect parameters. */
bogdanm 0:eff01767de02 244 #define BLE_GAP_CP_CONN_SUP_TIMEOUT_MIN 0x000A /**< Lowest supervision timeout permitted, in units of 10 ms, i.e. 100 ms. */
bogdanm 0:eff01767de02 245 #define BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX 0x0C80 /**< Highest supervision timeout permitted, in units of 10 ms, i.e. 32 s. */
Rohit Grover 37:c29c330d942c 246 /**@} */
bogdanm 0:eff01767de02 247
bogdanm 0:eff01767de02 248
bogdanm 0:eff01767de02 249 /**@brief GAP device name maximum length. */
bogdanm 0:eff01767de02 250 #define BLE_GAP_DEVNAME_MAX_LEN 31
bogdanm 0:eff01767de02 251
bogdanm 0:eff01767de02 252
Rohit Grover 37:c29c330d942c 253 /**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters
bogdanm 0:eff01767de02 254 *
bogdanm 0:eff01767de02 255 * See @ref ble_gap_conn_sec_mode_t.
bogdanm 0:eff01767de02 256 * @{ */
Rohit Grover 37:c29c330d942c 257 /**@brief Set sec_mode pointed to by ptr to have no access rights.*/
bogdanm 0:eff01767de02 258 #define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr) do {(ptr)->sm = 0; (ptr)->lv = 0;} while(0)
Rohit Grover 37:c29c330d942c 259 /**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/
bogdanm 0:eff01767de02 260 #define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr) do {(ptr)->sm = 1; (ptr)->lv = 1;} while(0)
Rohit Grover 37:c29c330d942c 261 /**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/
bogdanm 0:eff01767de02 262 #define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 2;} while(0)
Rohit Grover 37:c29c330d942c 263 /**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/
bogdanm 0:eff01767de02 264 #define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 3;} while(0)
Rohit Grover 37:c29c330d942c 265 /**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/
bogdanm 0:eff01767de02 266 #define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 1;} while(0)
Rohit Grover 37:c29c330d942c 267 /**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/
bogdanm 0:eff01767de02 268 #define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 2;} while(0)
Rohit Grover 37:c29c330d942c 269 /**@} */
bogdanm 0:eff01767de02 270
bogdanm 0:eff01767de02 271
bogdanm 0:eff01767de02 272 /**@brief GAP Security Key Length. */
bogdanm 0:eff01767de02 273 #define BLE_GAP_SEC_KEY_LEN 16
bogdanm 0:eff01767de02 274
Rohit Grover 37:c29c330d942c 275 /**@brief GAP Passkey Length. */
Rohit Grover 37:c29c330d942c 276 #define BLE_GAP_PASSKEY_LEN 6
Rohit Grover 37:c29c330d942c 277
bogdanm 0:eff01767de02 278 /**@brief Maximum amount of addresses in a whitelist. */
bogdanm 0:eff01767de02 279 #define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8)
bogdanm 0:eff01767de02 280
bogdanm 0:eff01767de02 281 /**@brief Maximum amount of IRKs in a whitelist.
bogdanm 0:eff01767de02 282 * @note The number of IRKs is limited to 8, even if the hardware supports more.
bogdanm 0:eff01767de02 283 */
bogdanm 0:eff01767de02 284 #define BLE_GAP_WHITELIST_IRK_MAX_COUNT (8)
bogdanm 0:eff01767de02 285
Rohit Grover 37:c29c330d942c 286 /**@defgroup GAP_SEC_MODES GAP Security Modes
bogdanm 0:eff01767de02 287 * @{ */
bogdanm 0:eff01767de02 288 #define BLE_GAP_SEC_MODE 0x00 /**< No key (may be used to reject). */
Rohit Grover 37:c29c330d942c 289 /**@} */
bogdanm 0:eff01767de02 290
Rohit Grover 37:c29c330d942c 291 /**@} */
bogdanm 0:eff01767de02 292
Rohit Grover 37:c29c330d942c 293 /**@addtogroup BLE_GAP_STRUCTURES Structures
Rohit Grover 37:c29c330d942c 294 * @{ */
bogdanm 0:eff01767de02 295
bogdanm 0:eff01767de02 296 /**@brief Bluetooth Low Energy address. */
bogdanm 0:eff01767de02 297 typedef struct
bogdanm 0:eff01767de02 298 {
bogdanm 0:eff01767de02 299 uint8_t addr_type; /**< See @ref BLE_GAP_ADDR_TYPES. */
bogdanm 0:eff01767de02 300 uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */
bogdanm 0:eff01767de02 301 } ble_gap_addr_t;
bogdanm 0:eff01767de02 302
bogdanm 0:eff01767de02 303
bogdanm 0:eff01767de02 304 /**@brief GAP connection parameters.
bogdanm 0:eff01767de02 305 *
bogdanm 0:eff01767de02 306 * @note When ble_conn_params_t is received in an event, both min_conn_interval and
bogdanm 0:eff01767de02 307 * max_conn_interval will be equal to the connection interval set by the central.
bogdanm 0:eff01767de02 308 */
bogdanm 0:eff01767de02 309 typedef struct
bogdanm 0:eff01767de02 310 {
bogdanm 0:eff01767de02 311 uint16_t min_conn_interval; /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/
bogdanm 0:eff01767de02 312 uint16_t max_conn_interval; /**< Maximum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/
bogdanm 0:eff01767de02 313 uint16_t slave_latency; /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/
bogdanm 0:eff01767de02 314 uint16_t conn_sup_timeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/
bogdanm 0:eff01767de02 315 } ble_gap_conn_params_t;
bogdanm 0:eff01767de02 316
bogdanm 0:eff01767de02 317
bogdanm 0:eff01767de02 318 /**@brief GAP link requirements.
bogdanm 0:eff01767de02 319 *
bogdanm 0:eff01767de02 320 * See Bluetooth Core specification, Volume 3 Part C 10.2 for details.
bogdanm 0:eff01767de02 321 *
bogdanm 0:eff01767de02 322 * Security Mode 0 Level 0: No access permissions at all (this level is not defined by the Bluetooth Core specification).\n
bogdanm 0:eff01767de02 323 * Security Mode 1 Level 1: No security is needed (aka open link).\n
bogdanm 0:eff01767de02 324 * Security Mode 1 Level 2: Encrypted link required, MITM protection not necessary.\n
bogdanm 0:eff01767de02 325 * Security Mode 1 Level 3: MITM protected encrypted link required.\n
bogdanm 0:eff01767de02 326 * Security Mode 2 Level 1: Signing or encryption required, MITM protection not necessary.\n
bogdanm 0:eff01767de02 327 * Security Mode 2 Level 2: MITM protected signing required, unless link is MITM protected encrypted.\n
bogdanm 0:eff01767de02 328 */
bogdanm 0:eff01767de02 329 typedef struct
bogdanm 0:eff01767de02 330 {
bogdanm 0:eff01767de02 331 uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */
bogdanm 0:eff01767de02 332 uint8_t lv : 4; /**< Level (1, 2 or 3), 0 for no permissions at all. */
bogdanm 0:eff01767de02 333
bogdanm 0:eff01767de02 334 } ble_gap_conn_sec_mode_t;
bogdanm 0:eff01767de02 335
bogdanm 0:eff01767de02 336
bogdanm 0:eff01767de02 337 /**@brief GAP connection security status.*/
bogdanm 0:eff01767de02 338 typedef struct
bogdanm 0:eff01767de02 339 {
bogdanm 0:eff01767de02 340 ble_gap_conn_sec_mode_t sec_mode; /**< Currently active security mode for this connection.*/
Rohit Grover 37:c29c330d942c 341 uint8_t encr_key_size; /**< Length of currently active encryption key, 7 to 16 octets (only applicable for bonding procedures). */
bogdanm 0:eff01767de02 342 } ble_gap_conn_sec_t;
bogdanm 0:eff01767de02 343
bogdanm 0:eff01767de02 344
bogdanm 0:eff01767de02 345 /**@brief Identity Resolving Key. */
bogdanm 0:eff01767de02 346 typedef struct
bogdanm 0:eff01767de02 347 {
bogdanm 0:eff01767de02 348 uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing IRK. */
bogdanm 0:eff01767de02 349 } ble_gap_irk_t;
bogdanm 0:eff01767de02 350
bogdanm 0:eff01767de02 351
bogdanm 0:eff01767de02 352 /**@brief Whitelist structure. */
bogdanm 0:eff01767de02 353 typedef struct
bogdanm 0:eff01767de02 354 {
bogdanm 0:eff01767de02 355 ble_gap_addr_t ** pp_addrs; /**< Pointer to array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */
bogdanm 0:eff01767de02 356 uint8_t addr_count; /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */
bogdanm 0:eff01767de02 357 ble_gap_irk_t ** pp_irks; /**< Pointer to array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are given. */
bogdanm 0:eff01767de02 358 uint8_t irk_count; /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */
bogdanm 0:eff01767de02 359 } ble_gap_whitelist_t;
bogdanm 0:eff01767de02 360
bogdanm 0:eff01767de02 361
bogdanm 0:eff01767de02 362 /**@brief GAP advertising parameters.*/
bogdanm 0:eff01767de02 363 typedef struct
bogdanm 0:eff01767de02 364 {
bogdanm 0:eff01767de02 365 uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */
bogdanm 0:eff01767de02 366 ble_gap_addr_t* p_peer_addr; /**< For BLE_GAP_CONN_MODE_DIRECTED mode only, known peer address. */
bogdanm 0:eff01767de02 367 uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */
bogdanm 0:eff01767de02 368 ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if none is given. */
bogdanm 0:eff01767de02 369 uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS. This parameter must be set to 0 if type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND. */
bogdanm 0:eff01767de02 370 uint16_t timeout; /**< Advertising timeout between 0x0001 and 0x3FFF in seconds, 0x0000 disables timeout. See also @ref BLE_GAP_ADV_TIMEOUT_VALUES. This parameter must be set to 0 if type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND. */
bogdanm 0:eff01767de02 371 } ble_gap_adv_params_t;
bogdanm 0:eff01767de02 372
bogdanm 0:eff01767de02 373
bogdanm 0:eff01767de02 374 /**@brief GAP scanning parameters. */
bogdanm 0:eff01767de02 375 typedef struct
bogdanm 0:eff01767de02 376 {
bogdanm 0:eff01767de02 377 uint8_t filter; /**< Filter based on discovery mode, see @ref BLE_GAP_DISC_MODES. */
bogdanm 0:eff01767de02 378 uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */
bogdanm 0:eff01767de02 379 uint8_t selective : 1; /**< If 1, ignore unknown devices (non whitelisted). */
bogdanm 0:eff01767de02 380 uint16_t interval; /**< Scan interval between 0x0020 and 0x4000 in 0.625ms units (20ms to 10.24s). */
bogdanm 0:eff01767de02 381 uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
bogdanm 0:eff01767de02 382 uint16_t timeout; /**< Scan timeout between 0x0001 and 0x3FFF in seconds, 0x0000 disables timeout. */
bogdanm 0:eff01767de02 383 } ble_gap_scan_params_t;
bogdanm 0:eff01767de02 384
bogdanm 0:eff01767de02 385
bogdanm 0:eff01767de02 386 /**@brief GAP security parameters. */
bogdanm 0:eff01767de02 387 typedef struct
bogdanm 0:eff01767de02 388 {
bogdanm 0:eff01767de02 389 uint16_t timeout; /**< Timeout for SMP transactions or Security Request in seconds, see @ref sd_ble_gap_authenticate and @ref sd_ble_gap_sec_params_reply for more information. */
bogdanm 0:eff01767de02 390 uint8_t bond : 1; /**< Perform bonding. */
bogdanm 0:eff01767de02 391 uint8_t mitm : 1; /**< Man In The Middle protection required. */
bogdanm 0:eff01767de02 392 uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */
bogdanm 0:eff01767de02 393 uint8_t oob : 1; /**< Out Of Band data available. */
bogdanm 0:eff01767de02 394 uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. */
bogdanm 0:eff01767de02 395 uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */
bogdanm 0:eff01767de02 396 } ble_gap_sec_params_t;
bogdanm 0:eff01767de02 397
bogdanm 0:eff01767de02 398
bogdanm 0:eff01767de02 399 /**@brief GAP Encryption Information. */
bogdanm 0:eff01767de02 400 typedef struct
bogdanm 0:eff01767de02 401 {
bogdanm 0:eff01767de02 402 uint16_t div; /**< Encryption Diversifier. */
bogdanm 0:eff01767de02 403 uint8_t ltk[BLE_GAP_SEC_KEY_LEN]; /**< Long Term Key. */
bogdanm 0:eff01767de02 404 uint8_t auth : 1; /**< Authenticated Key. */
bogdanm 0:eff01767de02 405 uint8_t ltk_len : 7; /**< LTK length in octets. */
bogdanm 0:eff01767de02 406 } ble_gap_enc_info_t;
bogdanm 0:eff01767de02 407
bogdanm 0:eff01767de02 408
bogdanm 0:eff01767de02 409 /**@brief GAP Master Identification. */
bogdanm 0:eff01767de02 410 typedef struct
bogdanm 0:eff01767de02 411 {
bogdanm 0:eff01767de02 412 uint16_t ediv; /**< Encrypted Diversifier. */
bogdanm 0:eff01767de02 413 uint8_t rand[8]; /**< Random Number. */
bogdanm 0:eff01767de02 414 } ble_gap_master_id_t;
bogdanm 0:eff01767de02 415
bogdanm 0:eff01767de02 416
bogdanm 0:eff01767de02 417 /**@brief GAP Identity Information. */
bogdanm 0:eff01767de02 418 typedef struct
bogdanm 0:eff01767de02 419 {
bogdanm 0:eff01767de02 420 ble_gap_addr_t addr; /**< Bluetooth address to which this key applies. */
bogdanm 0:eff01767de02 421 uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Identity Resolution Key. */
bogdanm 0:eff01767de02 422 } ble_gap_id_info_t;
bogdanm 0:eff01767de02 423
bogdanm 0:eff01767de02 424
bogdanm 0:eff01767de02 425 /**@brief GAP Signing Information. */
bogdanm 0:eff01767de02 426 typedef struct
bogdanm 0:eff01767de02 427 {
bogdanm 0:eff01767de02 428 uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /* Connection Signature Resolving Key. */
bogdanm 0:eff01767de02 429 } ble_gap_sign_info_t;
bogdanm 0:eff01767de02 430
bogdanm 0:eff01767de02 431
Rohit Grover 37:c29c330d942c 432 /**@brief GAP Event IDs.
bogdanm 0:eff01767de02 433 * Those IDs uniquely identify an event coming from the stack to the application.
bogdanm 0:eff01767de02 434 */
bogdanm 0:eff01767de02 435 enum BLE_GAP_EVTS
bogdanm 0:eff01767de02 436 {
bogdanm 0:eff01767de02 437 BLE_GAP_EVT_CONNECTED = BLE_GAP_EVT_BASE, /**< Connection established. */
bogdanm 0:eff01767de02 438 BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. */
bogdanm 0:eff01767de02 439 BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. */
bogdanm 0:eff01767de02 440 BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. */
bogdanm 0:eff01767de02 441 BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. */
bogdanm 0:eff01767de02 442 BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. */
bogdanm 0:eff01767de02 443 BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. */
bogdanm 0:eff01767de02 444 BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. */
bogdanm 0:eff01767de02 445 BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. */
bogdanm 0:eff01767de02 446 BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. */
bogdanm 0:eff01767de02 447 BLE_GAP_EVT_RSSI_CHANGED, /**< Signal strength measurement report. */
bogdanm 0:eff01767de02 448 };
bogdanm 0:eff01767de02 449
bogdanm 0:eff01767de02 450
Rohit Grover 37:c29c330d942c 451 /**
Rohit Grover 37:c29c330d942c 452 * @brief GAP Option IDs.
Rohit Grover 37:c29c330d942c 453 * IDs that uniquely identify a GAP option.
Rohit Grover 37:c29c330d942c 454 */
Rohit Grover 37:c29c330d942c 455 enum BLE_GAP_OPTS
Rohit Grover 37:c29c330d942c 456 {
Rohit Grover 37:c29c330d942c 457 BLE_GAP_OPT_LOCAL_CONN_LATENCY = BLE_GAP_OPT_BASE, /**< Local connection latency. */
Rohit Grover 37:c29c330d942c 458 BLE_GAP_OPT_PASSKEY, /**< Set passkey to be used during pairing. This option can be used to make the SoftDevice use an application provided passkey instead of generating a random passkey.*/
Rohit Grover 37:c29c330d942c 459 BLE_GAP_OPT_PRIVACY, /**< Set or get custom IRK or custom private address cycle interval. */
Rohit Grover 37:c29c330d942c 460 };
Rohit Grover 37:c29c330d942c 461 /**@} */
Rohit Grover 37:c29c330d942c 462
Rohit Grover 37:c29c330d942c 463
Rohit Grover 37:c29c330d942c 464 /**@brief Event data for connected event. */
bogdanm 0:eff01767de02 465 typedef struct
bogdanm 0:eff01767de02 466 {
bogdanm 0:eff01767de02 467 ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
bogdanm 0:eff01767de02 468 uint8_t irk_match :1; /**< If 1, peer device's address resolved using an IRK. */
bogdanm 0:eff01767de02 469 uint8_t irk_match_idx :7; /**< Index in IRK list where the address was matched. */
bogdanm 0:eff01767de02 470 ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */
bogdanm 0:eff01767de02 471 } ble_gap_evt_connected_t;
bogdanm 0:eff01767de02 472
bogdanm 0:eff01767de02 473
Rohit Grover 37:c29c330d942c 474 /**@brief Event data for disconnected event. */
bogdanm 0:eff01767de02 475 typedef struct
bogdanm 0:eff01767de02 476 {
bogdanm 0:eff01767de02 477 uint8_t reason; /**< HCI error code. */
bogdanm 0:eff01767de02 478 } ble_gap_evt_disconnected_t;
bogdanm 0:eff01767de02 479
bogdanm 0:eff01767de02 480
Rohit Grover 37:c29c330d942c 481 /**@brief Event data for connection parameter update event. */
bogdanm 0:eff01767de02 482 typedef struct
bogdanm 0:eff01767de02 483 {
bogdanm 0:eff01767de02 484 ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */
bogdanm 0:eff01767de02 485 } ble_gap_evt_conn_param_update_t;
bogdanm 0:eff01767de02 486
bogdanm 0:eff01767de02 487
Rohit Grover 37:c29c330d942c 488 /**@brief Event data for security parameters request event. */
bogdanm 0:eff01767de02 489 typedef struct
bogdanm 0:eff01767de02 490 {
bogdanm 0:eff01767de02 491 ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */
bogdanm 0:eff01767de02 492 } ble_gap_evt_sec_params_request_t;
bogdanm 0:eff01767de02 493
bogdanm 0:eff01767de02 494
Rohit Grover 37:c29c330d942c 495 /**@brief Event data for security info request event. */
bogdanm 0:eff01767de02 496 typedef struct
bogdanm 0:eff01767de02 497 {
bogdanm 0:eff01767de02 498 ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
bogdanm 0:eff01767de02 499 uint16_t div; /**< Encryption diversifier for LTK lookup. */
bogdanm 0:eff01767de02 500 uint8_t enc_info : 1; /**< If 1, Encryption Information required. */
bogdanm 0:eff01767de02 501 uint8_t id_info : 1; /**< If 1, Identity Information required. */
bogdanm 0:eff01767de02 502 uint8_t sign_info : 1; /**< If 1, Signing Information required. */
bogdanm 0:eff01767de02 503 } ble_gap_evt_sec_info_request_t;
bogdanm 0:eff01767de02 504
bogdanm 0:eff01767de02 505
Rohit Grover 37:c29c330d942c 506 /**@brief Event data for passkey display event. */
bogdanm 0:eff01767de02 507 typedef struct
bogdanm 0:eff01767de02 508 {
Rohit Grover 37:c29c330d942c 509 uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */
bogdanm 0:eff01767de02 510 } ble_gap_evt_passkey_display_t;
bogdanm 0:eff01767de02 511
bogdanm 0:eff01767de02 512
Rohit Grover 37:c29c330d942c 513 /**@brief Event data for authentication key request event. */
bogdanm 0:eff01767de02 514 typedef struct
bogdanm 0:eff01767de02 515 {
bogdanm 0:eff01767de02 516 uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */
bogdanm 0:eff01767de02 517 } ble_gap_evt_auth_key_request_t;
bogdanm 0:eff01767de02 518
bogdanm 0:eff01767de02 519
Rohit Grover 37:c29c330d942c 520 /**@brief Security levels supported.
Rohit Grover 37:c29c330d942c 521 * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10.
bogdanm 0:eff01767de02 522 */
bogdanm 0:eff01767de02 523 typedef struct
bogdanm 0:eff01767de02 524 {
bogdanm 0:eff01767de02 525 uint8_t lv1 : 1; /**< If 1: Level 1 is supported. */
bogdanm 0:eff01767de02 526 uint8_t lv2 : 1; /**< If 1: Level 2 is supported. */
bogdanm 0:eff01767de02 527 uint8_t lv3 : 1; /**< If 1: Level 3 is supported. */
bogdanm 0:eff01767de02 528 } ble_gap_sec_levels_t;
bogdanm 0:eff01767de02 529
bogdanm 0:eff01767de02 530
Rohit Grover 37:c29c330d942c 531 /**@brief Keys that have been exchanged. */
bogdanm 0:eff01767de02 532 typedef struct
bogdanm 0:eff01767de02 533 {
bogdanm 0:eff01767de02 534 uint8_t ltk : 1; /**< Long Term Key. */
bogdanm 0:eff01767de02 535 uint8_t ediv_rand : 1; /**< Encrypted Diversifier and Random value. */
bogdanm 0:eff01767de02 536 uint8_t irk : 1; /**< Identity Resolving Key. */
bogdanm 0:eff01767de02 537 uint8_t address : 1; /**< Public or static random address. */
bogdanm 0:eff01767de02 538 uint8_t csrk : 1; /**< Connection Signature Resolving Key. */
bogdanm 0:eff01767de02 539 } ble_gap_sec_keys_t;
bogdanm 0:eff01767de02 540
bogdanm 0:eff01767de02 541
Rohit Grover 37:c29c330d942c 542 /**@brief Event data for authentication status event. */
bogdanm 0:eff01767de02 543 typedef struct
bogdanm 0:eff01767de02 544 {
bogdanm 0:eff01767de02 545 uint8_t auth_status; /**< Authentication status, see @ref BLE_GAP_SEC_STATUS. */
bogdanm 0:eff01767de02 546 uint8_t error_src; /**< On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */
bogdanm 0:eff01767de02 547 ble_gap_sec_levels_t sm1_levels; /**< Levels supported in Security Mode 1. */
bogdanm 0:eff01767de02 548 ble_gap_sec_levels_t sm2_levels; /**< Levels supported in Security Mode 2. */
bogdanm 0:eff01767de02 549 ble_gap_sec_keys_t periph_kex; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */
bogdanm 0:eff01767de02 550 ble_gap_sec_keys_t central_kex; /**< Bitmap stating which keys were exchanged (distributed) by the central. */
bogdanm 0:eff01767de02 551 struct periph_keys_t
bogdanm 0:eff01767de02 552 {
bogdanm 0:eff01767de02 553 ble_gap_enc_info_t enc_info; /**< Peripheral's Encryption information. */
Rohit Grover 37:c29c330d942c 554 } periph_keys; /**< Actual keys distributed from the Peripheral to the Central. */
bogdanm 0:eff01767de02 555 struct central_keys_t
bogdanm 0:eff01767de02 556 {
bogdanm 0:eff01767de02 557 ble_gap_irk_t irk; /**< Central's IRK. */
bogdanm 0:eff01767de02 558 ble_gap_addr_t id_info; /**< Central's Identity Info. */
bogdanm 0:eff01767de02 559 } central_keys; /**< Actual keys distributed from the Central to the Peripheral. */
bogdanm 0:eff01767de02 560 } ble_gap_evt_auth_status_t;
bogdanm 0:eff01767de02 561
bogdanm 0:eff01767de02 562
Rohit Grover 37:c29c330d942c 563 /**@brief Event data for connection security update event. */
bogdanm 0:eff01767de02 564 typedef struct
bogdanm 0:eff01767de02 565 {
bogdanm 0:eff01767de02 566 ble_gap_conn_sec_t conn_sec; /**< Connection security level. */
bogdanm 0:eff01767de02 567 } ble_gap_evt_conn_sec_update_t;
bogdanm 0:eff01767de02 568
bogdanm 0:eff01767de02 569
Rohit Grover 37:c29c330d942c 570 /**@brief Event data for timeout event. */
bogdanm 0:eff01767de02 571 typedef struct
bogdanm 0:eff01767de02 572 {
bogdanm 0:eff01767de02 573 uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */
bogdanm 0:eff01767de02 574 } ble_gap_evt_timeout_t;
bogdanm 0:eff01767de02 575
bogdanm 0:eff01767de02 576
Rohit Grover 37:c29c330d942c 577 /**@brief Event data for advertisement report event. */
bogdanm 0:eff01767de02 578 typedef struct
bogdanm 0:eff01767de02 579 {
bogdanm 0:eff01767de02 580 int8_t rssi; /**< Received Signal Strength Indication in dBm. */
bogdanm 0:eff01767de02 581 } ble_gap_evt_rssi_changed_t;
bogdanm 0:eff01767de02 582
bogdanm 0:eff01767de02 583
bogdanm 0:eff01767de02 584 /**@brief GAP event callback event structure. */
bogdanm 0:eff01767de02 585 typedef struct
bogdanm 0:eff01767de02 586 {
bogdanm 0:eff01767de02 587 uint16_t conn_handle; /**< Connection Handle on which event occured. */
bogdanm 0:eff01767de02 588 union /**< union alternative identified by evt_id in enclosing struct. */
bogdanm 0:eff01767de02 589 {
bogdanm 0:eff01767de02 590 ble_gap_evt_connected_t connected; /**< Connected Event Parameters. */
bogdanm 0:eff01767de02 591 ble_gap_evt_disconnected_t disconnected; /**< Disconnected Event Parameters. */
bogdanm 0:eff01767de02 592 ble_gap_evt_conn_param_update_t conn_param_update; /**< Connection Parameter Update Parameters. */
bogdanm 0:eff01767de02 593 ble_gap_evt_sec_params_request_t sec_params_request; /**< Security Parameters Request Event Parameters. */
bogdanm 0:eff01767de02 594 ble_gap_evt_sec_info_request_t sec_info_request; /**< Security Information Request Event Parameters. */
bogdanm 0:eff01767de02 595 ble_gap_evt_passkey_display_t passkey_display; /**< Passkey Display Event Parameters. */
bogdanm 0:eff01767de02 596 ble_gap_evt_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */
bogdanm 0:eff01767de02 597 ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */
bogdanm 0:eff01767de02 598 ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */
bogdanm 0:eff01767de02 599 ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */
bogdanm 0:eff01767de02 600 ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event parameters. */
bogdanm 0:eff01767de02 601 } params;
bogdanm 0:eff01767de02 602
bogdanm 0:eff01767de02 603 } ble_gap_evt_t;
bogdanm 0:eff01767de02 604
bogdanm 0:eff01767de02 605
Rohit Grover 37:c29c330d942c 606 /**@brief Local connection latency option.
Rohit Grover 37:c29c330d942c 607 *
Rohit Grover 37:c29c330d942c 608 * Local connection latency is a feature which enables the slave to improve
Rohit Grover 37:c29c330d942c 609 * current consumption by ignoring the slave latency set by the peer. The
Rohit Grover 37:c29c330d942c 610 * local connection latency can only be set to a multiple of the slave latency,
Rohit Grover 37:c29c330d942c 611 * and cannot be longer than half of the supervision timeout.
Rohit Grover 37:c29c330d942c 612 *
Rohit Grover 37:c29c330d942c 613 * Used with @ref sd_ble_opt_set to set the local connection latency. The
Rohit Grover 37:c29c330d942c 614 * @ref sd_ble_opt_get is not supported for this option, but the actual
Rohit Grover 37:c29c330d942c 615 * local connection latency (unless set to NULL) is set as a return parameter
Rohit Grover 37:c29c330d942c 616 * when setting the option.
Rohit Grover 37:c29c330d942c 617 *
Rohit Grover 37:c29c330d942c 618 * @note The latency set will be truncated down to the closest slave latency event
Rohit Grover 37:c29c330d942c 619 * multiple, or the nearest multiple before half of the supervision timeout.
Rohit Grover 37:c29c330d942c 620 *
Rohit Grover 37:c29c330d942c 621 * @note The local connection latency is default off, and needs to be set for new
Rohit Grover 37:c29c330d942c 622 * connections and whenever the connection is updated.
Rohit Grover 37:c29c330d942c 623 *
Rohit Grover 37:c29c330d942c 624 * @retval ::NRF_SUCCESS Set successfully.
Rohit Grover 37:c29c330d942c 625 * @retval ::NRF_ERROR_NOT_SUPPORTED Get is not supported.
Rohit Grover 37:c29c330d942c 626 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter.
Rohit Grover 37:c29c330d942c 627 */
Rohit Grover 37:c29c330d942c 628 typedef struct
Rohit Grover 37:c29c330d942c 629 {
Rohit Grover 37:c29c330d942c 630 uint16_t conn_handle; /**< Connection Handle */
Rohit Grover 37:c29c330d942c 631 uint16_t requested_latency; /**< Requested local connection latency. */
Rohit Grover 37:c29c330d942c 632 uint16_t * p_actual_latency; /**< Pointer to storage for the actual local connection latency (can be set to NULL to skip return value). */
Rohit Grover 37:c29c330d942c 633 } ble_gap_opt_local_conn_latency_t;
Rohit Grover 37:c29c330d942c 634
Rohit Grover 37:c29c330d942c 635
Rohit Grover 37:c29c330d942c 636 /**@brief Passkey Option.
Rohit Grover 37:c29c330d942c 637 *
Rohit Grover 37:c29c330d942c 638 * Structure containing the passkey to be used during pairing. This can be used with @ref
Rohit Grover 37:c29c330d942c 639 * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication
Rohit Grover 37:c29c330d942c 640 * instead of generating a random one.
Rohit Grover 37:c29c330d942c 641 *
Rohit Grover 37:c29c330d942c 642 * @note @ref sd_ble_opt_get is not supported for this option.
Rohit Grover 37:c29c330d942c 643 *
Rohit Grover 37:c29c330d942c 644 */
Rohit Grover 37:c29c330d942c 645 typedef struct
Rohit Grover 37:c29c330d942c 646 {
Rohit Grover 37:c29c330d942c 647 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.*/
Rohit Grover 37:c29c330d942c 648 } ble_gap_opt_passkey_t;
Rohit Grover 37:c29c330d942c 649
Rohit Grover 37:c29c330d942c 650
Rohit Grover 37:c29c330d942c 651 /**@brief Custom Privacy Options.
Rohit Grover 37:c29c330d942c 652 *
Rohit Grover 37:c29c330d942c 653 * @note The specified address cycle interval is used when the address cycle mode is
Rohit Grover 37:c29c330d942c 654 * @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. If 0 is given, the address will not be refreshed at any
Rohit Grover 37:c29c330d942c 655 * interval, and not at start of advertising. A new address can be generated manually by calling
Rohit Grover 37:c29c330d942c 656 * @ref sd_ble_gap_address_set with the same type again. The default interval is
Rohit Grover 37:c29c330d942c 657 * @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S.
Rohit Grover 37:c29c330d942c 658 *
Rohit Grover 37:c29c330d942c 659 * @note If cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address will immediately be
Rohit Grover 37:c29c330d942c 660 * refreshed when this option is set.
Rohit Grover 37:c29c330d942c 661 */
Rohit Grover 37:c29c330d942c 662 typedef struct
Rohit Grover 37:c29c330d942c 663 {
Rohit Grover 37:c29c330d942c 664 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. */
Rohit Grover 37:c29c330d942c 665 uint16_t interval_s; /**< When input: Custom private address cycle interval in seconds. When output: The current private address cycle interval. */
Rohit Grover 37:c29c330d942c 666 } ble_gap_opt_privacy_t;
Rohit Grover 37:c29c330d942c 667
Rohit Grover 37:c29c330d942c 668
Rohit Grover 37:c29c330d942c 669 /**@brief Option structure for GAP options. */
Rohit Grover 37:c29c330d942c 670 typedef union
Rohit Grover 37:c29c330d942c 671 {
Rohit Grover 37:c29c330d942c 672 ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Local connection latency. */
Rohit Grover 37:c29c330d942c 673 ble_gap_opt_passkey_t passkey; /**< Passkey to be used for pairing.*/
Rohit Grover 37:c29c330d942c 674 ble_gap_opt_privacy_t privacy; /**< Custom privacy options. */
Rohit Grover 37:c29c330d942c 675 } ble_gap_opt_t;
Rohit Grover 37:c29c330d942c 676 /**@} */
Rohit Grover 37:c29c330d942c 677
Rohit Grover 37:c29c330d942c 678
Rohit Grover 37:c29c330d942c 679 /**@addtogroup BLE_GAP_FUNCTIONS Functions
Rohit Grover 37:c29c330d942c 680 * @{ */
Rohit Grover 37:c29c330d942c 681
bogdanm 0:eff01767de02 682 /**@brief Set local Bluetooth address.
bogdanm 0:eff01767de02 683 *
Rohit Grover 37:c29c330d942c 684 * If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to
Rohit Grover 37:c29c330d942c 685 * be @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or
Rohit Grover 37:c29c330d942c 686 * @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the
Rohit Grover 37:c29c330d942c 687 * SoftDevice will generate a new private address automatically every time advertising is
Rohit Grover 37:c29c330d942c 688 * (re)started, and every @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds. If this API
Rohit Grover 37:c29c330d942c 689 * call is used again with the same parameters while advertising, the SoftDevice will immediately
Rohit Grover 37:c29c330d942c 690 * generate a new private address to replace the current address.
Rohit Grover 37:c29c330d942c 691 *
Rohit Grover 37:c29c330d942c 692 * If the application wishes to use a @ref BLE_GAP_ADDR_TYPE_PUBLIC or
Rohit Grover 37:c29c330d942c 693 * @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be
Rohit Grover 37:c29c330d942c 694 * @ref BLE_GAP_ADDR_CYCLE_MODE_NONE.
Rohit Grover 37:c29c330d942c 695 *
Rohit Grover 37:c29c330d942c 696 * If this API function is called while advertising, the softdevice will immediately update the
Rohit Grover 37:c29c330d942c 697 * advertising address without the need to stop advertising in the following cases:
Rohit Grover 37:c29c330d942c 698 * - If the previously set address is of type @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address
Rohit Grover 37:c29c330d942c 699 * is also of type @ref BLE_GAP_ADDR_TYPE_PUBLIC
Rohit Grover 37:c29c330d942c 700 * - If the previously set address is not @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address is
Rohit Grover 37:c29c330d942c 701 * also not @ref BLE_GAP_ADDR_TYPE_PUBLIC.
Rohit Grover 37:c29c330d942c 702 *
Rohit Grover 37:c29c330d942c 703 * If the address is changed from a @ref BLE_GAP_ADDR_TYPE_PUBLIC address to another type or from
Rohit Grover 37:c29c330d942c 704 * another type to a @ref BLE_GAP_ADDR_TYPE_PUBLIC address, the change will take effect the next
Rohit Grover 37:c29c330d942c 705 * time advertising is started.
Rohit Grover 37:c29c330d942c 706 *
Rohit Grover 37:c29c330d942c 707 * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_NONE and the application is
Rohit Grover 37:c29c330d942c 708 * using privacy, the application must take care to generate and set new private addresses
Rohit Grover 37:c29c330d942c 709 * periodically to comply with the Privacy specification in Bluetooth Core Spec.
Rohit Grover 37:c29c330d942c 710 *
Rohit Grover 37:c29c330d942c 711 * @param[in] addr_cycle_mode Address cycle mode, see @ref BLE_GAP_ADDR_CYCLE_MODES.
Rohit Grover 37:c29c330d942c 712 * @param[in] p_addr Pointer to address structure.
bogdanm 0:eff01767de02 713 *
bogdanm 0:eff01767de02 714 * @return @ref NRF_SUCCESS Address successfully set.
bogdanm 0:eff01767de02 715 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
Rohit Grover 37:c29c330d942c 716 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameters.
bogdanm 0:eff01767de02 717 * @return @ref BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address.
bogdanm 0:eff01767de02 718 * @return @ref NRF_ERROR_BUSY The stack is busy, process pending events and retry.
bogdanm 0:eff01767de02 719 */
Rohit Grover 37:c29c330d942c 720 SVCALL(SD_BLE_GAP_ADDRESS_SET, uint32_t, sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const * const p_addr));
bogdanm 0:eff01767de02 721
bogdanm 0:eff01767de02 722
bogdanm 0:eff01767de02 723 /**@brief Get local Bluetooth address.
bogdanm 0:eff01767de02 724 *
bogdanm 0:eff01767de02 725 * @param[out] p_addr Pointer to address structure.
bogdanm 0:eff01767de02 726 *
bogdanm 0:eff01767de02 727 * @return @ref NRF_SUCCESS Address successfully retrieved.
bogdanm 0:eff01767de02 728 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 729 */
bogdanm 0:eff01767de02 730 SVCALL(SD_BLE_GAP_ADDRESS_GET, uint32_t, sd_ble_gap_address_get(ble_gap_addr_t * const p_addr));
bogdanm 0:eff01767de02 731
bogdanm 0:eff01767de02 732
bogdanm 0:eff01767de02 733 /**@brief Set, clear or update advertisement and scan response data.
bogdanm 0:eff01767de02 734 *
bogdanm 0:eff01767de02 735 * @note The format of the advertisement data will be checked by this call to ensure interoperability.
bogdanm 0:eff01767de02 736 * Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and
Rohit Grover 37:c29c330d942c 737 * duplicating the local name in the advertisement data and scan response data.
bogdanm 0:eff01767de02 738 *
Rohit Grover 37:c29c330d942c 739 * @note: To clear the advertisement data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding
bogdanm 0:eff01767de02 740 * length (dlen/srdlen) set to 0.
bogdanm 0:eff01767de02 741 *
bogdanm 0:eff01767de02 742 * @note: The call will fail if p_data and p_sr_data are both NULL since this would have no effect.
bogdanm 0:eff01767de02 743 *
bogdanm 0:eff01767de02 744 * @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes are made to the current advertisement packet data.
bogdanm 0:eff01767de02 745 * @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.
bogdanm 0:eff01767de02 746 * @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.
bogdanm 0:eff01767de02 747 * @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.
bogdanm 0:eff01767de02 748 *
bogdanm 0:eff01767de02 749 * @return @ref NRF_SUCCESS Advertisement data successfully updated or cleared.
bogdanm 0:eff01767de02 750 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 751 * @return @ref NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied.
bogdanm 0:eff01767de02 752 * @return @ref NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification.
bogdanm 0:eff01767de02 753 * @return @ref NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied.
bogdanm 0:eff01767de02 754 * @return @ref BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied.
bogdanm 0:eff01767de02 755 * @return @ref NRF_ERROR_BUSY The stack is busy, process pending events and retry.
bogdanm 0:eff01767de02 756 */
bogdanm 0:eff01767de02 757 SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const * const p_data, uint8_t dlen, uint8_t const * const p_sr_data, uint8_t srdlen));
bogdanm 0:eff01767de02 758
bogdanm 0:eff01767de02 759
bogdanm 0:eff01767de02 760 /**@brief Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).
bogdanm 0:eff01767de02 761 *
bogdanm 0:eff01767de02 762 * @param[in] p_adv_params Pointer to advertising parameters structure.
bogdanm 0:eff01767de02 763 *
bogdanm 0:eff01767de02 764 * @return @ref NRF_SUCCESS The BLE stack has started advertising.
bogdanm 0:eff01767de02 765 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 766 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 767 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits.
bogdanm 0:eff01767de02 768 * @return @ref BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied.
bogdanm 0:eff01767de02 769 * @return @ref BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible.
bogdanm 0:eff01767de02 770 */
bogdanm 0:eff01767de02 771 SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const * const p_adv_params));
bogdanm 0:eff01767de02 772
bogdanm 0:eff01767de02 773
bogdanm 0:eff01767de02 774 /**@brief Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).
bogdanm 0:eff01767de02 775 *
bogdanm 0:eff01767de02 776 * @return @ref NRF_SUCCESS The BLE stack has stopped advertising.
bogdanm 0:eff01767de02 777 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state).
bogdanm 0:eff01767de02 778 */
bogdanm 0:eff01767de02 779 SVCALL(SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void));
bogdanm 0:eff01767de02 780
bogdanm 0:eff01767de02 781
bogdanm 0:eff01767de02 782 /**@brief Update connection parameters.
bogdanm 0:eff01767de02 783 *
bogdanm 0:eff01767de02 784 * @details In the central role this will initiate a Link Layer connection parameter update procedure,
bogdanm 0:eff01767de02 785 * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for
bogdanm 0:eff01767de02 786 * the central to perform the procedure. In both cases, and regardless of success or failure, the application
bogdanm 0:eff01767de02 787 * will be informed of the result with a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE event.
bogdanm 0:eff01767de02 788 *
bogdanm 0:eff01767de02 789 * @note If both a connection supervision timeout and a maximum connection interval are specified, then the following constraint
bogdanm 0:eff01767de02 790 * applies: (conn_sup_timeout * 8) >= (max_conn_interval * (slave_latency + 1))
bogdanm 0:eff01767de02 791 *
bogdanm 0:eff01767de02 792 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 793 * @param[in] p_conn_params Pointer to desired connection parameters. If NULL is provided on a peripheral role,
bogdanm 0:eff01767de02 794 * the parameters in the PPCP characteristic of the GAP service will be used instead.
bogdanm 0:eff01767de02 795 *
bogdanm 0:eff01767de02 796 * @return @ref NRF_SUCCESS The Connection Update procedure has been started successfully.
bogdanm 0:eff01767de02 797 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 798 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
bogdanm 0:eff01767de02 799 * @return @ref NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and retry.
bogdanm 0:eff01767de02 800 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 801 * @return @ref NRF_ERROR_NO_MEM Not enough memory to complete operation.
bogdanm 0:eff01767de02 802 */
bogdanm 0:eff01767de02 803 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 * const p_conn_params));
bogdanm 0:eff01767de02 804
bogdanm 0:eff01767de02 805
bogdanm 0:eff01767de02 806 /**@brief Disconnect (GAP Link Termination).
bogdanm 0:eff01767de02 807 *
bogdanm 0:eff01767de02 808 * @details This call initiates the disconnection procedure, and its completion will be communicated to the application
bogdanm 0:eff01767de02 809 * with a BLE_GAP_EVT_DISCONNECTED event.
bogdanm 0:eff01767de02 810 *
bogdanm 0:eff01767de02 811 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 812 * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are BTLE_REMOTE_USER_TERMINATED_CONNECTION and BTLE_CONN_INTERVAL_UNACCEPTABLE).
bogdanm 0:eff01767de02 813 *
bogdanm 0:eff01767de02 814 * @return @ref NRF_SUCCESS The disconnection procedure has been started successfully.
bogdanm 0:eff01767de02 815 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 816 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 817 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress or not connected at all).
bogdanm 0:eff01767de02 818 */
bogdanm 0:eff01767de02 819 SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code));
bogdanm 0:eff01767de02 820
bogdanm 0:eff01767de02 821
bogdanm 0:eff01767de02 822 /**@brief Set the radio's transmit power.
bogdanm 0:eff01767de02 823 *
bogdanm 0:eff01767de02 824 * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
bogdanm 0:eff01767de02 825 *
bogdanm 0:eff01767de02 826 * @note -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm.
bogdanm 0:eff01767de02 827 *
bogdanm 0:eff01767de02 828 * @return @ref NRF_SUCCESS Successfully changed the transmit power.
bogdanm 0:eff01767de02 829 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 830 * @return @ref NRF_ERROR_BUSY The stack is busy, process pending events and retry.
bogdanm 0:eff01767de02 831 */
bogdanm 0:eff01767de02 832 SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power));
bogdanm 0:eff01767de02 833
bogdanm 0:eff01767de02 834
bogdanm 0:eff01767de02 835 /**@brief Set GAP Appearance value.
bogdanm 0:eff01767de02 836 *
bogdanm 0:eff01767de02 837 * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES.
bogdanm 0:eff01767de02 838 *
bogdanm 0:eff01767de02 839 * @return @ref NRF_SUCCESS Appearance value set successfully.
bogdanm 0:eff01767de02 840 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 841 */
bogdanm 0:eff01767de02 842 SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance));
bogdanm 0:eff01767de02 843
bogdanm 0:eff01767de02 844
bogdanm 0:eff01767de02 845 /**@brief Get GAP Appearance value.
bogdanm 0:eff01767de02 846 *
bogdanm 0:eff01767de02 847 * @param[out] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES.
bogdanm 0:eff01767de02 848 *
bogdanm 0:eff01767de02 849 * @return @ref NRF_SUCCESS Appearance value retrieved successfully.
bogdanm 0:eff01767de02 850 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 851 */
bogdanm 0:eff01767de02 852 SVCALL(SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t * const p_appearance));
bogdanm 0:eff01767de02 853
bogdanm 0:eff01767de02 854
bogdanm 0:eff01767de02 855 /**@brief Set GAP Peripheral Preferred Connection Parameters.
bogdanm 0:eff01767de02 856 *
bogdanm 0:eff01767de02 857 * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the desired parameters.
bogdanm 0:eff01767de02 858 *
bogdanm 0:eff01767de02 859 * @return @ref NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully.
bogdanm 0:eff01767de02 860 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 861 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 862 */
bogdanm 0:eff01767de02 863 SVCALL(SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params));
bogdanm 0:eff01767de02 864
bogdanm 0:eff01767de02 865
bogdanm 0:eff01767de02 866 /**@brief Get GAP Peripheral Preferred Connection Parameters.
bogdanm 0:eff01767de02 867 *
bogdanm 0:eff01767de02 868 * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters will be stored.
bogdanm 0:eff01767de02 869 *
bogdanm 0:eff01767de02 870 * @return @ref NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully.
bogdanm 0:eff01767de02 871 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 872 */
bogdanm 0:eff01767de02 873 SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params));
bogdanm 0:eff01767de02 874
bogdanm 0:eff01767de02 875
bogdanm 0:eff01767de02 876 /**@brief Set GAP device name.
bogdanm 0:eff01767de02 877 *
bogdanm 0:eff01767de02 878 * @param[in] p_write_perm Write permissions for the Device Name characteristic see @ref ble_gap_conn_sec_mode_t.
bogdanm 0:eff01767de02 879 * @param[in] p_dev_name Pointer to a UTF-8 encoded, <b>non NULL-terminated</b> string.
bogdanm 0:eff01767de02 880 * @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).
bogdanm 0:eff01767de02 881 *
bogdanm 0:eff01767de02 882 * @return @ref NRF_SUCCESS GAP device name and permissions set successfully.
bogdanm 0:eff01767de02 883 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 884 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 885 * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
bogdanm 0:eff01767de02 886 */
bogdanm 0:eff01767de02 887 SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm, uint8_t const * const p_dev_name, uint16_t len));
bogdanm 0:eff01767de02 888
bogdanm 0:eff01767de02 889
bogdanm 0:eff01767de02 890 /**@brief Get GAP device name.
bogdanm 0:eff01767de02 891 *
bogdanm 0:eff01767de02 892 * @param[in] 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.
bogdanm 0:eff01767de02 893 * @param[in,out] p_len Length of the buffer pointed by p_dev_name, complete device name length on output.
bogdanm 0:eff01767de02 894 *
bogdanm 0:eff01767de02 895 * @note If the device name is longer than the size of the supplied buffer,
bogdanm 0:eff01767de02 896 * p_len will return the complete device name length,
bogdanm 0:eff01767de02 897 * and not the number of bytes actually returned in p_dev_name.
bogdanm 0:eff01767de02 898 * The application may use this information to allocate a suitable buffer size.
bogdanm 0:eff01767de02 899 *
bogdanm 0:eff01767de02 900 * @return @ref NRF_SUCCESS GAP device name retrieved successfully.
bogdanm 0:eff01767de02 901 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 902 * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
bogdanm 0:eff01767de02 903 */
bogdanm 0:eff01767de02 904 SVCALL(SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len));
bogdanm 0:eff01767de02 905
bogdanm 0:eff01767de02 906
bogdanm 0:eff01767de02 907 /**@brief Initiate GAP Authentication procedure.
bogdanm 0:eff01767de02 908 *
bogdanm 0:eff01767de02 909 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 910 * @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 procedure.
bogdanm 0:eff01767de02 911 *
bogdanm 0:eff01767de02 912 * @details In the central role, this function will send an SMP Pairing Request, otherwise in the peripheral role, an SMP Security Request will be sent.
bogdanm 0:eff01767de02 913 * In the peripheral role, only the timeout, bond and mitm fields of @ref ble_gap_sec_params_t are used.
bogdanm 0:eff01767de02 914 *
bogdanm 0:eff01767de02 915 * @note The GAP Authentication procedure may be triggered by the central without calling this function when accessing a secure service.
bogdanm 0:eff01767de02 916 * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST,
bogdanm 0:eff01767de02 917 * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_AUTH_STATUS.
bogdanm 0:eff01767de02 918 * @note The timeout parameter in @ref ble_gap_sec_params_t is interpreted here as the Security Request timeout
bogdanm 0:eff01767de02 919 *
bogdanm 0:eff01767de02 920 *
bogdanm 0:eff01767de02 921 * @return @ref NRF_SUCCESS Successfully initiated authentication procedure.
bogdanm 0:eff01767de02 922 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 923 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 924 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 925 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 926 */
bogdanm 0:eff01767de02 927 SVCALL(SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const * const p_sec_params));
bogdanm 0:eff01767de02 928
bogdanm 0:eff01767de02 929
bogdanm 0:eff01767de02 930 /**@brief Reply with GAP security parameters.
bogdanm 0:eff01767de02 931 *
bogdanm 0:eff01767de02 932 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 933 * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS.
bogdanm 0:eff01767de02 934 * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters structure.
bogdanm 0:eff01767de02 935 *
bogdanm 0:eff01767de02 936 * @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 NRF_ERROR_INVALID_STATE.
bogdanm 0:eff01767de02 937 * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
bogdanm 0:eff01767de02 938 * @note The timeout parameter in @ref ble_gap_sec_params_t is interpreted here as the SMP procedure timeout, and must be 30 seconds. The function will fail
bogdanm 0:eff01767de02 939 * if the application supplies a different value.
bogdanm 0:eff01767de02 940 *
bogdanm 0:eff01767de02 941 * @return @ref NRF_SUCCESS Successfully accepted security parameter from the application.
bogdanm 0:eff01767de02 942 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 943 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 944 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 945 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 946 */
bogdanm 0:eff01767de02 947 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 * const p_sec_params));
bogdanm 0:eff01767de02 948
bogdanm 0:eff01767de02 949
bogdanm 0:eff01767de02 950 /**@brief Reply with an authentication key.
bogdanm 0:eff01767de02 951 *
bogdanm 0:eff01767de02 952 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 953 * @param[in] key_type See @ref BLE_GAP_AUTH_KEY_TYPES.
bogdanm 0:eff01767de02 954 * @param[in] key If key type is BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL.
bogdanm 0:eff01767de02 955 * If key type is BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination).
bogdanm 0:eff01767de02 956 * If key type is BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format.
bogdanm 0:eff01767de02 957 *
bogdanm 0:eff01767de02 958 * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, calling it at other times will result in an NRF_ERROR_INVALID_STATE.
bogdanm 0:eff01767de02 959 * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
bogdanm 0:eff01767de02 960 *
bogdanm 0:eff01767de02 961 * @return @ref NRF_SUCCESS Authentication key successfully set.
bogdanm 0:eff01767de02 962 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 963 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 964 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 965 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 966 */
bogdanm 0:eff01767de02 967 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 * const key));
bogdanm 0:eff01767de02 968
bogdanm 0:eff01767de02 969
bogdanm 0:eff01767de02 970 /**@brief Reply with GAP security information.
bogdanm 0:eff01767de02 971 *
bogdanm 0:eff01767de02 972 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 973 * @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.
bogdanm 0:eff01767de02 974 * @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.
bogdanm 0:eff01767de02 975 *
bogdanm 0:eff01767de02 976 * @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 NRF_ERROR_INVALID_STATE.
bogdanm 0:eff01767de02 977 * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
bogdanm 0:eff01767de02 978 * @note Data signing is not implemented yet. p_sign_info must therefore be NULL.
bogdanm 0:eff01767de02 979 *
bogdanm 0:eff01767de02 980 * @return @ref NRF_SUCCESS Successfully accepted security information.
bogdanm 0:eff01767de02 981 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
bogdanm 0:eff01767de02 982 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 983 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 984 * @return @ref NRF_ERROR_BUSY The stack is busy, process pending events and retry.
bogdanm 0:eff01767de02 985 */
bogdanm 0:eff01767de02 986 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 * const p_enc_info, ble_gap_sign_info_t const * const p_sign_info));
bogdanm 0:eff01767de02 987
bogdanm 0:eff01767de02 988
bogdanm 0:eff01767de02 989 /**@brief Get the current connection security.
bogdanm 0:eff01767de02 990 *
bogdanm 0:eff01767de02 991 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 992 * @param[out] p_conn_sec Pointer to a @ref ble_gap_conn_sec_t structure to be filled in.
bogdanm 0:eff01767de02 993 *
bogdanm 0:eff01767de02 994 * @return @ref NRF_SUCCESS Current connection security successfully retrieved.
bogdanm 0:eff01767de02 995 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
bogdanm 0:eff01767de02 996 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 997 */
bogdanm 0:eff01767de02 998 SVCALL(SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec));
bogdanm 0:eff01767de02 999
bogdanm 0:eff01767de02 1000
Rohit Grover 37:c29c330d942c 1001 /**@brief Start reporting the received signal strength to the application.
bogdanm 0:eff01767de02 1002 *
bogdanm 0:eff01767de02 1003 * A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called.
bogdanm 0:eff01767de02 1004 *
bogdanm 0:eff01767de02 1005 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 1006 *
bogdanm 0:eff01767de02 1007 * @return @ref NRF_SUCCESS Successfully activated RSSI reporting.
bogdanm 0:eff01767de02 1008 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 1009 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 1010 */
bogdanm 0:eff01767de02 1011 SVCALL(SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle));
bogdanm 0:eff01767de02 1012
bogdanm 0:eff01767de02 1013
Rohit Grover 37:c29c330d942c 1014 /**@brief Stop reporting the received singnal strength.
bogdanm 0:eff01767de02 1015 *
Rohit Grover 37:c29c330d942c 1016 * An RSSI change detected before the call but not yet received by the application
bogdanm 0:eff01767de02 1017 * may be reported after @ref sd_ble_gap_rssi_stop has been called.
bogdanm 0:eff01767de02 1018 *
bogdanm 0:eff01767de02 1019 * @param[in] conn_handle Connection handle.
bogdanm 0:eff01767de02 1020 *
bogdanm 0:eff01767de02 1021 * @return @ref NRF_SUCCESS Successfully deactivated RSSI reporting.
bogdanm 0:eff01767de02 1022 * @return @ref NRF_ERROR_INVALID_STATE Invalid state to perform operation.
bogdanm 0:eff01767de02 1023 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
bogdanm 0:eff01767de02 1024 */
bogdanm 0:eff01767de02 1025 SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle));
Rohit Grover 37:c29c330d942c 1026 /**@} */
bogdanm 0:eff01767de02 1027
bogdanm 0:eff01767de02 1028 #endif // BLE_GAP_H__
bogdanm 0:eff01767de02 1029
bogdanm 0:eff01767de02 1030 /**
bogdanm 0:eff01767de02 1031 @}
bogdanm 0:eff01767de02 1032 */