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