meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Fri Aug 15 15:28:31 2014 +0100
Revision:
88:9327015d4013
Parent:
TARGET_RBLAB_NRF51822/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_API/include/ble_gap.h@87:6213f644d804
Release 88 of the mbed library

Main changes:

- changed "error.h" to "mbed_error.h" to avoid conflicts with 3rd party code
- LPC1549 SPI driver fixes
- K64F Ethernet TX buffer reclaim mechanism fix
- STDIO initialization fix
- NUCLEO_F334R8 I2C clock fix
- various other fixes

Who changed what in which revision?

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