Nordic stack and drivers for the mbed BLE API
Dependents: BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more
TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/ble_gap.h@638:c90ae1400bf2, 2016-09-14 (annotated)
- Committer:
- Vincent Coubard
- Date:
- Wed Sep 14 14:39:43 2016 +0100
- Revision:
- 638:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vincent Coubard |
638:c90ae1400bf2 | 1 | /* |
Vincent Coubard |
638:c90ae1400bf2 | 2 | * Copyright (c) Nordic Semiconductor ASA |
Vincent Coubard |
638:c90ae1400bf2 | 3 | * All rights reserved. |
Vincent Coubard |
638:c90ae1400bf2 | 4 | * |
Vincent Coubard |
638:c90ae1400bf2 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Vincent Coubard |
638:c90ae1400bf2 | 6 | * are permitted provided that the following conditions are met: |
Vincent Coubard |
638:c90ae1400bf2 | 7 | * |
Vincent Coubard |
638:c90ae1400bf2 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
Vincent Coubard |
638:c90ae1400bf2 | 9 | * list of conditions and the following disclaimer. |
Vincent Coubard |
638:c90ae1400bf2 | 10 | * |
Vincent Coubard |
638:c90ae1400bf2 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this |
Vincent Coubard |
638:c90ae1400bf2 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
Vincent Coubard |
638:c90ae1400bf2 | 13 | * other materials provided with the distribution. |
Vincent Coubard |
638:c90ae1400bf2 | 14 | * |
Vincent Coubard |
638:c90ae1400bf2 | 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other |
Vincent Coubard |
638:c90ae1400bf2 | 16 | * contributors to this software may be used to endorse or promote products |
Vincent Coubard |
638:c90ae1400bf2 | 17 | * derived from this software without specific prior written permission. |
Vincent Coubard |
638:c90ae1400bf2 | 18 | * |
Vincent Coubard |
638:c90ae1400bf2 | 19 | * |
Vincent Coubard |
638:c90ae1400bf2 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Vincent Coubard |
638:c90ae1400bf2 | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Vincent Coubard |
638:c90ae1400bf2 | 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Vincent Coubard |
638:c90ae1400bf2 | 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Vincent Coubard |
638:c90ae1400bf2 | 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Vincent Coubard |
638:c90ae1400bf2 | 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Vincent Coubard |
638:c90ae1400bf2 | 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Vincent Coubard |
638:c90ae1400bf2 | 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Vincent Coubard |
638:c90ae1400bf2 | 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Vincent Coubard |
638:c90ae1400bf2 | 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Vincent Coubard |
638:c90ae1400bf2 | 30 | * |
Vincent Coubard |
638:c90ae1400bf2 | 31 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 32 | |
Vincent Coubard |
638:c90ae1400bf2 | 33 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 34 | @addtogroup BLE_GAP Generic Access Profile (GAP) |
Vincent Coubard |
638:c90ae1400bf2 | 35 | @{ |
Vincent Coubard |
638:c90ae1400bf2 | 36 | @brief Definitions and prototypes for the GAP interface. |
Vincent Coubard |
638:c90ae1400bf2 | 37 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 38 | |
Vincent Coubard |
638:c90ae1400bf2 | 39 | #ifndef BLE_GAP_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 40 | #define BLE_GAP_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 41 | |
Vincent Coubard |
638:c90ae1400bf2 | 42 | #include "ble_types.h" |
Vincent Coubard |
638:c90ae1400bf2 | 43 | #include "ble_ranges.h" |
Vincent Coubard |
638:c90ae1400bf2 | 44 | #include "nrf_svc.h" |
Vincent Coubard |
638:c90ae1400bf2 | 45 | |
Vincent Coubard |
638:c90ae1400bf2 | 46 | /**@addtogroup BLE_GAP_ENUMERATIONS Enumerations |
Vincent Coubard |
638:c90ae1400bf2 | 47 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 48 | |
Vincent Coubard |
638:c90ae1400bf2 | 49 | /**@brief GAP API SVC numbers. |
Vincent Coubard |
638:c90ae1400bf2 | 50 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 51 | enum BLE_GAP_SVCS |
Vincent Coubard |
638:c90ae1400bf2 | 52 | { |
Vincent Coubard |
638:c90ae1400bf2 | 53 | SD_BLE_GAP_ADDRESS_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 54 | SD_BLE_GAP_ADDRESS_GET, /**< Get own Bluetooth Address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 55 | SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */ |
Vincent Coubard |
638:c90ae1400bf2 | 56 | SD_BLE_GAP_ADV_START, /**< Start Advertising. */ |
Vincent Coubard |
638:c90ae1400bf2 | 57 | SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */ |
Vincent Coubard |
638:c90ae1400bf2 | 58 | SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */ |
Vincent Coubard |
638:c90ae1400bf2 | 59 | SD_BLE_GAP_DISCONNECT, /**< Disconnect. */ |
Vincent Coubard |
638:c90ae1400bf2 | 60 | SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */ |
Vincent Coubard |
638:c90ae1400bf2 | 61 | SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */ |
Vincent Coubard |
638:c90ae1400bf2 | 62 | SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */ |
Vincent Coubard |
638:c90ae1400bf2 | 63 | SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */ |
Vincent Coubard |
638:c90ae1400bf2 | 64 | SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */ |
Vincent Coubard |
638:c90ae1400bf2 | 65 | SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */ |
Vincent Coubard |
638:c90ae1400bf2 | 66 | SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */ |
Vincent Coubard |
638:c90ae1400bf2 | 67 | SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */ |
Vincent Coubard |
638:c90ae1400bf2 | 68 | SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 69 | SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 70 | SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 71 | SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 72 | SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */ |
Vincent Coubard |
638:c90ae1400bf2 | 73 | SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */ |
Vincent Coubard |
638:c90ae1400bf2 | 74 | SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */ |
Vincent Coubard |
638:c90ae1400bf2 | 75 | SD_BLE_GAP_SCAN_START, /**< Start Scanning. */ |
Vincent Coubard |
638:c90ae1400bf2 | 76 | SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */ |
Vincent Coubard |
638:c90ae1400bf2 | 77 | SD_BLE_GAP_CONNECT, /**< Connect. */ |
Vincent Coubard |
638:c90ae1400bf2 | 78 | SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 79 | SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */ |
Vincent Coubard |
638:c90ae1400bf2 | 80 | }; |
Vincent Coubard |
638:c90ae1400bf2 | 81 | |
Vincent Coubard |
638:c90ae1400bf2 | 82 | /**@brief GAP Event IDs. |
Vincent Coubard |
638:c90ae1400bf2 | 83 | * IDs that uniquely identify an event coming from the stack to the application. |
Vincent Coubard |
638:c90ae1400bf2 | 84 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 85 | enum BLE_GAP_EVTS |
Vincent Coubard |
638:c90ae1400bf2 | 86 | { |
Vincent Coubard |
638:c90ae1400bf2 | 87 | BLE_GAP_EVT_CONNECTED = BLE_GAP_EVT_BASE, /**< Connection established. @ref ble_gap_evt_connected_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 88 | BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. @ref ble_gap_evt_disconnected_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 89 | BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. ble_gap_evt_conn_param_update_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 90 | BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. @ref ble_gap_evt_sec_params_request_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 91 | BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. @ref ble_gap_evt_sec_info_request_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 92 | BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. @ref ble_gap_evt_passkey_display_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 93 | BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. @ref ble_gap_evt_auth_key_request_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 94 | BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. @ref ble_gap_evt_auth_status_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 95 | BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. @ref ble_gap_evt_conn_sec_update_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 96 | BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. @ref ble_gap_evt_timeout_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 97 | BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. @ref ble_gap_evt_rssi_changed_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 98 | BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. @ref ble_gap_evt_adv_report_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 99 | BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. @ref ble_gap_evt_sec_request_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 100 | BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. @ref ble_gap_evt_conn_param_update_request_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 101 | BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_evt_scan_req_report_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 102 | }; |
Vincent Coubard |
638:c90ae1400bf2 | 103 | |
Vincent Coubard |
638:c90ae1400bf2 | 104 | /**@brief GAP Option IDs. |
Vincent Coubard |
638:c90ae1400bf2 | 105 | * IDs that uniquely identify a GAP option. |
Vincent Coubard |
638:c90ae1400bf2 | 106 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 107 | enum BLE_GAP_OPTS |
Vincent Coubard |
638:c90ae1400bf2 | 108 | { |
Vincent Coubard |
638:c90ae1400bf2 | 109 | BLE_GAP_OPT_CH_MAP = BLE_GAP_OPT_BASE, /**< Channel Map. @ref ble_gap_opt_ch_map_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 110 | BLE_GAP_OPT_LOCAL_CONN_LATENCY, /**< Local connection latency. @ref ble_gap_opt_local_conn_latency_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 111 | BLE_GAP_OPT_PASSKEY, /**< Set passkey. @ref ble_gap_opt_passkey_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 112 | BLE_GAP_OPT_PRIVACY, /**< Custom privacy. @ref ble_gap_opt_privacy_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 113 | BLE_GAP_OPT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_opt_scan_req_report_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 114 | BLE_GAP_OPT_COMPAT_MODE /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */ |
Vincent Coubard |
638:c90ae1400bf2 | 115 | }; |
Vincent Coubard |
638:c90ae1400bf2 | 116 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 117 | |
Vincent Coubard |
638:c90ae1400bf2 | 118 | /**@addtogroup BLE_GAP_DEFINES Defines |
Vincent Coubard |
638:c90ae1400bf2 | 119 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 120 | |
Vincent Coubard |
638:c90ae1400bf2 | 121 | /**@defgroup BLE_ERRORS_GAP SVC return values specific to GAP |
Vincent Coubard |
638:c90ae1400bf2 | 122 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 123 | #define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 124 | #define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */ |
Vincent Coubard |
638:c90ae1400bf2 | 125 | #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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 126 | #define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to overwrite the whitelist while already in use by another operation. */ |
Vincent Coubard |
638:c90ae1400bf2 | 127 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 128 | |
Vincent Coubard |
638:c90ae1400bf2 | 129 | |
Vincent Coubard |
638:c90ae1400bf2 | 130 | /**@defgroup BLE_GAP_ROLES GAP Roles |
Vincent Coubard |
638:c90ae1400bf2 | 131 | * @note Not explicitly used in peripheral API, but will be relevant for central API. |
Vincent Coubard |
638:c90ae1400bf2 | 132 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 133 | #define BLE_GAP_ROLE_INVALID 0x0 /**< Invalid Role. */ |
Vincent Coubard |
638:c90ae1400bf2 | 134 | #define BLE_GAP_ROLE_PERIPH 0x1 /**< Peripheral Role. */ |
Vincent Coubard |
638:c90ae1400bf2 | 135 | #define BLE_GAP_ROLE_CENTRAL 0x2 /**< Central Role. */ |
Vincent Coubard |
638:c90ae1400bf2 | 136 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 137 | |
Vincent Coubard |
638:c90ae1400bf2 | 138 | |
Vincent Coubard |
638:c90ae1400bf2 | 139 | /**@defgroup BLE_GAP_TIMEOUT_SOURCES GAP Timeout sources |
Vincent Coubard |
638:c90ae1400bf2 | 140 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 141 | #define BLE_GAP_TIMEOUT_SRC_ADVERTISING 0x00 /**< Advertising timeout. */ |
Vincent Coubard |
638:c90ae1400bf2 | 142 | #define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */ |
Vincent Coubard |
638:c90ae1400bf2 | 143 | #define BLE_GAP_TIMEOUT_SRC_SCAN 0x02 /**< Scanning timeout. */ |
Vincent Coubard |
638:c90ae1400bf2 | 144 | #define BLE_GAP_TIMEOUT_SRC_CONN 0x03 /**< Connection timeout. */ |
Vincent Coubard |
638:c90ae1400bf2 | 145 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 146 | |
Vincent Coubard |
638:c90ae1400bf2 | 147 | |
Vincent Coubard |
638:c90ae1400bf2 | 148 | /**@defgroup BLE_GAP_ADDR_TYPES GAP Address types |
Vincent Coubard |
638:c90ae1400bf2 | 149 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 150 | #define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 151 | #define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random Static address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 152 | #define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Private Resolvable address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 153 | #define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Private Non-Resolvable address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 154 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 155 | |
Vincent Coubard |
638:c90ae1400bf2 | 156 | /**@defgroup BLE_GAP_ADDR_CYCLE_MODES GAP Address cycle modes |
Vincent Coubard |
638:c90ae1400bf2 | 157 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 158 | #define BLE_GAP_ADDR_CYCLE_MODE_NONE 0x00 /**< Set addresses directly, no automatic address cycling. */ |
Vincent Coubard |
638:c90ae1400bf2 | 159 | #define BLE_GAP_ADDR_CYCLE_MODE_AUTO 0x01 /**< Automatically generate and update private addresses. */ |
Vincent Coubard |
638:c90ae1400bf2 | 160 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 161 | |
Vincent Coubard |
638:c90ae1400bf2 | 162 | /**@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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 163 | #define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (60 * 15) |
Vincent Coubard |
638:c90ae1400bf2 | 164 | |
Vincent Coubard |
638:c90ae1400bf2 | 165 | /** @brief BLE address length. */ |
Vincent Coubard |
638:c90ae1400bf2 | 166 | #define BLE_GAP_ADDR_LEN 6 |
Vincent Coubard |
638:c90ae1400bf2 | 167 | |
Vincent Coubard |
638:c90ae1400bf2 | 168 | |
Vincent Coubard |
638:c90ae1400bf2 | 169 | /**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format |
Vincent Coubard |
638:c90ae1400bf2 | 170 | * @note Found at https://www.bluetooth.org/Technical/AssignedNumbers/generic_access_profile.htm |
Vincent Coubard |
638:c90ae1400bf2 | 171 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 172 | #define BLE_GAP_AD_TYPE_FLAGS 0x01 /**< Flags for discoverability. */ |
Vincent Coubard |
638:c90ae1400bf2 | 173 | #define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE 0x02 /**< Partial list of 16 bit service UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 174 | #define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE 0x03 /**< Complete list of 16 bit service UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 175 | #define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE 0x04 /**< Partial list of 32 bit service UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 176 | #define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE 0x05 /**< Complete list of 32 bit service UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 177 | #define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE 0x06 /**< Partial list of 128 bit service UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 178 | #define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE 0x07 /**< Complete list of 128 bit service UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 179 | #define BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME 0x08 /**< Short local device name. */ |
Vincent Coubard |
638:c90ae1400bf2 | 180 | #define BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME 0x09 /**< Complete local device name. */ |
Vincent Coubard |
638:c90ae1400bf2 | 181 | #define BLE_GAP_AD_TYPE_TX_POWER_LEVEL 0x0A /**< Transmit power level. */ |
Vincent Coubard |
638:c90ae1400bf2 | 182 | #define BLE_GAP_AD_TYPE_CLASS_OF_DEVICE 0x0D /**< Class of device. */ |
Vincent Coubard |
638:c90ae1400bf2 | 183 | #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C 0x0E /**< Simple Pairing Hash C. */ |
Vincent Coubard |
638:c90ae1400bf2 | 184 | #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R 0x0F /**< Simple Pairing Randomizer R. */ |
Vincent Coubard |
638:c90ae1400bf2 | 185 | #define BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE 0x10 /**< Security Manager TK Value. */ |
Vincent Coubard |
638:c90ae1400bf2 | 186 | #define BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS 0x11 /**< Security Manager Out Of Band Flags. */ |
Vincent Coubard |
638:c90ae1400bf2 | 187 | #define BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 /**< Slave Connection Interval Range. */ |
Vincent Coubard |
638:c90ae1400bf2 | 188 | #define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT 0x14 /**< List of 16-bit Service Solicitation UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 189 | #define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT 0x15 /**< List of 128-bit Service Solicitation UUIDs. */ |
Vincent Coubard |
638:c90ae1400bf2 | 190 | #define BLE_GAP_AD_TYPE_SERVICE_DATA 0x16 /**< Service Data - 16-bit UUID. */ |
Vincent Coubard |
638:c90ae1400bf2 | 191 | #define BLE_GAP_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 /**< Public Target Address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 192 | #define BLE_GAP_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 /**< Random Target Address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 193 | #define BLE_GAP_AD_TYPE_APPEARANCE 0x19 /**< Appearance. */ |
Vincent Coubard |
638:c90ae1400bf2 | 194 | #define BLE_GAP_AD_TYPE_ADVERTISING_INTERVAL 0x1A /**< Advertising Interval. */ |
Vincent Coubard |
638:c90ae1400bf2 | 195 | #define BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS 0x1B /**< LE Bluetooth Device Address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 196 | #define BLE_GAP_AD_TYPE_LE_ROLE 0x1C /**< LE Role. */ |
Vincent Coubard |
638:c90ae1400bf2 | 197 | #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C256 0x1D /**< Simple Pairing Hash C-256. */ |
Vincent Coubard |
638:c90ae1400bf2 | 198 | #define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256 0x1E /**< Simple Pairing Randomizer R-256. */ |
Vincent Coubard |
638:c90ae1400bf2 | 199 | #define BLE_GAP_AD_TYPE_SERVICE_DATA_32BIT_UUID 0x20 /**< Service Data - 32-bit UUID. */ |
Vincent Coubard |
638:c90ae1400bf2 | 200 | #define BLE_GAP_AD_TYPE_SERVICE_DATA_128BIT_UUID 0x21 /**< Service Data - 128-bit UUID. */ |
Vincent Coubard |
638:c90ae1400bf2 | 201 | #define BLE_GAP_AD_TYPE_3D_INFORMATION_DATA 0x3D /**< 3D Information Data. */ |
Vincent Coubard |
638:c90ae1400bf2 | 202 | #define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF /**< Manufacturer Specific Data. */ |
Vincent Coubard |
638:c90ae1400bf2 | 203 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 204 | |
Vincent Coubard |
638:c90ae1400bf2 | 205 | |
Vincent Coubard |
638:c90ae1400bf2 | 206 | /**@defgroup BLE_GAP_ADV_FLAGS GAP Advertisement Flags |
Vincent Coubard |
638:c90ae1400bf2 | 207 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 208 | #define BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE (0x01) /**< LE Limited Discoverable Mode. */ |
Vincent Coubard |
638:c90ae1400bf2 | 209 | #define BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02) /**< LE General Discoverable Mode. */ |
Vincent Coubard |
638:c90ae1400bf2 | 210 | #define BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04) /**< BR/EDR not supported. */ |
Vincent Coubard |
638:c90ae1400bf2 | 211 | #define BLE_GAP_ADV_FLAG_LE_BR_EDR_CONTROLLER (0x08) /**< Simultaneous LE and BR/EDR, Controller. */ |
Vincent Coubard |
638:c90ae1400bf2 | 212 | #define BLE_GAP_ADV_FLAG_LE_BR_EDR_HOST (0x10) /**< Simultaneous LE and BR/EDR, Host. */ |
Vincent Coubard |
638:c90ae1400bf2 | 213 | #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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 214 | #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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 215 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 216 | |
Vincent Coubard |
638:c90ae1400bf2 | 217 | |
Vincent Coubard |
638:c90ae1400bf2 | 218 | /**@defgroup BLE_GAP_ADV_INTERVALS GAP Advertising interval max and min |
Vincent Coubard |
638:c90ae1400bf2 | 219 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 220 | #define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */ |
Vincent Coubard |
638:c90ae1400bf2 | 221 | #define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */ |
Vincent Coubard |
638:c90ae1400bf2 | 222 | #define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */ |
Vincent Coubard |
638:c90ae1400bf2 | 223 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 224 | |
Vincent Coubard |
638:c90ae1400bf2 | 225 | |
Vincent Coubard |
638:c90ae1400bf2 | 226 | /**@defgroup BLE_GAP_SCAN_INTERVALS GAP Scan interval max and min |
Vincent Coubard |
638:c90ae1400bf2 | 227 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 228 | #define BLE_GAP_SCAN_INTERVAL_MIN 0x0004 /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */ |
Vincent Coubard |
638:c90ae1400bf2 | 229 | #define BLE_GAP_SCAN_INTERVAL_MAX 0x4000 /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */ |
Vincent Coubard |
638:c90ae1400bf2 | 230 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 231 | |
Vincent Coubard |
638:c90ae1400bf2 | 232 | |
Vincent Coubard |
638:c90ae1400bf2 | 233 | /**@defgroup BLE_GAP_SCAN_WINDOW GAP Scan window max and min |
Vincent Coubard |
638:c90ae1400bf2 | 234 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 235 | #define BLE_GAP_SCAN_WINDOW_MIN 0x0004 /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */ |
Vincent Coubard |
638:c90ae1400bf2 | 236 | #define BLE_GAP_SCAN_WINDOW_MAX 0x4000 /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */ |
Vincent Coubard |
638:c90ae1400bf2 | 237 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 238 | |
Vincent Coubard |
638:c90ae1400bf2 | 239 | |
Vincent Coubard |
638:c90ae1400bf2 | 240 | /**@defgroup BLE_GAP_SCAN_TIMEOUT GAP Scan timeout max and min |
Vincent Coubard |
638:c90ae1400bf2 | 241 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 242 | #define BLE_GAP_SCAN_TIMEOUT_MIN 0x0001 /**< Minimum Scan timeout in seconds. */ |
Vincent Coubard |
638:c90ae1400bf2 | 243 | #define BLE_GAP_SCAN_TIMEOUT_MAX 0xFFFF /**< Maximum Scan timeout in seconds. */ |
Vincent Coubard |
638:c90ae1400bf2 | 244 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 245 | |
Vincent Coubard |
638:c90ae1400bf2 | 246 | |
Vincent Coubard |
638:c90ae1400bf2 | 247 | /**@brief Maximum size of advertising data in octets. */ |
Vincent Coubard |
638:c90ae1400bf2 | 248 | #define BLE_GAP_ADV_MAX_SIZE 31 |
Vincent Coubard |
638:c90ae1400bf2 | 249 | |
Vincent Coubard |
638:c90ae1400bf2 | 250 | |
Vincent Coubard |
638:c90ae1400bf2 | 251 | /**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types |
Vincent Coubard |
638:c90ae1400bf2 | 252 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 253 | #define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */ |
Vincent Coubard |
638:c90ae1400bf2 | 254 | #define BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01 /**< Connectable directed. */ |
Vincent Coubard |
638:c90ae1400bf2 | 255 | #define BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 /**< Scannable undirected. */ |
Vincent Coubard |
638:c90ae1400bf2 | 256 | #define BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 /**< Non connectable undirected. */ |
Vincent Coubard |
638:c90ae1400bf2 | 257 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 258 | |
Vincent Coubard |
638:c90ae1400bf2 | 259 | |
Vincent Coubard |
638:c90ae1400bf2 | 260 | /**@defgroup BLE_GAP_ADV_FILTER_POLICIES GAP Advertising filter policies |
Vincent Coubard |
638:c90ae1400bf2 | 261 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 262 | #define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */ |
Vincent Coubard |
638:c90ae1400bf2 | 263 | #define BLE_GAP_ADV_FP_FILTER_SCANREQ 0x01 /**< Filter scan requests with whitelist. */ |
Vincent Coubard |
638:c90ae1400bf2 | 264 | #define BLE_GAP_ADV_FP_FILTER_CONNREQ 0x02 /**< Filter connect requests with whitelist. */ |
Vincent Coubard |
638:c90ae1400bf2 | 265 | #define BLE_GAP_ADV_FP_FILTER_BOTH 0x03 /**< Filter both scan and connect requests with whitelist. */ |
Vincent Coubard |
638:c90ae1400bf2 | 266 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 267 | |
Vincent Coubard |
638:c90ae1400bf2 | 268 | |
Vincent Coubard |
638:c90ae1400bf2 | 269 | /**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values |
Vincent Coubard |
638:c90ae1400bf2 | 270 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 271 | #define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX 180 /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */ |
Vincent Coubard |
638:c90ae1400bf2 | 272 | #define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED 0 /**< Unlimited advertising in general discoverable mode. */ |
Vincent Coubard |
638:c90ae1400bf2 | 273 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 274 | |
Vincent Coubard |
638:c90ae1400bf2 | 275 | |
Vincent Coubard |
638:c90ae1400bf2 | 276 | /**@defgroup BLE_GAP_DISC_MODES GAP Discovery modes |
Vincent Coubard |
638:c90ae1400bf2 | 277 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 278 | #define BLE_GAP_DISC_MODE_NOT_DISCOVERABLE 0x00 /**< Not discoverable discovery Mode. */ |
Vincent Coubard |
638:c90ae1400bf2 | 279 | #define BLE_GAP_DISC_MODE_LIMITED 0x01 /**< Limited Discovery Mode. */ |
Vincent Coubard |
638:c90ae1400bf2 | 280 | #define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */ |
Vincent Coubard |
638:c90ae1400bf2 | 281 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 282 | |
Vincent Coubard |
638:c90ae1400bf2 | 283 | /**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities |
Vincent Coubard |
638:c90ae1400bf2 | 284 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 285 | #define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */ |
Vincent Coubard |
638:c90ae1400bf2 | 286 | #define BLE_GAP_IO_CAPS_DISPLAY_YESNO 0x01 /**< Display and Yes/No entry. */ |
Vincent Coubard |
638:c90ae1400bf2 | 287 | #define BLE_GAP_IO_CAPS_KEYBOARD_ONLY 0x02 /**< Keyboard Only. */ |
Vincent Coubard |
638:c90ae1400bf2 | 288 | #define BLE_GAP_IO_CAPS_NONE 0x03 /**< No I/O capabilities. */ |
Vincent Coubard |
638:c90ae1400bf2 | 289 | #define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */ |
Vincent Coubard |
638:c90ae1400bf2 | 290 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 291 | |
Vincent Coubard |
638:c90ae1400bf2 | 292 | |
Vincent Coubard |
638:c90ae1400bf2 | 293 | /**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types |
Vincent Coubard |
638:c90ae1400bf2 | 294 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 295 | #define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */ |
Vincent Coubard |
638:c90ae1400bf2 | 296 | #define BLE_GAP_AUTH_KEY_TYPE_PASSKEY 0x01 /**< 6-digit Passkey. */ |
Vincent Coubard |
638:c90ae1400bf2 | 297 | #define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */ |
Vincent Coubard |
638:c90ae1400bf2 | 298 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 299 | |
Vincent Coubard |
638:c90ae1400bf2 | 300 | /**@defgroup BLE_GAP_SEC_STATUS GAP Security status |
Vincent Coubard |
638:c90ae1400bf2 | 301 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 302 | #define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Procedure completed with success. */ |
Vincent Coubard |
638:c90ae1400bf2 | 303 | #define BLE_GAP_SEC_STATUS_TIMEOUT 0x01 /**< Procedure timed out. */ |
Vincent Coubard |
638:c90ae1400bf2 | 304 | #define BLE_GAP_SEC_STATUS_PDU_INVALID 0x02 /**< Invalid PDU received. */ |
Vincent Coubard |
638:c90ae1400bf2 | 305 | #define BLE_GAP_SEC_STATUS_RFU_RANGE1_BEGIN 0x03 /**< Reserved for Future Use range #1 begin. */ |
Vincent Coubard |
638:c90ae1400bf2 | 306 | #define BLE_GAP_SEC_STATUS_RFU_RANGE1_END 0x80 /**< Reserved for Future Use range #1 end. */ |
Vincent Coubard |
638:c90ae1400bf2 | 307 | #define BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED 0x81 /**< Passkey entry failed (user cancelled or other). */ |
Vincent Coubard |
638:c90ae1400bf2 | 308 | #define BLE_GAP_SEC_STATUS_OOB_NOT_AVAILABLE 0x82 /**< Out of Band Key not available. */ |
Vincent Coubard |
638:c90ae1400bf2 | 309 | #define BLE_GAP_SEC_STATUS_AUTH_REQ 0x83 /**< Authentication requirements not met. */ |
Vincent Coubard |
638:c90ae1400bf2 | 310 | #define BLE_GAP_SEC_STATUS_CONFIRM_VALUE 0x84 /**< Confirm value failed. */ |
Vincent Coubard |
638:c90ae1400bf2 | 311 | #define BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP 0x85 /**< Pairing not supported. */ |
Vincent Coubard |
638:c90ae1400bf2 | 312 | #define BLE_GAP_SEC_STATUS_ENC_KEY_SIZE 0x86 /**< Encryption key size. */ |
Vincent Coubard |
638:c90ae1400bf2 | 313 | #define BLE_GAP_SEC_STATUS_SMP_CMD_UNSUPPORTED 0x87 /**< Unsupported SMP command. */ |
Vincent Coubard |
638:c90ae1400bf2 | 314 | #define BLE_GAP_SEC_STATUS_UNSPECIFIED 0x88 /**< Unspecified reason. */ |
Vincent Coubard |
638:c90ae1400bf2 | 315 | #define BLE_GAP_SEC_STATUS_REPEATED_ATTEMPTS 0x89 /**< Too little time elapsed since last attempt. */ |
Vincent Coubard |
638:c90ae1400bf2 | 316 | #define BLE_GAP_SEC_STATUS_INVALID_PARAMS 0x8A /**< Invalid parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 317 | #define BLE_GAP_SEC_STATUS_RFU_RANGE2_BEGIN 0x8B /**< Reserved for Future Use range #2 begin. */ |
Vincent Coubard |
638:c90ae1400bf2 | 318 | #define BLE_GAP_SEC_STATUS_RFU_RANGE2_END 0xFF /**< Reserved for Future Use range #2 end. */ |
Vincent Coubard |
638:c90ae1400bf2 | 319 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 320 | |
Vincent Coubard |
638:c90ae1400bf2 | 321 | /**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources |
Vincent Coubard |
638:c90ae1400bf2 | 322 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 323 | #define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 324 | #define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 325 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 326 | |
Vincent Coubard |
638:c90ae1400bf2 | 327 | /**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits |
Vincent Coubard |
638:c90ae1400bf2 | 328 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 329 | #define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connction interval specified in connect parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 330 | #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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 331 | #define BLE_GAP_CP_MIN_CONN_INTVL_MAX 0x0C80 /**< Highest minimum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ |
Vincent Coubard |
638:c90ae1400bf2 | 332 | #define BLE_GAP_CP_MAX_CONN_INTVL_NONE 0xFFFF /**< No new maximum connction interval specified in connect parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 333 | #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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 334 | #define BLE_GAP_CP_MAX_CONN_INTVL_MAX 0x0C80 /**< Highest maximum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ |
Vincent Coubard |
638:c90ae1400bf2 | 335 | #define BLE_GAP_CP_SLAVE_LATENCY_MAX 0x01F3 /**< Highest slave latency permitted, in connection events. */ |
Vincent Coubard |
638:c90ae1400bf2 | 336 | #define BLE_GAP_CP_CONN_SUP_TIMEOUT_NONE 0xFFFF /**< No new supervision timeout specified in connect parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 337 | #define BLE_GAP_CP_CONN_SUP_TIMEOUT_MIN 0x000A /**< Lowest supervision timeout permitted, in units of 10 ms, i.e. 100 ms. */ |
Vincent Coubard |
638:c90ae1400bf2 | 338 | #define BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX 0x0C80 /**< Highest supervision timeout permitted, in units of 10 ms, i.e. 32 s. */ |
Vincent Coubard |
638:c90ae1400bf2 | 339 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 340 | |
Vincent Coubard |
638:c90ae1400bf2 | 341 | |
Vincent Coubard |
638:c90ae1400bf2 | 342 | /**@brief GAP device name maximum length. */ |
Vincent Coubard |
638:c90ae1400bf2 | 343 | #define BLE_GAP_DEVNAME_MAX_LEN 31 |
Vincent Coubard |
638:c90ae1400bf2 | 344 | |
Vincent Coubard |
638:c90ae1400bf2 | 345 | /**@brief Disable RSSI events for connections */ |
Vincent Coubard |
638:c90ae1400bf2 | 346 | #define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF |
Vincent Coubard |
638:c90ae1400bf2 | 347 | |
Vincent Coubard |
638:c90ae1400bf2 | 348 | /**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters |
Vincent Coubard |
638:c90ae1400bf2 | 349 | * |
Vincent Coubard |
638:c90ae1400bf2 | 350 | * See @ref ble_gap_conn_sec_mode_t. |
Vincent Coubard |
638:c90ae1400bf2 | 351 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 352 | /**@brief Set sec_mode pointed to by ptr to have no access rights.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 353 | #define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr) do {(ptr)->sm = 0; (ptr)->lv = 0;} while(0) |
Vincent Coubard |
638:c90ae1400bf2 | 354 | /**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 355 | #define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr) do {(ptr)->sm = 1; (ptr)->lv = 1;} while(0) |
Vincent Coubard |
638:c90ae1400bf2 | 356 | /**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 357 | #define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 2;} while(0) |
Vincent Coubard |
638:c90ae1400bf2 | 358 | /**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 359 | #define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 3;} while(0) |
Vincent Coubard |
638:c90ae1400bf2 | 360 | /**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 361 | #define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 1;} while(0) |
Vincent Coubard |
638:c90ae1400bf2 | 362 | /**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 363 | #define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 2;} while(0) |
Vincent Coubard |
638:c90ae1400bf2 | 364 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 365 | |
Vincent Coubard |
638:c90ae1400bf2 | 366 | |
Vincent Coubard |
638:c90ae1400bf2 | 367 | /**@brief GAP Security Random Number Length. */ |
Vincent Coubard |
638:c90ae1400bf2 | 368 | #define BLE_GAP_SEC_RAND_LEN 8 |
Vincent Coubard |
638:c90ae1400bf2 | 369 | |
Vincent Coubard |
638:c90ae1400bf2 | 370 | /**@brief GAP Security Key Length. */ |
Vincent Coubard |
638:c90ae1400bf2 | 371 | #define BLE_GAP_SEC_KEY_LEN 16 |
Vincent Coubard |
638:c90ae1400bf2 | 372 | |
Vincent Coubard |
638:c90ae1400bf2 | 373 | /**@brief GAP Passkey Length. */ |
Vincent Coubard |
638:c90ae1400bf2 | 374 | #define BLE_GAP_PASSKEY_LEN 6 |
Vincent Coubard |
638:c90ae1400bf2 | 375 | |
Vincent Coubard |
638:c90ae1400bf2 | 376 | /**@brief Maximum amount of addresses in a whitelist. */ |
Vincent Coubard |
638:c90ae1400bf2 | 377 | #define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8) |
Vincent Coubard |
638:c90ae1400bf2 | 378 | |
Vincent Coubard |
638:c90ae1400bf2 | 379 | /**@brief Maximum amount of IRKs in a whitelist. |
Vincent Coubard |
638:c90ae1400bf2 | 380 | * @note The number of IRKs is limited to 8, even if the hardware supports more. |
Vincent Coubard |
638:c90ae1400bf2 | 381 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 382 | #define BLE_GAP_WHITELIST_IRK_MAX_COUNT (8) |
Vincent Coubard |
638:c90ae1400bf2 | 383 | |
Vincent Coubard |
638:c90ae1400bf2 | 384 | /**@defgroup GAP_SEC_MODES GAP Security Modes |
Vincent Coubard |
638:c90ae1400bf2 | 385 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 386 | #define BLE_GAP_SEC_MODE 0x00 /**< No key (may be used to reject). */ |
Vincent Coubard |
638:c90ae1400bf2 | 387 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 388 | |
Vincent Coubard |
638:c90ae1400bf2 | 389 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 390 | |
Vincent Coubard |
638:c90ae1400bf2 | 391 | /**@addtogroup BLE_GAP_STRUCTURES Structures |
Vincent Coubard |
638:c90ae1400bf2 | 392 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 393 | |
Vincent Coubard |
638:c90ae1400bf2 | 394 | /**@brief Bluetooth Low Energy address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 395 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 396 | { |
Vincent Coubard |
638:c90ae1400bf2 | 397 | uint8_t addr_type; /**< See @ref BLE_GAP_ADDR_TYPES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 398 | uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ |
Vincent Coubard |
638:c90ae1400bf2 | 399 | } ble_gap_addr_t; |
Vincent Coubard |
638:c90ae1400bf2 | 400 | |
Vincent Coubard |
638:c90ae1400bf2 | 401 | |
Vincent Coubard |
638:c90ae1400bf2 | 402 | /**@brief GAP connection parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 403 | * |
Vincent Coubard |
638:c90ae1400bf2 | 404 | * @note When ble_conn_params_t is received in an event, both min_conn_interval and |
Vincent Coubard |
638:c90ae1400bf2 | 405 | * max_conn_interval will be equal to the connection interval set by the central. |
Vincent Coubard |
638:c90ae1400bf2 | 406 | * |
Vincent Coubard |
638:c90ae1400bf2 | 407 | * @note If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies: |
Vincent Coubard |
638:c90ae1400bf2 | 408 | * conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval |
Vincent Coubard |
638:c90ae1400bf2 | 409 | * that corresponds to the following Bluetooth Spec requirement: |
Vincent Coubard |
638:c90ae1400bf2 | 410 | * The Supervision_Timeout in milliseconds shall be larger than |
Vincent Coubard |
638:c90ae1400bf2 | 411 | * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds. |
Vincent Coubard |
638:c90ae1400bf2 | 412 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 413 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 414 | { |
Vincent Coubard |
638:c90ae1400bf2 | 415 | uint16_t min_conn_interval; /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 416 | uint16_t max_conn_interval; /**< Maximum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 417 | uint16_t slave_latency; /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 418 | uint16_t conn_sup_timeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 419 | } ble_gap_conn_params_t; |
Vincent Coubard |
638:c90ae1400bf2 | 420 | |
Vincent Coubard |
638:c90ae1400bf2 | 421 | |
Vincent Coubard |
638:c90ae1400bf2 | 422 | /**@brief GAP connection security modes. |
Vincent Coubard |
638:c90ae1400bf2 | 423 | * |
Vincent Coubard |
638:c90ae1400bf2 | 424 | * Security Mode 0 Level 0: No access permissions at all (this level is not defined by the Bluetooth Core specification).\n |
Vincent Coubard |
638:c90ae1400bf2 | 425 | * Security Mode 1 Level 1: No security is needed (aka open link).\n |
Vincent Coubard |
638:c90ae1400bf2 | 426 | * Security Mode 1 Level 2: Encrypted link required, MITM protection not necessary.\n |
Vincent Coubard |
638:c90ae1400bf2 | 427 | * Security Mode 1 Level 3: MITM protected encrypted link required.\n |
Vincent Coubard |
638:c90ae1400bf2 | 428 | * Security Mode 2 Level 1: Signing or encryption required, MITM protection not necessary.\n |
Vincent Coubard |
638:c90ae1400bf2 | 429 | * Security Mode 2 Level 2: MITM protected signing required, unless link is MITM protected encrypted.\n |
Vincent Coubard |
638:c90ae1400bf2 | 430 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 431 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 432 | { |
Vincent Coubard |
638:c90ae1400bf2 | 433 | uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */ |
Vincent Coubard |
638:c90ae1400bf2 | 434 | uint8_t lv : 4; /**< Level (1, 2 or 3), 0 for no permissions at all. */ |
Vincent Coubard |
638:c90ae1400bf2 | 435 | |
Vincent Coubard |
638:c90ae1400bf2 | 436 | } ble_gap_conn_sec_mode_t; |
Vincent Coubard |
638:c90ae1400bf2 | 437 | |
Vincent Coubard |
638:c90ae1400bf2 | 438 | |
Vincent Coubard |
638:c90ae1400bf2 | 439 | /**@brief GAP connection security status.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 440 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 441 | { |
Vincent Coubard |
638:c90ae1400bf2 | 442 | ble_gap_conn_sec_mode_t sec_mode; /**< Currently active security mode for this connection.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 443 | uint8_t encr_key_size; /**< Length of currently active encryption key, 7 to 16 octets (only applicable for bonding procedures). */ |
Vincent Coubard |
638:c90ae1400bf2 | 444 | } ble_gap_conn_sec_t; |
Vincent Coubard |
638:c90ae1400bf2 | 445 | |
Vincent Coubard |
638:c90ae1400bf2 | 446 | |
Vincent Coubard |
638:c90ae1400bf2 | 447 | /**@brief Identity Resolving Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 448 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 449 | { |
Vincent Coubard |
638:c90ae1400bf2 | 450 | uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing IRK. */ |
Vincent Coubard |
638:c90ae1400bf2 | 451 | } ble_gap_irk_t; |
Vincent Coubard |
638:c90ae1400bf2 | 452 | |
Vincent Coubard |
638:c90ae1400bf2 | 453 | |
Vincent Coubard |
638:c90ae1400bf2 | 454 | /**@brief Whitelist structure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 455 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 456 | { |
Vincent Coubard |
638:c90ae1400bf2 | 457 | ble_gap_addr_t **pp_addrs; /**< Pointer to an array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */ |
Vincent Coubard |
638:c90ae1400bf2 | 458 | uint8_t addr_count; /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */ |
Vincent Coubard |
638:c90ae1400bf2 | 459 | ble_gap_irk_t **pp_irks; /**< Pointer to an array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are given. */ |
Vincent Coubard |
638:c90ae1400bf2 | 460 | uint8_t irk_count; /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */ |
Vincent Coubard |
638:c90ae1400bf2 | 461 | } ble_gap_whitelist_t; |
Vincent Coubard |
638:c90ae1400bf2 | 462 | |
Vincent Coubard |
638:c90ae1400bf2 | 463 | /**@brief Channel mask for RF channels used in advertising and scanning. */ |
Vincent Coubard |
638:c90ae1400bf2 | 464 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 465 | { |
Vincent Coubard |
638:c90ae1400bf2 | 466 | uint8_t ch_37_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 37 */ |
Vincent Coubard |
638:c90ae1400bf2 | 467 | uint8_t ch_38_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 38 */ |
Vincent Coubard |
638:c90ae1400bf2 | 468 | uint8_t ch_39_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 39 */ |
Vincent Coubard |
638:c90ae1400bf2 | 469 | } ble_gap_adv_ch_mask_t; |
Vincent Coubard |
638:c90ae1400bf2 | 470 | |
Vincent Coubard |
638:c90ae1400bf2 | 471 | /**@brief GAP advertising parameters.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 472 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 473 | { |
Vincent Coubard |
638:c90ae1400bf2 | 474 | uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 475 | ble_gap_addr_t *p_peer_addr; /**< For @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND mode only, known peer address. */ |
Vincent Coubard |
638:c90ae1400bf2 | 476 | uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 477 | ble_gap_whitelist_t *p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */ |
Vincent Coubard |
638:c90ae1400bf2 | 478 | uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS. |
Vincent Coubard |
638:c90ae1400bf2 | 479 | - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for high duty cycle directed advertising. |
Vincent Coubard |
638:c90ae1400bf2 | 480 | - 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.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 481 | 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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 482 | ble_gap_adv_ch_mask_t channel_mask; /**< Advertising channel mask. @see ble_gap_channel_mask_t for documentation. */ |
Vincent Coubard |
638:c90ae1400bf2 | 483 | } ble_gap_adv_params_t; |
Vincent Coubard |
638:c90ae1400bf2 | 484 | |
Vincent Coubard |
638:c90ae1400bf2 | 485 | |
Vincent Coubard |
638:c90ae1400bf2 | 486 | /**@brief GAP scanning parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 487 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 488 | { |
Vincent Coubard |
638:c90ae1400bf2 | 489 | uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */ |
Vincent Coubard |
638:c90ae1400bf2 | 490 | uint8_t selective : 1; /**< If 1, ignore unknown devices (non whitelisted). */ |
Vincent Coubard |
638:c90ae1400bf2 | 491 | ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */ |
Vincent Coubard |
638:c90ae1400bf2 | 492 | uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ |
Vincent Coubard |
638:c90ae1400bf2 | 493 | uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ |
Vincent Coubard |
638:c90ae1400bf2 | 494 | uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ |
Vincent Coubard |
638:c90ae1400bf2 | 495 | } ble_gap_scan_params_t; |
Vincent Coubard |
638:c90ae1400bf2 | 496 | |
Vincent Coubard |
638:c90ae1400bf2 | 497 | |
Vincent Coubard |
638:c90ae1400bf2 | 498 | /** @brief Keys that can be exchanged during a bonding procedure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 499 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 500 | { |
Vincent Coubard |
638:c90ae1400bf2 | 501 | uint8_t enc : 1; /**< Long Term Key and Master Identification. */ |
Vincent Coubard |
638:c90ae1400bf2 | 502 | uint8_t id : 1; /**< Identity Resolving Key and Identity Address Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 503 | uint8_t sign : 1; /**< Connection Signature Resolving Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 504 | } ble_gap_sec_kdist_t; |
Vincent Coubard |
638:c90ae1400bf2 | 505 | |
Vincent Coubard |
638:c90ae1400bf2 | 506 | |
Vincent Coubard |
638:c90ae1400bf2 | 507 | /**@brief GAP security parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 508 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 509 | { |
Vincent Coubard |
638:c90ae1400bf2 | 510 | uint8_t bond : 1; /**< Perform bonding. */ |
Vincent Coubard |
638:c90ae1400bf2 | 511 | uint8_t mitm : 1; /**< Man In The Middle protection required. */ |
Vincent Coubard |
638:c90ae1400bf2 | 512 | uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ |
Vincent Coubard |
638:c90ae1400bf2 | 513 | uint8_t oob : 1; /**< Out Of Band data available. */ |
Vincent Coubard |
638:c90ae1400bf2 | 514 | uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ |
Vincent Coubard |
638:c90ae1400bf2 | 515 | uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */ |
Vincent Coubard |
638:c90ae1400bf2 | 516 | ble_gap_sec_kdist_t kdist_periph; /**< Key distribution bitmap: keys that the peripheral device will distribute. */ |
Vincent Coubard |
638:c90ae1400bf2 | 517 | ble_gap_sec_kdist_t kdist_central; /**< Key distribution bitmap: keys that the central device will distribute. */ |
Vincent Coubard |
638:c90ae1400bf2 | 518 | } ble_gap_sec_params_t; |
Vincent Coubard |
638:c90ae1400bf2 | 519 | |
Vincent Coubard |
638:c90ae1400bf2 | 520 | |
Vincent Coubard |
638:c90ae1400bf2 | 521 | /**@brief GAP Encryption Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 522 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 523 | { |
Vincent Coubard |
638:c90ae1400bf2 | 524 | uint8_t ltk[BLE_GAP_SEC_KEY_LEN]; /**< Long Term Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 525 | uint8_t auth : 1; /**< Authenticated Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 526 | uint8_t ltk_len : 7; /**< LTK length in octets. */ |
Vincent Coubard |
638:c90ae1400bf2 | 527 | } ble_gap_enc_info_t; |
Vincent Coubard |
638:c90ae1400bf2 | 528 | |
Vincent Coubard |
638:c90ae1400bf2 | 529 | |
Vincent Coubard |
638:c90ae1400bf2 | 530 | /**@brief GAP Master Identification. */ |
Vincent Coubard |
638:c90ae1400bf2 | 531 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 532 | { |
Vincent Coubard |
638:c90ae1400bf2 | 533 | uint16_t ediv; /**< Encrypted Diversifier. */ |
Vincent Coubard |
638:c90ae1400bf2 | 534 | uint8_t rand[BLE_GAP_SEC_RAND_LEN]; /**< Random Number. */ |
Vincent Coubard |
638:c90ae1400bf2 | 535 | } ble_gap_master_id_t; |
Vincent Coubard |
638:c90ae1400bf2 | 536 | |
Vincent Coubard |
638:c90ae1400bf2 | 537 | |
Vincent Coubard |
638:c90ae1400bf2 | 538 | /**@brief GAP Signing Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 539 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 540 | { |
Vincent Coubard |
638:c90ae1400bf2 | 541 | uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /**< Connection Signature Resolving Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 542 | } ble_gap_sign_info_t; |
Vincent Coubard |
638:c90ae1400bf2 | 543 | |
Vincent Coubard |
638:c90ae1400bf2 | 544 | |
Vincent Coubard |
638:c90ae1400bf2 | 545 | /**@brief Event structure for @ref BLE_GAP_EVT_CONNECTED. */ |
Vincent Coubard |
638:c90ae1400bf2 | 546 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 547 | { |
Vincent Coubard |
638:c90ae1400bf2 | 548 | ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ |
Vincent Coubard |
638:c90ae1400bf2 | 549 | ble_gap_addr_t own_addr; /**< Bluetooth address of the local device used during connection setup. */ |
Vincent Coubard |
638:c90ae1400bf2 | 550 | #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) |
Vincent Coubard |
638:c90ae1400bf2 | 551 | uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */ |
Vincent Coubard |
638:c90ae1400bf2 | 552 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 553 | uint8_t irk_match :1; /**< If 1, peer device's address resolved using an IRK. */ |
Vincent Coubard |
638:c90ae1400bf2 | 554 | uint8_t irk_match_idx :7; /**< Index in IRK list where the address was matched. */ |
Vincent Coubard |
638:c90ae1400bf2 | 555 | ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 556 | } ble_gap_evt_connected_t; |
Vincent Coubard |
638:c90ae1400bf2 | 557 | |
Vincent Coubard |
638:c90ae1400bf2 | 558 | |
Vincent Coubard |
638:c90ae1400bf2 | 559 | /**@brief Event structure for @ref BLE_GAP_EVT_DISCONNECTED. */ |
Vincent Coubard |
638:c90ae1400bf2 | 560 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 561 | { |
Vincent Coubard |
638:c90ae1400bf2 | 562 | uint8_t reason; /**< HCI error code, see @ref BLE_HCI_STATUS_CODES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 563 | } ble_gap_evt_disconnected_t; |
Vincent Coubard |
638:c90ae1400bf2 | 564 | |
Vincent Coubard |
638:c90ae1400bf2 | 565 | |
Vincent Coubard |
638:c90ae1400bf2 | 566 | /**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE. */ |
Vincent Coubard |
638:c90ae1400bf2 | 567 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 568 | { |
Vincent Coubard |
638:c90ae1400bf2 | 569 | ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 570 | } ble_gap_evt_conn_param_update_t; |
Vincent Coubard |
638:c90ae1400bf2 | 571 | |
Vincent Coubard |
638:c90ae1400bf2 | 572 | |
Vincent Coubard |
638:c90ae1400bf2 | 573 | /**@brief Event structure for @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. */ |
Vincent Coubard |
638:c90ae1400bf2 | 574 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 575 | { |
Vincent Coubard |
638:c90ae1400bf2 | 576 | ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 577 | } ble_gap_evt_sec_params_request_t; |
Vincent Coubard |
638:c90ae1400bf2 | 578 | |
Vincent Coubard |
638:c90ae1400bf2 | 579 | |
Vincent Coubard |
638:c90ae1400bf2 | 580 | /**@brief Event structure for @ref BLE_GAP_EVT_SEC_INFO_REQUEST. */ |
Vincent Coubard |
638:c90ae1400bf2 | 581 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 582 | { |
Vincent Coubard |
638:c90ae1400bf2 | 583 | ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ |
Vincent Coubard |
638:c90ae1400bf2 | 584 | ble_gap_master_id_t master_id; /**< Master Identification for LTK lookup. */ |
Vincent Coubard |
638:c90ae1400bf2 | 585 | uint8_t enc_info : 1; /**< If 1, Encryption Information required. */ |
Vincent Coubard |
638:c90ae1400bf2 | 586 | uint8_t id_info : 1; /**< If 1, Identity Information required. */ |
Vincent Coubard |
638:c90ae1400bf2 | 587 | uint8_t sign_info : 1; /**< If 1, Signing Information required. */ |
Vincent Coubard |
638:c90ae1400bf2 | 588 | } ble_gap_evt_sec_info_request_t; |
Vincent Coubard |
638:c90ae1400bf2 | 589 | |
Vincent Coubard |
638:c90ae1400bf2 | 590 | |
Vincent Coubard |
638:c90ae1400bf2 | 591 | /**@brief Event structure for @ref BLE_GAP_EVT_PASSKEY_DISPLAY. */ |
Vincent Coubard |
638:c90ae1400bf2 | 592 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 593 | { |
Vincent Coubard |
638:c90ae1400bf2 | 594 | uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */ |
Vincent Coubard |
638:c90ae1400bf2 | 595 | } ble_gap_evt_passkey_display_t; |
Vincent Coubard |
638:c90ae1400bf2 | 596 | |
Vincent Coubard |
638:c90ae1400bf2 | 597 | |
Vincent Coubard |
638:c90ae1400bf2 | 598 | /**@brief Event structure for @ref BLE_GAP_EVT_AUTH_KEY_REQUEST. */ |
Vincent Coubard |
638:c90ae1400bf2 | 599 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 600 | { |
Vincent Coubard |
638:c90ae1400bf2 | 601 | uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 602 | } ble_gap_evt_auth_key_request_t; |
Vincent Coubard |
638:c90ae1400bf2 | 603 | |
Vincent Coubard |
638:c90ae1400bf2 | 604 | |
Vincent Coubard |
638:c90ae1400bf2 | 605 | /**@brief Security levels supported. |
Vincent Coubard |
638:c90ae1400bf2 | 606 | * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10. |
Vincent Coubard |
638:c90ae1400bf2 | 607 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 608 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 609 | { |
Vincent Coubard |
638:c90ae1400bf2 | 610 | uint8_t lv1 : 1; /**< If 1: Level 1 is supported. */ |
Vincent Coubard |
638:c90ae1400bf2 | 611 | uint8_t lv2 : 1; /**< If 1: Level 2 is supported. */ |
Vincent Coubard |
638:c90ae1400bf2 | 612 | uint8_t lv3 : 1; /**< If 1: Level 3 is supported. */ |
Vincent Coubard |
638:c90ae1400bf2 | 613 | } ble_gap_sec_levels_t; |
Vincent Coubard |
638:c90ae1400bf2 | 614 | |
Vincent Coubard |
638:c90ae1400bf2 | 615 | |
Vincent Coubard |
638:c90ae1400bf2 | 616 | /**@brief Encryption Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 617 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 618 | { |
Vincent Coubard |
638:c90ae1400bf2 | 619 | ble_gap_enc_info_t enc_info; /**< Encryption Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 620 | ble_gap_master_id_t master_id; /**< Master Identification. */ |
Vincent Coubard |
638:c90ae1400bf2 | 621 | } ble_gap_enc_key_t; |
Vincent Coubard |
638:c90ae1400bf2 | 622 | |
Vincent Coubard |
638:c90ae1400bf2 | 623 | |
Vincent Coubard |
638:c90ae1400bf2 | 624 | /**@brief Identity Key. */ |
Vincent Coubard |
638:c90ae1400bf2 | 625 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 626 | { |
Vincent Coubard |
638:c90ae1400bf2 | 627 | ble_gap_irk_t id_info; /**< Identity Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 628 | ble_gap_addr_t id_addr_info; /**< Identity Address Information. */ |
Vincent Coubard |
638:c90ae1400bf2 | 629 | } ble_gap_id_key_t; |
Vincent Coubard |
638:c90ae1400bf2 | 630 | |
Vincent Coubard |
638:c90ae1400bf2 | 631 | |
Vincent Coubard |
638:c90ae1400bf2 | 632 | /**@brief Security Keys. */ |
Vincent Coubard |
638:c90ae1400bf2 | 633 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 634 | { |
Vincent Coubard |
638:c90ae1400bf2 | 635 | ble_gap_enc_key_t *p_enc_key; /**< Encryption Key, or NULL. */ |
Vincent Coubard |
638:c90ae1400bf2 | 636 | ble_gap_id_key_t *p_id_key; /**< Identity Key, or NULL. */ |
Vincent Coubard |
638:c90ae1400bf2 | 637 | ble_gap_sign_info_t *p_sign_key; /**< Signing Key, or NULL. */ |
Vincent Coubard |
638:c90ae1400bf2 | 638 | } ble_gap_sec_keys_t; |
Vincent Coubard |
638:c90ae1400bf2 | 639 | |
Vincent Coubard |
638:c90ae1400bf2 | 640 | |
Vincent Coubard |
638:c90ae1400bf2 | 641 | /**@brief Security key set (both Peripheral and Central keys). |
Vincent Coubard |
638:c90ae1400bf2 | 642 | * Note that when distributing Bluetooth addresses pertaining to the local device those |
Vincent Coubard |
638:c90ae1400bf2 | 643 | * will have to be filled in by the user. */ |
Vincent Coubard |
638:c90ae1400bf2 | 644 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 645 | { |
Vincent Coubard |
638:c90ae1400bf2 | 646 | ble_gap_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ |
Vincent Coubard |
638:c90ae1400bf2 | 647 | ble_gap_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ |
Vincent Coubard |
638:c90ae1400bf2 | 648 | } ble_gap_sec_keyset_t; |
Vincent Coubard |
638:c90ae1400bf2 | 649 | |
Vincent Coubard |
638:c90ae1400bf2 | 650 | |
Vincent Coubard |
638:c90ae1400bf2 | 651 | /**@brief Event structure for @ref BLE_GAP_EVT_AUTH_STATUS. */ |
Vincent Coubard |
638:c90ae1400bf2 | 652 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 653 | { |
Vincent Coubard |
638:c90ae1400bf2 | 654 | uint8_t auth_status; /**< Authentication status, see @ref BLE_GAP_SEC_STATUS. */ |
Vincent Coubard |
638:c90ae1400bf2 | 655 | uint8_t error_src : 2; /**< On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 656 | uint8_t bonded : 1; /**< Procedure resulted in a bond. */ |
Vincent Coubard |
638:c90ae1400bf2 | 657 | ble_gap_sec_levels_t sm1_levels; /**< Levels supported in Security Mode 1. */ |
Vincent Coubard |
638:c90ae1400bf2 | 658 | ble_gap_sec_levels_t sm2_levels; /**< Levels supported in Security Mode 2. */ |
Vincent Coubard |
638:c90ae1400bf2 | 659 | ble_gap_sec_kdist_t kdist_periph; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */ |
Vincent Coubard |
638:c90ae1400bf2 | 660 | ble_gap_sec_kdist_t kdist_central; /**< Bitmap stating which keys were exchanged (distributed) by the central. */ |
Vincent Coubard |
638:c90ae1400bf2 | 661 | } ble_gap_evt_auth_status_t; |
Vincent Coubard |
638:c90ae1400bf2 | 662 | |
Vincent Coubard |
638:c90ae1400bf2 | 663 | |
Vincent Coubard |
638:c90ae1400bf2 | 664 | /**@brief Event structure for @ref BLE_GAP_EVT_CONN_SEC_UPDATE. */ |
Vincent Coubard |
638:c90ae1400bf2 | 665 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 666 | { |
Vincent Coubard |
638:c90ae1400bf2 | 667 | ble_gap_conn_sec_t conn_sec; /**< Connection security level. */ |
Vincent Coubard |
638:c90ae1400bf2 | 668 | } ble_gap_evt_conn_sec_update_t; |
Vincent Coubard |
638:c90ae1400bf2 | 669 | |
Vincent Coubard |
638:c90ae1400bf2 | 670 | |
Vincent Coubard |
638:c90ae1400bf2 | 671 | /**@brief Event structure for @ref BLE_GAP_EVT_TIMEOUT. */ |
Vincent Coubard |
638:c90ae1400bf2 | 672 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 673 | { |
Vincent Coubard |
638:c90ae1400bf2 | 674 | uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */ |
Vincent Coubard |
638:c90ae1400bf2 | 675 | } ble_gap_evt_timeout_t; |
Vincent Coubard |
638:c90ae1400bf2 | 676 | |
Vincent Coubard |
638:c90ae1400bf2 | 677 | |
Vincent Coubard |
638:c90ae1400bf2 | 678 | /**@brief Event structure for @ref BLE_GAP_EVT_RSSI_CHANGED. */ |
Vincent Coubard |
638:c90ae1400bf2 | 679 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 680 | { |
Vincent Coubard |
638:c90ae1400bf2 | 681 | int8_t rssi; /**< Received Signal Strength Indication in dBm. */ |
Vincent Coubard |
638:c90ae1400bf2 | 682 | } ble_gap_evt_rssi_changed_t; |
Vincent Coubard |
638:c90ae1400bf2 | 683 | |
Vincent Coubard |
638:c90ae1400bf2 | 684 | |
Vincent Coubard |
638:c90ae1400bf2 | 685 | /**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT. */ |
Vincent Coubard |
638:c90ae1400bf2 | 686 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 687 | { |
Vincent Coubard |
638:c90ae1400bf2 | 688 | ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ |
Vincent Coubard |
638:c90ae1400bf2 | 689 | int8_t rssi; /**< Received Signal Strength Indication in dBm. */ |
Vincent Coubard |
638:c90ae1400bf2 | 690 | uint8_t scan_rsp : 1; /**< If 1, the report corresponds to a scan response and the type field may be ignored. */ |
Vincent Coubard |
638:c90ae1400bf2 | 691 | uint8_t type : 2; /**< See @ref BLE_GAP_ADV_TYPES. Only valid if the scan_rsp field is 0. */ |
Vincent Coubard |
638:c90ae1400bf2 | 692 | uint8_t dlen : 5; /**< Advertising or scan response data length. */ |
Vincent Coubard |
638:c90ae1400bf2 | 693 | uint8_t data[BLE_GAP_ADV_MAX_SIZE]; /**< Advertising or scan response data. */ |
Vincent Coubard |
638:c90ae1400bf2 | 694 | } ble_gap_evt_adv_report_t; |
Vincent Coubard |
638:c90ae1400bf2 | 695 | |
Vincent Coubard |
638:c90ae1400bf2 | 696 | |
Vincent Coubard |
638:c90ae1400bf2 | 697 | /**@brief Event structure for @ref BLE_GAP_EVT_SEC_REQUEST. */ |
Vincent Coubard |
638:c90ae1400bf2 | 698 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 699 | { |
Vincent Coubard |
638:c90ae1400bf2 | 700 | uint8_t bond : 1; /**< Perform bonding. */ |
Vincent Coubard |
638:c90ae1400bf2 | 701 | uint8_t mitm : 1; /**< Man In The Middle protection required. */ |
Vincent Coubard |
638:c90ae1400bf2 | 702 | } ble_gap_evt_sec_request_t; |
Vincent Coubard |
638:c90ae1400bf2 | 703 | |
Vincent Coubard |
638:c90ae1400bf2 | 704 | |
Vincent Coubard |
638:c90ae1400bf2 | 705 | /**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST. */ |
Vincent Coubard |
638:c90ae1400bf2 | 706 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 707 | { |
Vincent Coubard |
638:c90ae1400bf2 | 708 | ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 709 | } ble_gap_evt_conn_param_update_request_t; |
Vincent Coubard |
638:c90ae1400bf2 | 710 | |
Vincent Coubard |
638:c90ae1400bf2 | 711 | |
Vincent Coubard |
638:c90ae1400bf2 | 712 | /**@brief Event structure for @ref BLE_GAP_EVT_SCAN_REQ_REPORT. */ |
Vincent Coubard |
638:c90ae1400bf2 | 713 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 714 | { |
Vincent Coubard |
638:c90ae1400bf2 | 715 | int8_t rssi; /**< Received Signal Strength Indication in dBm. */ |
Vincent Coubard |
638:c90ae1400bf2 | 716 | ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ |
Vincent Coubard |
638:c90ae1400bf2 | 717 | } ble_gap_evt_scan_req_report_t; |
Vincent Coubard |
638:c90ae1400bf2 | 718 | |
Vincent Coubard |
638:c90ae1400bf2 | 719 | |
Vincent Coubard |
638:c90ae1400bf2 | 720 | |
Vincent Coubard |
638:c90ae1400bf2 | 721 | /**@brief GAP event structure. */ |
Vincent Coubard |
638:c90ae1400bf2 | 722 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 723 | { |
Vincent Coubard |
638:c90ae1400bf2 | 724 | uint16_t conn_handle; /**< Connection Handle on which event occured. */ |
Vincent Coubard |
638:c90ae1400bf2 | 725 | union /**< union alternative identified by evt_id in enclosing struct. */ |
Vincent Coubard |
638:c90ae1400bf2 | 726 | { |
Vincent Coubard |
638:c90ae1400bf2 | 727 | ble_gap_evt_connected_t connected; /**< Connected Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 728 | ble_gap_evt_disconnected_t disconnected; /**< Disconnected Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 729 | ble_gap_evt_conn_param_update_t conn_param_update; /**< Connection Parameter Update Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 730 | ble_gap_evt_sec_params_request_t sec_params_request; /**< Security Parameters Request Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 731 | ble_gap_evt_sec_info_request_t sec_info_request; /**< Security Information Request Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 732 | ble_gap_evt_passkey_display_t passkey_display; /**< Passkey Display Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 733 | ble_gap_evt_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 734 | ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 735 | ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 736 | ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 737 | ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 738 | ble_gap_evt_adv_report_t adv_report; /**< Advertising Report Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 739 | ble_gap_evt_sec_request_t sec_request; /**< Security Request Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 740 | ble_gap_evt_conn_param_update_request_t conn_param_update_request; /**< Connection Parameter Update Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 741 | ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 742 | } params; /**< Event Parameters. */ |
Vincent Coubard |
638:c90ae1400bf2 | 743 | |
Vincent Coubard |
638:c90ae1400bf2 | 744 | } ble_gap_evt_t; |
Vincent Coubard |
638:c90ae1400bf2 | 745 | |
Vincent Coubard |
638:c90ae1400bf2 | 746 | |
Vincent Coubard |
638:c90ae1400bf2 | 747 | /**@brief Channel Map option. |
Vincent Coubard |
638:c90ae1400bf2 | 748 | * Used with @ref sd_ble_opt_get to get the current channel map |
Vincent Coubard |
638:c90ae1400bf2 | 749 | * or @ref sd_ble_opt_set to set a new channel map. When setting the |
Vincent Coubard |
638:c90ae1400bf2 | 750 | * channel map, it applies to all current and future connections. When getting the |
Vincent Coubard |
638:c90ae1400bf2 | 751 | * current channel map, it applies to a single connection and the connection handle |
Vincent Coubard |
638:c90ae1400bf2 | 752 | * must be supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 753 | * |
Vincent Coubard |
638:c90ae1400bf2 | 754 | * @note Setting the channel map may take some time, depending on connection parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 755 | * The time taken may be different for each connection and the get operation will |
Vincent Coubard |
638:c90ae1400bf2 | 756 | * return the previous channel map until the new one has taken effect. |
Vincent Coubard |
638:c90ae1400bf2 | 757 | * |
Vincent Coubard |
638:c90ae1400bf2 | 758 | * @note After setting the channel map, by spec it can not be set again until at least 1 s has passed. |
Vincent Coubard |
638:c90ae1400bf2 | 759 | * See Bluetooth Specification Version 4.1 Volume 2, Part E, Section 7.3.46. |
Vincent Coubard |
638:c90ae1400bf2 | 760 | * |
Vincent Coubard |
638:c90ae1400bf2 | 761 | * @retval ::NRF_SUCCESS Get or set successful. |
Vincent Coubard |
638:c90ae1400bf2 | 762 | * @retval ::NRF_ERROR_BUSY Channel map was set again before enough time had passed. |
Vincent Coubard |
638:c90ae1400bf2 | 763 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 764 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied for get. |
Vincent Coubard |
638:c90ae1400bf2 | 765 | * @retval ::NRF_ERROR_NOT_SUPPORTED Returned by sd_ble_opt_set in peripheral-only SoftDevices. |
Vincent Coubard |
638:c90ae1400bf2 | 766 | * |
Vincent Coubard |
638:c90ae1400bf2 | 767 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 768 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 769 | { |
Vincent Coubard |
638:c90ae1400bf2 | 770 | uint16_t conn_handle; /**< Connection Handle (only applicable for get) */ |
Vincent Coubard |
638:c90ae1400bf2 | 771 | uint8_t ch_map[5]; /**< Channel Map (37-bit). */ |
Vincent Coubard |
638:c90ae1400bf2 | 772 | } ble_gap_opt_ch_map_t; |
Vincent Coubard |
638:c90ae1400bf2 | 773 | |
Vincent Coubard |
638:c90ae1400bf2 | 774 | |
Vincent Coubard |
638:c90ae1400bf2 | 775 | /**@brief Local connection latency option. |
Vincent Coubard |
638:c90ae1400bf2 | 776 | * |
Vincent Coubard |
638:c90ae1400bf2 | 777 | * Local connection latency is a feature which enables the slave to improve |
Vincent Coubard |
638:c90ae1400bf2 | 778 | * current consumption by ignoring the slave latency set by the peer. The |
Vincent Coubard |
638:c90ae1400bf2 | 779 | * local connection latency can only be set to a multiple of the slave latency, |
Vincent Coubard |
638:c90ae1400bf2 | 780 | * and cannot be longer than half of the supervision timeout. |
Vincent Coubard |
638:c90ae1400bf2 | 781 | * |
Vincent Coubard |
638:c90ae1400bf2 | 782 | * Used with @ref sd_ble_opt_set to set the local connection latency. The |
Vincent Coubard |
638:c90ae1400bf2 | 783 | * @ref sd_ble_opt_get is not supported for this option, but the actual |
Vincent Coubard |
638:c90ae1400bf2 | 784 | * local connection latency (unless set to NULL) is set as a return parameter |
Vincent Coubard |
638:c90ae1400bf2 | 785 | * when setting the option. |
Vincent Coubard |
638:c90ae1400bf2 | 786 | * |
Vincent Coubard |
638:c90ae1400bf2 | 787 | * @note The latency set will be truncated down to the closest slave latency event |
Vincent Coubard |
638:c90ae1400bf2 | 788 | * multiple, or the nearest multiple before half of the supervision timeout. |
Vincent Coubard |
638:c90ae1400bf2 | 789 | * |
Vincent Coubard |
638:c90ae1400bf2 | 790 | * @note The local connection latency is disabled by default, and needs to be enabled for new |
Vincent Coubard |
638:c90ae1400bf2 | 791 | * connections and whenever the connection is updated. |
Vincent Coubard |
638:c90ae1400bf2 | 792 | * |
Vincent Coubard |
638:c90ae1400bf2 | 793 | * @retval ::NRF_SUCCESS Set successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 794 | * @retval ::NRF_ERROR_NOT_SUPPORTED Get is not supported. |
Vincent Coubard |
638:c90ae1400bf2 | 795 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. |
Vincent Coubard |
638:c90ae1400bf2 | 796 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 797 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 798 | { |
Vincent Coubard |
638:c90ae1400bf2 | 799 | uint16_t conn_handle; /**< Connection Handle */ |
Vincent Coubard |
638:c90ae1400bf2 | 800 | uint16_t requested_latency; /**< Requested local connection latency. */ |
Vincent Coubard |
638:c90ae1400bf2 | 801 | uint16_t * p_actual_latency; /**< Pointer to storage for the actual local connection latency (can be set to NULL to skip return value). */ |
Vincent Coubard |
638:c90ae1400bf2 | 802 | } ble_gap_opt_local_conn_latency_t; |
Vincent Coubard |
638:c90ae1400bf2 | 803 | |
Vincent Coubard |
638:c90ae1400bf2 | 804 | |
Vincent Coubard |
638:c90ae1400bf2 | 805 | /**@brief Passkey Option. |
Vincent Coubard |
638:c90ae1400bf2 | 806 | * |
Vincent Coubard |
638:c90ae1400bf2 | 807 | * Structure containing the passkey to be used during pairing. This can be used with @ref |
Vincent Coubard |
638:c90ae1400bf2 | 808 | * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication |
Vincent Coubard |
638:c90ae1400bf2 | 809 | * instead of generating a random one. |
Vincent Coubard |
638:c90ae1400bf2 | 810 | * |
Vincent Coubard |
638:c90ae1400bf2 | 811 | * @note @ref sd_ble_opt_get is not supported for this option. |
Vincent Coubard |
638:c90ae1400bf2 | 812 | * |
Vincent Coubard |
638:c90ae1400bf2 | 813 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 814 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 815 | { |
Vincent Coubard |
638:c90ae1400bf2 | 816 | 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.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 817 | } ble_gap_opt_passkey_t; |
Vincent Coubard |
638:c90ae1400bf2 | 818 | |
Vincent Coubard |
638:c90ae1400bf2 | 819 | |
Vincent Coubard |
638:c90ae1400bf2 | 820 | /**@brief Custom Privacy Option. |
Vincent Coubard |
638:c90ae1400bf2 | 821 | * |
Vincent Coubard |
638:c90ae1400bf2 | 822 | * This structure is used with both @ref sd_ble_opt_set (as input) and with |
Vincent Coubard |
638:c90ae1400bf2 | 823 | * @ref sd_ble_opt_get (as output). |
Vincent Coubard |
638:c90ae1400bf2 | 824 | * |
Vincent Coubard |
638:c90ae1400bf2 | 825 | * Structure containing: |
Vincent Coubard |
638:c90ae1400bf2 | 826 | * - A pointer to an IRK to set (if input), or a place to store a read IRK (if output). |
Vincent Coubard |
638:c90ae1400bf2 | 827 | * - A private address refresh cycle. |
Vincent Coubard |
638:c90ae1400bf2 | 828 | * |
Vincent Coubard |
638:c90ae1400bf2 | 829 | * @note The specified address cycle interval is used when the address cycle mode is |
Vincent Coubard |
638:c90ae1400bf2 | 830 | * @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. If 0 is given, the address will not be automatically |
Vincent Coubard |
638:c90ae1400bf2 | 831 | * refreshed at all. The default interval is @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. |
Vincent Coubard |
638:c90ae1400bf2 | 832 | * |
Vincent Coubard |
638:c90ae1400bf2 | 833 | * @note If the current address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address will immediately be |
Vincent Coubard |
638:c90ae1400bf2 | 834 | * refreshed when a custom privacy option is set. A new address can be generated manually by calling |
Vincent Coubard |
638:c90ae1400bf2 | 835 | * @ref sd_ble_gap_address_set with the same type again. |
Vincent Coubard |
638:c90ae1400bf2 | 836 | * |
Vincent Coubard |
638:c90ae1400bf2 | 837 | * @note If the IRK is updated, the new IRK becomes the one to be distributed in all |
Vincent Coubard |
638:c90ae1400bf2 | 838 | * bonding procedures performed after @ref sd_ble_opt_set returns. |
Vincent Coubard |
638:c90ae1400bf2 | 839 | * |
Vincent Coubard |
638:c90ae1400bf2 | 840 | * @retval ::NRF_SUCCESS Set or read successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 841 | * @retval ::NRF_ERROR_INVALID_ADDR The pointer to IRK storage is invalid. |
Vincent Coubard |
638:c90ae1400bf2 | 842 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 843 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 844 | { |
Vincent Coubard |
638:c90ae1400bf2 | 845 | 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. */ |
Vincent Coubard |
638:c90ae1400bf2 | 846 | uint16_t interval_s; /**< When input: Custom private address cycle interval in seconds. When output: The current private address cycle interval. */ |
Vincent Coubard |
638:c90ae1400bf2 | 847 | } ble_gap_opt_privacy_t; |
Vincent Coubard |
638:c90ae1400bf2 | 848 | |
Vincent Coubard |
638:c90ae1400bf2 | 849 | |
Vincent Coubard |
638:c90ae1400bf2 | 850 | /**@brief Scan request report option. |
Vincent Coubard |
638:c90ae1400bf2 | 851 | * |
Vincent Coubard |
638:c90ae1400bf2 | 852 | * This can be used with @ref sd_ble_opt_set to make the SoftDevice send |
Vincent Coubard |
638:c90ae1400bf2 | 853 | * @ref BLE_GAP_EVT_SCAN_REQ_REPORT events. |
Vincent Coubard |
638:c90ae1400bf2 | 854 | * |
Vincent Coubard |
638:c90ae1400bf2 | 855 | * @note Due to the limited space reserved for scan request report events, |
Vincent Coubard |
638:c90ae1400bf2 | 856 | * not all received scan requests will be reported. |
Vincent Coubard |
638:c90ae1400bf2 | 857 | * |
Vincent Coubard |
638:c90ae1400bf2 | 858 | * @note If whitelisting is used, only whitelisted requests are reported. |
Vincent Coubard |
638:c90ae1400bf2 | 859 | * |
Vincent Coubard |
638:c90ae1400bf2 | 860 | * @retval ::NRF_SUCCESS Set successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 861 | * @retval ::NRF_ERROR_INVALID_STATE When advertising is ongoing while the option is set. |
Vincent Coubard |
638:c90ae1400bf2 | 862 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 863 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 864 | { |
Vincent Coubard |
638:c90ae1400bf2 | 865 | uint8_t enable : 1; /**< Enable scan request reports. */ |
Vincent Coubard |
638:c90ae1400bf2 | 866 | } ble_gap_opt_scan_req_report_t; |
Vincent Coubard |
638:c90ae1400bf2 | 867 | |
Vincent Coubard |
638:c90ae1400bf2 | 868 | /**@brief Compatibility mode option. |
Vincent Coubard |
638:c90ae1400bf2 | 869 | * |
Vincent Coubard |
638:c90ae1400bf2 | 870 | * This can be used with @ref sd_ble_opt_set to enable and disable |
Vincent Coubard |
638:c90ae1400bf2 | 871 | * compatibility modes. Compatibility modes are disabled by default. |
Vincent Coubard |
638:c90ae1400bf2 | 872 | * |
Vincent Coubard |
638:c90ae1400bf2 | 873 | * @note Compatibility mode 1 enables interoperability with devices that do not support |
Vincent Coubard |
638:c90ae1400bf2 | 874 | * a value of 0 for the WinOffset parameter in the Link Layer CONNECT_REQ packet. |
Vincent Coubard |
638:c90ae1400bf2 | 875 | * |
Vincent Coubard |
638:c90ae1400bf2 | 876 | * @retval ::NRF_SUCCESS Set successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 877 | * @retval ::NRF_ERROR_INVALID_STATE When connection creation is ongoing while mode 1 is set. |
Vincent Coubard |
638:c90ae1400bf2 | 878 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 879 | typedef struct |
Vincent Coubard |
638:c90ae1400bf2 | 880 | { |
Vincent Coubard |
638:c90ae1400bf2 | 881 | uint8_t mode_1_enable : 1; /**< Enable compatibility mode 1.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 882 | } ble_gap_opt_compat_mode_t; |
Vincent Coubard |
638:c90ae1400bf2 | 883 | |
Vincent Coubard |
638:c90ae1400bf2 | 884 | |
Vincent Coubard |
638:c90ae1400bf2 | 885 | /**@brief Option structure for GAP options. */ |
Vincent Coubard |
638:c90ae1400bf2 | 886 | typedef union |
Vincent Coubard |
638:c90ae1400bf2 | 887 | { |
Vincent Coubard |
638:c90ae1400bf2 | 888 | ble_gap_opt_ch_map_t ch_map; /**< Parameters for the Channel Map option. */ |
Vincent Coubard |
638:c90ae1400bf2 | 889 | ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Parameters for the Local connection latency option */ |
Vincent Coubard |
638:c90ae1400bf2 | 890 | ble_gap_opt_passkey_t passkey; /**< Parameters for the Passkey option.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 891 | ble_gap_opt_privacy_t privacy; /**< Parameters for the Custom privacy option. */ |
Vincent Coubard |
638:c90ae1400bf2 | 892 | ble_gap_opt_scan_req_report_t scan_req_report; /**< Parameters for the scan request report option.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 893 | ble_gap_opt_compat_mode_t compat_mode; /**< Parameters for the compatibility mode option.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 894 | } ble_gap_opt_t; |
Vincent Coubard |
638:c90ae1400bf2 | 895 | /**@} */ |
Vincent Coubard |
638:c90ae1400bf2 | 896 | |
Vincent Coubard |
638:c90ae1400bf2 | 897 | |
Vincent Coubard |
638:c90ae1400bf2 | 898 | /**@addtogroup BLE_GAP_FUNCTIONS Functions |
Vincent Coubard |
638:c90ae1400bf2 | 899 | * @{ */ |
Vincent Coubard |
638:c90ae1400bf2 | 900 | |
Vincent Coubard |
638:c90ae1400bf2 | 901 | /**@brief Set local Bluetooth address. |
Vincent Coubard |
638:c90ae1400bf2 | 902 | * |
Vincent Coubard |
638:c90ae1400bf2 | 903 | * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to |
Vincent Coubard |
638:c90ae1400bf2 | 904 | * be @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or |
Vincent Coubard |
638:c90ae1400bf2 | 905 | * @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the |
Vincent Coubard |
638:c90ae1400bf2 | 906 | * SoftDevice will generate a new private address automatically every |
Vincent Coubard |
638:c90ae1400bf2 | 907 | * @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds. If this API |
Vincent Coubard |
638:c90ae1400bf2 | 908 | * call is used again with the same parameters, the SoftDevice will immediately |
Vincent Coubard |
638:c90ae1400bf2 | 909 | * generate a new private address to replace the current address. |
Vincent Coubard |
638:c90ae1400bf2 | 910 | * |
Vincent Coubard |
638:c90ae1400bf2 | 911 | * @note If the application wishes to use a @ref BLE_GAP_ADDR_TYPE_PUBLIC or |
Vincent Coubard |
638:c90ae1400bf2 | 912 | * @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be |
Vincent Coubard |
638:c90ae1400bf2 | 913 | * @ref BLE_GAP_ADDR_CYCLE_MODE_NONE. |
Vincent Coubard |
638:c90ae1400bf2 | 914 | * |
Vincent Coubard |
638:c90ae1400bf2 | 915 | * @note If this API function is called while advertising or scanning, the softdevice will immediately update the |
Vincent Coubard |
638:c90ae1400bf2 | 916 | * advertising or scanning address without the need to stop the procedure in the following cases: |
Vincent Coubard |
638:c90ae1400bf2 | 917 | * - If the previously set address is of type @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address |
Vincent Coubard |
638:c90ae1400bf2 | 918 | * is also of type @ref BLE_GAP_ADDR_TYPE_PUBLIC |
Vincent Coubard |
638:c90ae1400bf2 | 919 | * - If the previously set address is not @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address is |
Vincent Coubard |
638:c90ae1400bf2 | 920 | * also not @ref BLE_GAP_ADDR_TYPE_PUBLIC. |
Vincent Coubard |
638:c90ae1400bf2 | 921 | * If the address is changed from a @ref BLE_GAP_ADDR_TYPE_PUBLIC address to another type or from |
Vincent Coubard |
638:c90ae1400bf2 | 922 | * another type to a @ref BLE_GAP_ADDR_TYPE_PUBLIC address, the change will take effect the next |
Vincent Coubard |
638:c90ae1400bf2 | 923 | * time an advertising or scanning procedure is started. |
Vincent Coubard |
638:c90ae1400bf2 | 924 | * |
Vincent Coubard |
638:c90ae1400bf2 | 925 | * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_NONE and the application is |
Vincent Coubard |
638:c90ae1400bf2 | 926 | * using privacy, the application must take care to generate and set new private addresses |
Vincent Coubard |
638:c90ae1400bf2 | 927 | * periodically to comply with the Privacy specification in Bluetooth Core Spec. |
Vincent Coubard |
638:c90ae1400bf2 | 928 | * |
Vincent Coubard |
638:c90ae1400bf2 | 929 | * @param[in] addr_cycle_mode Address cycle mode, see @ref BLE_GAP_ADDR_CYCLE_MODES. |
Vincent Coubard |
638:c90ae1400bf2 | 930 | * @param[in] p_addr Pointer to address structure. |
Vincent Coubard |
638:c90ae1400bf2 | 931 | * |
Vincent Coubard |
638:c90ae1400bf2 | 932 | * @retval ::NRF_SUCCESS Address successfully set. |
Vincent Coubard |
638:c90ae1400bf2 | 933 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 934 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 935 | * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address. |
Vincent Coubard |
638:c90ae1400bf2 | 936 | * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. |
Vincent Coubard |
638:c90ae1400bf2 | 937 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 938 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 939 | SVCALL(SD_BLE_GAP_ADDRESS_SET, uint32_t, sd_ble_gap_address_set(uint8_t addr_cycle_mode, const ble_gap_addr_t *p_addr)); |
Vincent Coubard |
638:c90ae1400bf2 | 940 | |
Vincent Coubard |
638:c90ae1400bf2 | 941 | |
Vincent Coubard |
638:c90ae1400bf2 | 942 | /**@brief Get local Bluetooth address. |
Vincent Coubard |
638:c90ae1400bf2 | 943 | * |
Vincent Coubard |
638:c90ae1400bf2 | 944 | * @param[out] p_addr Pointer to address structure to be filled in. |
Vincent Coubard |
638:c90ae1400bf2 | 945 | * |
Vincent Coubard |
638:c90ae1400bf2 | 946 | * @retval ::NRF_SUCCESS Address successfully retrieved. |
Vincent Coubard |
638:c90ae1400bf2 | 947 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 948 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 949 | SVCALL(SD_BLE_GAP_ADDRESS_GET, uint32_t, sd_ble_gap_address_get(ble_gap_addr_t *p_addr)); |
Vincent Coubard |
638:c90ae1400bf2 | 950 | |
Vincent Coubard |
638:c90ae1400bf2 | 951 | |
Vincent Coubard |
638:c90ae1400bf2 | 952 | /**@brief Set, clear or update advertising and scan response data. |
Vincent Coubard |
638:c90ae1400bf2 | 953 | * |
Vincent Coubard |
638:c90ae1400bf2 | 954 | * @note The format of the advertising data will be checked by this call to ensure interoperability. |
Vincent Coubard |
638:c90ae1400bf2 | 955 | * Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and |
Vincent Coubard |
638:c90ae1400bf2 | 956 | * duplicating the local name in the advertising data and scan response data. |
Vincent Coubard |
638:c90ae1400bf2 | 957 | * |
Vincent Coubard |
638:c90ae1400bf2 | 958 | * @note To clear the advertising data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding |
Vincent Coubard |
638:c90ae1400bf2 | 959 | * length (dlen/srdlen) set to 0. |
Vincent Coubard |
638:c90ae1400bf2 | 960 | * |
Vincent Coubard |
638:c90ae1400bf2 | 961 | * @note The call will fail if p_data and p_sr_data are both NULL since this would have no effect. |
Vincent Coubard |
638:c90ae1400bf2 | 962 | * |
Vincent Coubard |
638:c90ae1400bf2 | 963 | * @param[in] p_data Raw data to be placed in advertising packet. If NULL, no changes are made to the current advertising packet data. |
Vincent Coubard |
638:c90ae1400bf2 | 964 | * @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. |
Vincent Coubard |
638:c90ae1400bf2 | 965 | * @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. |
Vincent Coubard |
638:c90ae1400bf2 | 966 | * @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. |
Vincent Coubard |
638:c90ae1400bf2 | 967 | * |
Vincent Coubard |
638:c90ae1400bf2 | 968 | * @retval ::NRF_SUCCESS Advertising data successfully updated or cleared. |
Vincent Coubard |
638:c90ae1400bf2 | 969 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 970 | * @retval ::NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 971 | * @retval ::NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification. |
Vincent Coubard |
638:c90ae1400bf2 | 972 | * @retval ::NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 973 | * @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported data type. |
Vincent Coubard |
638:c90ae1400bf2 | 974 | * @retval ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 975 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 976 | SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen)); |
Vincent Coubard |
638:c90ae1400bf2 | 977 | |
Vincent Coubard |
638:c90ae1400bf2 | 978 | |
Vincent Coubard |
638:c90ae1400bf2 | 979 | /**@brief Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). |
Vincent Coubard |
638:c90ae1400bf2 | 980 | * |
Vincent Coubard |
638:c90ae1400bf2 | 981 | * @note An application can start an advertising procedure for broadcasting purposes while a connection |
Vincent Coubard |
638:c90ae1400bf2 | 982 | * is active. After a @ref BLE_GAP_EVT_CONNECTED event is received, this function may therefore |
Vincent Coubard |
638:c90ae1400bf2 | 983 | * be called to start a broadcast advertising procedure. The advertising procedure |
Vincent Coubard |
638:c90ae1400bf2 | 984 | * cannot however be connectable (it must be of type @ref BLE_GAP_ADV_TYPE_ADV_SCAN_IND or |
Vincent Coubard |
638:c90ae1400bf2 | 985 | * @ref BLE_GAP_ADV_TYPE_ADV_NONCONN_IND). @note Only one advertiser may be active at any time. |
Vincent Coubard |
638:c90ae1400bf2 | 986 | * |
Vincent Coubard |
638:c90ae1400bf2 | 987 | * @note To use the currently active whitelist set p_adv_params->p_whitelist to NULL. |
Vincent Coubard |
638:c90ae1400bf2 | 988 | * |
Vincent Coubard |
638:c90ae1400bf2 | 989 | * @param[in] p_adv_params Pointer to advertising parameters structure. |
Vincent Coubard |
638:c90ae1400bf2 | 990 | * |
Vincent Coubard |
638:c90ae1400bf2 | 991 | * @retval ::NRF_SUCCESS The BLE stack has started advertising. |
Vincent Coubard |
638:c90ae1400bf2 | 992 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 993 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 994 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits. |
Vincent Coubard |
638:c90ae1400bf2 | 995 | * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 996 | * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible. |
Vincent Coubard |
638:c90ae1400bf2 | 997 | * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. |
Vincent Coubard |
638:c90ae1400bf2 | 998 | * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. |
Vincent Coubard |
638:c90ae1400bf2 | 999 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1000 | SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1001 | |
Vincent Coubard |
638:c90ae1400bf2 | 1002 | |
Vincent Coubard |
638:c90ae1400bf2 | 1003 | /**@brief Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). |
Vincent Coubard |
638:c90ae1400bf2 | 1004 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1005 | * @retval ::NRF_SUCCESS The BLE stack has stopped advertising. |
Vincent Coubard |
638:c90ae1400bf2 | 1006 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state). |
Vincent Coubard |
638:c90ae1400bf2 | 1007 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1008 | SVCALL(SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void)); |
Vincent Coubard |
638:c90ae1400bf2 | 1009 | |
Vincent Coubard |
638:c90ae1400bf2 | 1010 | |
Vincent Coubard |
638:c90ae1400bf2 | 1011 | /**@brief Update connection parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1012 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1013 | * @details In the central role this will initiate a Link Layer connection parameter update procedure, |
Vincent Coubard |
638:c90ae1400bf2 | 1014 | * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for |
Vincent Coubard |
638:c90ae1400bf2 | 1015 | * the central to perform the procedure. In both cases, and regardless of success or failure, the application |
Vincent Coubard |
638:c90ae1400bf2 | 1016 | * will be informed of the result with a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE event. |
Vincent Coubard |
638:c90ae1400bf2 | 1017 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1018 | * @details This function can be used as a central both to reply to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested. |
Vincent Coubard |
638:c90ae1400bf2 | 1019 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1020 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1021 | * @param[in] p_conn_params Pointer to desired connection parameters. If NULL is provided on a peripheral role, |
Vincent Coubard |
638:c90ae1400bf2 | 1022 | * the parameters in the PPCP characteristic of the GAP service will be used instead. |
Vincent Coubard |
638:c90ae1400bf2 | 1023 | * If NULL is provided on a central role and in response to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, the peripheral request will be rejected |
Vincent Coubard |
638:c90ae1400bf2 | 1024 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1025 | * @retval ::NRF_SUCCESS The Connection Update procedure has been started successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1026 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1027 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. |
Vincent Coubard |
638:c90ae1400bf2 | 1028 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1029 | * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and wait for pending procedures to complete and retry. |
Vincent Coubard |
638:c90ae1400bf2 | 1030 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1031 | * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1032 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1033 | SVCALL(SD_BLE_GAP_CONN_PARAM_UPDATE, uint32_t, sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const *p_conn_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1034 | |
Vincent Coubard |
638:c90ae1400bf2 | 1035 | |
Vincent Coubard |
638:c90ae1400bf2 | 1036 | /**@brief Disconnect (GAP Link Termination). |
Vincent Coubard |
638:c90ae1400bf2 | 1037 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1038 | * @details This call initiates the disconnection procedure, and its completion will be communicated to the application |
Vincent Coubard |
638:c90ae1400bf2 | 1039 | * with a @ref BLE_GAP_EVT_DISCONNECTED event. |
Vincent Coubard |
638:c90ae1400bf2 | 1040 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1041 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1042 | * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are @ref BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and @ref BLE_HCI_CONN_INTERVAL_UNACCEPTABLE). |
Vincent Coubard |
638:c90ae1400bf2 | 1043 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1044 | * @retval ::NRF_SUCCESS The disconnection procedure has been started successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1045 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1046 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1047 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress). |
Vincent Coubard |
638:c90ae1400bf2 | 1048 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1049 | SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)); |
Vincent Coubard |
638:c90ae1400bf2 | 1050 | |
Vincent Coubard |
638:c90ae1400bf2 | 1051 | |
Vincent Coubard |
638:c90ae1400bf2 | 1052 | /**@brief Set the radio's transmit power. |
Vincent Coubard |
638:c90ae1400bf2 | 1053 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1054 | * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm). |
Vincent Coubard |
638:c90ae1400bf2 | 1055 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1056 | * @note -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm. |
Vincent Coubard |
638:c90ae1400bf2 | 1057 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1058 | * @retval ::NRF_SUCCESS Successfully changed the transmit power. |
Vincent Coubard |
638:c90ae1400bf2 | 1059 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1060 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1061 | SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power)); |
Vincent Coubard |
638:c90ae1400bf2 | 1062 | |
Vincent Coubard |
638:c90ae1400bf2 | 1063 | |
Vincent Coubard |
638:c90ae1400bf2 | 1064 | /**@brief Set GAP Appearance value. |
Vincent Coubard |
638:c90ae1400bf2 | 1065 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1066 | * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. |
Vincent Coubard |
638:c90ae1400bf2 | 1067 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1068 | * @retval ::NRF_SUCCESS Appearance value set successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1069 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1070 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1071 | SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance)); |
Vincent Coubard |
638:c90ae1400bf2 | 1072 | |
Vincent Coubard |
638:c90ae1400bf2 | 1073 | |
Vincent Coubard |
638:c90ae1400bf2 | 1074 | /**@brief Get GAP Appearance value. |
Vincent Coubard |
638:c90ae1400bf2 | 1075 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1076 | * @param[out] p_appearance Pointer to appearance (16-bit) to be filled in, see @ref BLE_APPEARANCES. |
Vincent Coubard |
638:c90ae1400bf2 | 1077 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1078 | * @retval ::NRF_SUCCESS Appearance value retrieved successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1079 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1080 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1081 | SVCALL(SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t *p_appearance)); |
Vincent Coubard |
638:c90ae1400bf2 | 1082 | |
Vincent Coubard |
638:c90ae1400bf2 | 1083 | |
Vincent Coubard |
638:c90ae1400bf2 | 1084 | /**@brief Set GAP Peripheral Preferred Connection Parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1085 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1086 | * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the desired parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1087 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1088 | * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1089 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1090 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1091 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1092 | SVCALL(SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const *p_conn_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1093 | |
Vincent Coubard |
638:c90ae1400bf2 | 1094 | |
Vincent Coubard |
638:c90ae1400bf2 | 1095 | /**@brief Get GAP Peripheral Preferred Connection Parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1096 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1097 | * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters will be stored. |
Vincent Coubard |
638:c90ae1400bf2 | 1098 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1099 | * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1100 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1101 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1102 | SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t *p_conn_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1103 | |
Vincent Coubard |
638:c90ae1400bf2 | 1104 | |
Vincent Coubard |
638:c90ae1400bf2 | 1105 | /**@brief Set GAP device name. |
Vincent Coubard |
638:c90ae1400bf2 | 1106 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1107 | * @param[in] p_write_perm Write permissions for the Device Name characteristic, see @ref ble_gap_conn_sec_mode_t. |
Vincent Coubard |
638:c90ae1400bf2 | 1108 | * @param[in] p_dev_name Pointer to a UTF-8 encoded, <b>non NULL-terminated</b> string. |
Vincent Coubard |
638:c90ae1400bf2 | 1109 | * @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). |
Vincent Coubard |
638:c90ae1400bf2 | 1110 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1111 | * @retval ::NRF_SUCCESS GAP device name and permissions set successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1112 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1113 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1114 | * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1115 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1116 | SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)); |
Vincent Coubard |
638:c90ae1400bf2 | 1117 | |
Vincent Coubard |
638:c90ae1400bf2 | 1118 | |
Vincent Coubard |
638:c90ae1400bf2 | 1119 | /**@brief Get GAP device name. |
Vincent Coubard |
638:c90ae1400bf2 | 1120 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1121 | * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 <b>non NULL-terminated</b> string will be placed. Set to NULL to obtain the complete device name length. |
Vincent Coubard |
638:c90ae1400bf2 | 1122 | * @param[in,out] p_len Length of the buffer pointed by p_dev_name, complete device name length on output. |
Vincent Coubard |
638:c90ae1400bf2 | 1123 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1124 | * @note If the device name is longer than the size of the supplied buffer, |
Vincent Coubard |
638:c90ae1400bf2 | 1125 | * p_len will return the complete device name length, |
Vincent Coubard |
638:c90ae1400bf2 | 1126 | * and not the number of bytes actually returned in p_dev_name. |
Vincent Coubard |
638:c90ae1400bf2 | 1127 | * The application may use this information to allocate a suitable buffer size. |
Vincent Coubard |
638:c90ae1400bf2 | 1128 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1129 | * @retval ::NRF_SUCCESS GAP device name retrieved successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 1130 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1131 | * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1132 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1133 | SVCALL(SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len)); |
Vincent Coubard |
638:c90ae1400bf2 | 1134 | |
Vincent Coubard |
638:c90ae1400bf2 | 1135 | |
Vincent Coubard |
638:c90ae1400bf2 | 1136 | /**@brief Initiate the GAP Authentication procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1137 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1138 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1139 | * @param[in] p_sec_params Pointer to the @ref ble_gap_sec_params_t structure with the security parameters to be used during the pairing or bonding procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1140 | * In the peripheral role, only the timeout, bond and mitm fields of this structure are used. |
Vincent Coubard |
638:c90ae1400bf2 | 1141 | * In the central role, this pointer may be NULL to reject a Security Request. |
Vincent Coubard |
638:c90ae1400bf2 | 1142 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1143 | * @details In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected), |
Vincent Coubard |
638:c90ae1400bf2 | 1144 | * otherwise in the peripheral role, an SMP Security Request will be sent. |
Vincent Coubard |
638:c90ae1400bf2 | 1145 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1146 | * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, |
Vincent Coubard |
638:c90ae1400bf2 | 1147 | * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_CONN_SEC_UPDATE, @ref BLE_GAP_EVT_AUTH_STATUS. |
Vincent Coubard |
638:c90ae1400bf2 | 1148 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1149 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1150 | * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1151 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1152 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1153 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1154 | * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. |
Vincent Coubard |
638:c90ae1400bf2 | 1155 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1156 | * @retval ::NRF_ERROR_TIMEOUT A SMP timout has occured, and further SMP operations on this link is prohibited. |
Vincent Coubard |
638:c90ae1400bf2 | 1157 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1158 | SVCALL(SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1159 | |
Vincent Coubard |
638:c90ae1400bf2 | 1160 | |
Vincent Coubard |
638:c90ae1400bf2 | 1161 | /**@brief Reply with GAP security parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1162 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1163 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1164 | * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. |
Vincent Coubard |
638:c90ae1400bf2 | 1165 | * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters structure. In the central role this must be set to NULL, as the parameters have |
Vincent Coubard |
638:c90ae1400bf2 | 1166 | * already been provided during a previous call to @ref sd_ble_gap_authenticate. |
Vincent Coubard |
638:c90ae1400bf2 | 1167 | * @param[in,out] p_sec_keyset Pointer to a @ref ble_gap_sec_keyset_t security keyset structure. Any keys distributed as a result of the ongoing security procedure |
Vincent Coubard |
638:c90ae1400bf2 | 1168 | * will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application |
Vincent Coubard |
638:c90ae1400bf2 | 1169 | * upon reception of a @ref BLE_GAP_EVT_AUTH_STATUS event. |
Vincent Coubard |
638:c90ae1400bf2 | 1170 | * The pointer to the ID key data distributed by the <b>local device</b> constitutes however an exception. It can either point to ID key data |
Vincent Coubard |
638:c90ae1400bf2 | 1171 | * filled in by the user before calling this function, in which case a user-supplied Bluetooth address and IRK will be distributed, |
Vincent Coubard |
638:c90ae1400bf2 | 1172 | * or the pointer to the ID key data structure can be NULL, in which case the device's configured (or default, if none is configured) |
Vincent Coubard |
638:c90ae1400bf2 | 1173 | * Bluetooth address and IRK will be distributed. |
Vincent Coubard |
638:c90ae1400bf2 | 1174 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1175 | * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. |
Vincent Coubard |
638:c90ae1400bf2 | 1176 | * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1177 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1178 | * @retval ::NRF_SUCCESS Successfully accepted security parameter from the application. |
Vincent Coubard |
638:c90ae1400bf2 | 1179 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1180 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1181 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1182 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1183 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1184 | SVCALL(SD_BLE_GAP_SEC_PARAMS_REPLY, uint32_t, sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset)); |
Vincent Coubard |
638:c90ae1400bf2 | 1185 | |
Vincent Coubard |
638:c90ae1400bf2 | 1186 | |
Vincent Coubard |
638:c90ae1400bf2 | 1187 | /**@brief Reply with an authentication key. |
Vincent Coubard |
638:c90ae1400bf2 | 1188 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1189 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1190 | * @param[in] key_type See @ref BLE_GAP_AUTH_KEY_TYPES. |
Vincent Coubard |
638:c90ae1400bf2 | 1191 | * @param[in] p_key If key type is @ref BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL. |
Vincent Coubard |
638:c90ae1400bf2 | 1192 | * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination). |
Vincent Coubard |
638:c90ae1400bf2 | 1193 | * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. |
Vincent Coubard |
638:c90ae1400bf2 | 1194 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1195 | * @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 @ref NRF_ERROR_INVALID_STATE. |
Vincent Coubard |
638:c90ae1400bf2 | 1196 | * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1197 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1198 | * @retval ::NRF_SUCCESS Authentication key successfully set. |
Vincent Coubard |
638:c90ae1400bf2 | 1199 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1200 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1201 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1202 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1203 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1204 | SVCALL(SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key)); |
Vincent Coubard |
638:c90ae1400bf2 | 1205 | |
Vincent Coubard |
638:c90ae1400bf2 | 1206 | |
Vincent Coubard |
638:c90ae1400bf2 | 1207 | /**@brief Initiate GAP Encryption procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1208 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1209 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1210 | * @param[in] p_master_id Pointer to a @ref ble_gap_master_id_t master identification structure. |
Vincent Coubard |
638:c90ae1400bf2 | 1211 | * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. |
Vincent Coubard |
638:c90ae1400bf2 | 1212 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1213 | * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. |
Vincent Coubard |
638:c90ae1400bf2 | 1214 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1215 | * @note Calling this function may result in the following event depending on the outcome and parameters: @ref BLE_GAP_EVT_CONN_SEC_UPDATE. |
Vincent Coubard |
638:c90ae1400bf2 | 1216 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1217 | * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1218 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1219 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1220 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1221 | * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. |
Vincent Coubard |
638:c90ae1400bf2 | 1222 | * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, wait for pending procedures to complete and retry. |
Vincent Coubard |
638:c90ae1400bf2 | 1223 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1224 | SVCALL(SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info)); |
Vincent Coubard |
638:c90ae1400bf2 | 1225 | |
Vincent Coubard |
638:c90ae1400bf2 | 1226 | |
Vincent Coubard |
638:c90ae1400bf2 | 1227 | /**@brief Reply with GAP security information. |
Vincent Coubard |
638:c90ae1400bf2 | 1228 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1229 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1230 | * @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. |
Vincent Coubard |
638:c90ae1400bf2 | 1231 | * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t identity information structure. May be NULL to signal none is available. |
Vincent Coubard |
638:c90ae1400bf2 | 1232 | * @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. |
Vincent Coubard |
638:c90ae1400bf2 | 1233 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1234 | * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in @ref NRF_ERROR_INVALID_STATE. |
Vincent Coubard |
638:c90ae1400bf2 | 1235 | * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1236 | * @note Data signing is not yet supported, and p_sign_info must therefore be NULL. |
Vincent Coubard |
638:c90ae1400bf2 | 1237 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1238 | * @retval ::NRF_SUCCESS Successfully accepted security information. |
Vincent Coubard |
638:c90ae1400bf2 | 1239 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1240 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1241 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1242 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1243 | SVCALL(SD_BLE_GAP_SEC_INFO_REPLY, uint32_t, sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t const *p_sign_info)); |
Vincent Coubard |
638:c90ae1400bf2 | 1244 | |
Vincent Coubard |
638:c90ae1400bf2 | 1245 | |
Vincent Coubard |
638:c90ae1400bf2 | 1246 | /**@brief Get the current connection security. |
Vincent Coubard |
638:c90ae1400bf2 | 1247 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1248 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1249 | * @param[out] p_conn_sec Pointer to a @ref ble_gap_conn_sec_t structure to be filled in. |
Vincent Coubard |
638:c90ae1400bf2 | 1250 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1251 | * @retval ::NRF_SUCCESS Current connection security successfully retrieved. |
Vincent Coubard |
638:c90ae1400bf2 | 1252 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1253 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1254 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1255 | SVCALL(SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *p_conn_sec)); |
Vincent Coubard |
638:c90ae1400bf2 | 1256 | |
Vincent Coubard |
638:c90ae1400bf2 | 1257 | |
Vincent Coubard |
638:c90ae1400bf2 | 1258 | /**@brief Start reporting the received signal strength to the application. |
Vincent Coubard |
638:c90ae1400bf2 | 1259 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1260 | * A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called. |
Vincent Coubard |
638:c90ae1400bf2 | 1261 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1262 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1263 | * @param[in] threshold_dbm Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID. |
Vincent Coubard |
638:c90ae1400bf2 | 1264 | * @param[in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new @ref BLE_GAP_EVT_RSSI_CHANGED event. |
Vincent Coubard |
638:c90ae1400bf2 | 1265 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1266 | * @retval ::NRF_SUCCESS Successfully activated RSSI reporting. |
Vincent Coubard |
638:c90ae1400bf2 | 1267 | * @retval ::NRF_ERROR_INVALID_STATE Disconnection in progress. Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1268 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1269 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1270 | SVCALL(SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)); |
Vincent Coubard |
638:c90ae1400bf2 | 1271 | |
Vincent Coubard |
638:c90ae1400bf2 | 1272 | |
Vincent Coubard |
638:c90ae1400bf2 | 1273 | /**@brief Stop reporting the received signal strength. |
Vincent Coubard |
638:c90ae1400bf2 | 1274 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1275 | * @note An RSSI change detected before the call but not yet received by the application |
Vincent Coubard |
638:c90ae1400bf2 | 1276 | * may be reported after @ref sd_ble_gap_rssi_stop has been called. |
Vincent Coubard |
638:c90ae1400bf2 | 1277 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1278 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1279 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1280 | * @retval ::NRF_SUCCESS Successfully deactivated RSSI reporting. |
Vincent Coubard |
638:c90ae1400bf2 | 1281 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1282 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1283 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1284 | SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle)); |
Vincent Coubard |
638:c90ae1400bf2 | 1285 | |
Vincent Coubard |
638:c90ae1400bf2 | 1286 | |
Vincent Coubard |
638:c90ae1400bf2 | 1287 | /**@brief Get the received signal strength for the last connection event. |
Vincent Coubard |
638:c90ae1400bf2 | 1288 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1289 | * @param[in] conn_handle Connection handle. |
Vincent Coubard |
638:c90ae1400bf2 | 1290 | * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. |
Vincent Coubard |
638:c90ae1400bf2 | 1291 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1292 | * @ref sd_ble_gap_rssi_start must be called to start reporting RSSI before using this function. @ref NRF_ERROR_NOT_FOUND |
Vincent Coubard |
638:c90ae1400bf2 | 1293 | * will be returned until RSSI was sampled for the first time after calling @ref sd_ble_gap_rssi_start. |
Vincent Coubard |
638:c90ae1400bf2 | 1294 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1295 | * @retval ::NRF_SUCCESS Successfully read the RSSI. |
Vincent Coubard |
638:c90ae1400bf2 | 1296 | * @retval ::NRF_ERROR_NOT_FOUND No sample is available. |
Vincent Coubard |
638:c90ae1400bf2 | 1297 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1298 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1299 | * @retval ::NRF_ERROR_INVALID_STATE RSSI reporting is not ongoing, or disconnection in progress. |
Vincent Coubard |
638:c90ae1400bf2 | 1300 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1301 | SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi)); |
Vincent Coubard |
638:c90ae1400bf2 | 1302 | |
Vincent Coubard |
638:c90ae1400bf2 | 1303 | |
Vincent Coubard |
638:c90ae1400bf2 | 1304 | /**@brief Start scanning (GAP Discovery procedure, Observer Procedure). |
Vincent Coubard |
638:c90ae1400bf2 | 1305 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1306 | * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL. |
Vincent Coubard |
638:c90ae1400bf2 | 1307 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1308 | * @param[in] p_scan_params Pointer to scan parameters structure. |
Vincent Coubard |
638:c90ae1400bf2 | 1309 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1310 | * @retval ::NRF_SUCCESS Successfully initiated scanning procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1311 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1312 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1313 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1314 | * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. |
Vincent Coubard |
638:c90ae1400bf2 | 1315 | * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. |
Vincent Coubard |
638:c90ae1400bf2 | 1316 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1317 | SVCALL(SD_BLE_GAP_SCAN_START, uint32_t, sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1318 | |
Vincent Coubard |
638:c90ae1400bf2 | 1319 | |
Vincent Coubard |
638:c90ae1400bf2 | 1320 | /**@brief Stop scanning (GAP Discovery procedure, Observer Procedure). |
Vincent Coubard |
638:c90ae1400bf2 | 1321 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1322 | * @retval ::NRF_SUCCESS Successfully stopped scanning procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1323 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state). |
Vincent Coubard |
638:c90ae1400bf2 | 1324 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1325 | SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)); |
Vincent Coubard |
638:c90ae1400bf2 | 1326 | |
Vincent Coubard |
638:c90ae1400bf2 | 1327 | |
Vincent Coubard |
638:c90ae1400bf2 | 1328 | /**@brief Create a connection (GAP Link Establishment). |
Vincent Coubard |
638:c90ae1400bf2 | 1329 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1330 | * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL. |
Vincent Coubard |
638:c90ae1400bf2 | 1331 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1332 | * @param[in] p_peer_addr Pointer to peer address. If the selective bit is set in @ref ble_gap_scan_params_t, then this must be NULL. |
Vincent Coubard |
638:c90ae1400bf2 | 1333 | * @param[in] p_scan_params Pointer to scan parameters structure. |
Vincent Coubard |
638:c90ae1400bf2 | 1334 | * @param[in] p_conn_params Pointer to desired connection parameters. |
Vincent Coubard |
638:c90ae1400bf2 | 1335 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1336 | * @retval ::NRF_SUCCESS Successfully initiated connection procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1337 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1338 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
Vincent Coubard |
638:c90ae1400bf2 | 1339 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1340 | * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. |
Vincent Coubard |
638:c90ae1400bf2 | 1341 | * @retval ::NRF_ERROR_NO_MEM limit of available connections reached. |
Vincent Coubard |
638:c90ae1400bf2 | 1342 | * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established wait for the corresponding |
Vincent Coubard |
638:c90ae1400bf2 | 1343 | * @ref BLE_GAP_EVT_CONNECTED event before calling again. |
Vincent Coubard |
638:c90ae1400bf2 | 1344 | * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. |
Vincent Coubard |
638:c90ae1400bf2 | 1345 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1346 | SVCALL(SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params)); |
Vincent Coubard |
638:c90ae1400bf2 | 1347 | |
Vincent Coubard |
638:c90ae1400bf2 | 1348 | |
Vincent Coubard |
638:c90ae1400bf2 | 1349 | /**@brief Cancel a connection establishment. |
Vincent Coubard |
638:c90ae1400bf2 | 1350 | * |
Vincent Coubard |
638:c90ae1400bf2 | 1351 | * @retval ::NRF_SUCCESS Successfully cancelled an ongoing connection procedure. |
Vincent Coubard |
638:c90ae1400bf2 | 1352 | * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. |
Vincent Coubard |
638:c90ae1400bf2 | 1353 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 1354 | SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)); |
Vincent Coubard |
638:c90ae1400bf2 | 1355 | |
Vincent Coubard |
638:c90ae1400bf2 | 1356 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 1357 | |
Vincent Coubard |
638:c90ae1400bf2 | 1358 | #endif // BLE_GAP_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 1359 | |
Vincent Coubard |
638:c90ae1400bf2 | 1360 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 1361 | @} |
Vincent Coubard |
638:c90ae1400bf2 | 1362 | */ |