mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Oct 17 14:15:08 2014 +0100
Revision:
357:d73ca02bc818
Synchronized with git revision 74cc430faad92b2df0cd91d78a074ec315ad7533

Full URL: https://github.com/mbedmicro/mbed/commit/74cc430faad92b2df0cd91d78a074ec315ad7533/

updating to v7.1.0 of the Nordic soft-device.

Who changed what in which revision?

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