ver:init

Committer:
iv123
Date:
Sun Jun 18 16:11:03 2017 +0000
Revision:
0:4946262d6030
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iv123 0:4946262d6030 1 /******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
iv123 0:4946262d6030 2 * File Name : bluenrg_gap_aci.h
iv123 0:4946262d6030 3 * Author : AMS - AAS
iv123 0:4946262d6030 4 * Version : V1.0.0
iv123 0:4946262d6030 5 * Date : 26-Jun-2014
iv123 0:4946262d6030 6 * Description : Header file with GAP commands for BlueNRG FW6.3.
iv123 0:4946262d6030 7 ********************************************************************************
iv123 0:4946262d6030 8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
iv123 0:4946262d6030 9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
iv123 0:4946262d6030 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
iv123 0:4946262d6030 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
iv123 0:4946262d6030 12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
iv123 0:4946262d6030 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
iv123 0:4946262d6030 14 *******************************************************************************/
iv123 0:4946262d6030 15
iv123 0:4946262d6030 16 #ifndef __BLUENRG_GAP_ACI_H__
iv123 0:4946262d6030 17 #define __BLUENRG_GAP_ACI_H__
iv123 0:4946262d6030 18
iv123 0:4946262d6030 19 /**
iv123 0:4946262d6030 20 *@addtogroup GAP GAP
iv123 0:4946262d6030 21 *@brief GAP layer.
iv123 0:4946262d6030 22 *@{
iv123 0:4946262d6030 23 */
iv123 0:4946262d6030 24
iv123 0:4946262d6030 25 /**
iv123 0:4946262d6030 26 *@defgroup GAP_Functions GAP functions
iv123 0:4946262d6030 27 *@brief API for GAP layer.
iv123 0:4946262d6030 28 *@{
iv123 0:4946262d6030 29 */
iv123 0:4946262d6030 30
iv123 0:4946262d6030 31 /**
iv123 0:4946262d6030 32 * @brief Initialize the GAP layer.
iv123 0:4946262d6030 33 * @note Register the GAP service with the GATT.
iv123 0:4946262d6030 34 * All the standard GAP characteristics will also be added:
iv123 0:4946262d6030 35 * @li Device Name
iv123 0:4946262d6030 36 * @li Appearance
iv123 0:4946262d6030 37 * @li Peripheral Preferred Connection Parameters (peripheral role only)
iv123 0:4946262d6030 38 * @code
iv123 0:4946262d6030 39
iv123 0:4946262d6030 40 tBleStatus ret;
iv123 0:4946262d6030 41 uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
iv123 0:4946262d6030 42
iv123 0:4946262d6030 43 ret = aci_gap_init_IDB05A1(1, 0, 0x07, &service_handle, &dev_name_char_handle, &appearance_char_handle);
iv123 0:4946262d6030 44 if(ret){
iv123 0:4946262d6030 45 PRINTF("GAP_Init failed.\n");
iv123 0:4946262d6030 46 reboot();
iv123 0:4946262d6030 47 }
iv123 0:4946262d6030 48 const char *name = "BlueNRG";
iv123 0:4946262d6030 49 ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t *)name);
iv123 0:4946262d6030 50 if(ret){
iv123 0:4946262d6030 51 PRINTF("aci_gatt_update_char_value failed.\n");
iv123 0:4946262d6030 52 }
iv123 0:4946262d6030 53 * @endcode
iv123 0:4946262d6030 54 * @param role Bitmap of allowed roles: see @ref gap_roles "GAP roles".
iv123 0:4946262d6030 55 * @param privacy_enabled Enable (1) or disable (0) privacy.
iv123 0:4946262d6030 56 * @param device_name_char_len Length of the device name characteristic
iv123 0:4946262d6030 57 * @param[out] service_handle Handle of the GAP service.
iv123 0:4946262d6030 58 * @param[out] dev_name_char_handle Device Name Characteristic handle
iv123 0:4946262d6030 59 * @param[out] appearance_char_handle Appearance Characteristic handle
iv123 0:4946262d6030 60 * @retval tBleStatus Value indicating success or error code.
iv123 0:4946262d6030 61 */
iv123 0:4946262d6030 62 tBleStatus aci_gap_init_IDB05A1(uint8_t role, uint8_t privacy_enabled,
iv123 0:4946262d6030 63 uint8_t device_name_char_len,
iv123 0:4946262d6030 64 uint16_t* service_handle,
iv123 0:4946262d6030 65 uint16_t* dev_name_char_handle,
iv123 0:4946262d6030 66 uint16_t* appearance_char_handle);
iv123 0:4946262d6030 67 /**
iv123 0:4946262d6030 68 * @brief Initialize the GAP layer.
iv123 0:4946262d6030 69 * @note Register the GAP service with the GATT.
iv123 0:4946262d6030 70 * All the standard GAP characteristics will also be added:
iv123 0:4946262d6030 71 * @li Device Name
iv123 0:4946262d6030 72 * @li Appearance
iv123 0:4946262d6030 73 * @li Peripheral Privacy Flag (peripheral role only)
iv123 0:4946262d6030 74 * @li Reconnection Address (peripheral role only)
iv123 0:4946262d6030 75 * @li Peripheral Preferred Connection Parameters (peripheral role only)
iv123 0:4946262d6030 76 * @code
iv123 0:4946262d6030 77
iv123 0:4946262d6030 78 tBleStatus ret;
iv123 0:4946262d6030 79 uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
iv123 0:4946262d6030 80
iv123 0:4946262d6030 81 ret = aci_gap_init_IDB04A1(1, &service_handle, &dev_name_char_handle, &appearance_char_handle);
iv123 0:4946262d6030 82 if(ret){
iv123 0:4946262d6030 83 PRINTF("GAP_Init failed.\n");
iv123 0:4946262d6030 84 reboot();
iv123 0:4946262d6030 85 }
iv123 0:4946262d6030 86 const char *name = "BlueNRG";
iv123 0:4946262d6030 87 ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t *)name);
iv123 0:4946262d6030 88 if(ret){
iv123 0:4946262d6030 89 PRINTF("aci_gatt_update_char_value failed.\n");
iv123 0:4946262d6030 90 }
iv123 0:4946262d6030 91 * @endcode
iv123 0:4946262d6030 92 * @param role One of the allowed roles: @ref GAP_PERIPHERAL_ROLE or @ref GAP_CENTRAL_ROLE. See @ref gap_roles "GAP roles".
iv123 0:4946262d6030 93 * @param[out] service_handle Handle of the GAP service.
iv123 0:4946262d6030 94 * @param[out] dev_name_char_handle Device Name Characteristic handle
iv123 0:4946262d6030 95 * @param[out] appearance_char_handle Appearance Characteristic handle
iv123 0:4946262d6030 96 * @retval tBleStatus Value indicating success or error code.
iv123 0:4946262d6030 97 */
iv123 0:4946262d6030 98 tBleStatus aci_gap_init_IDB04A1(uint8_t role,
iv123 0:4946262d6030 99 uint16_t* service_handle,
iv123 0:4946262d6030 100 uint16_t* dev_name_char_handle,
iv123 0:4946262d6030 101 uint16_t* appearance_char_handle);
iv123 0:4946262d6030 102
iv123 0:4946262d6030 103 /**
iv123 0:4946262d6030 104 * @brief Set the Device in non-discoverable mode.
iv123 0:4946262d6030 105 * @note This command will disable the LL advertising.
iv123 0:4946262d6030 106 * @retval tBleStatus Value indicating success or error code.
iv123 0:4946262d6030 107 */
iv123 0:4946262d6030 108 tBleStatus aci_gap_set_non_discoverable(void);
iv123 0:4946262d6030 109
iv123 0:4946262d6030 110 /**
iv123 0:4946262d6030 111 * @brief Put the device in limited discoverable mode
iv123 0:4946262d6030 112 * (as defined in GAP specification volume 3, section 9.2.3).
iv123 0:4946262d6030 113 * @note The device will be discoverable for TGAP (lim_adv_timeout) = 180 seconds.
iv123 0:4946262d6030 114 * The advertising can be disabled at any time by issuing
iv123 0:4946262d6030 115 * aci_gap_set_non_discoverable() command.
iv123 0:4946262d6030 116 * The AdvIntervMin and AdvIntervMax parameters are optional. If both
iv123 0:4946262d6030 117 * are set to 0, the GAP will use default values (250 ms and 500 ms respectively).
iv123 0:4946262d6030 118 * Host can set the Local Name, a Service UUID list and the Slave Connection
iv123 0:4946262d6030 119 * Minimum and Maximum. If provided, these data will be inserted into the
iv123 0:4946262d6030 120 * advertising packet payload as AD data. These parameters are optional
iv123 0:4946262d6030 121 * in this command. These values can be also set using aci_gap_update_adv_data()
iv123 0:4946262d6030 122 * separately.
iv123 0:4946262d6030 123 * The total size of data in advertising packet cannot exceed 31 bytes.
iv123 0:4946262d6030 124 * With this command, the BLE Stack will also add automatically the following
iv123 0:4946262d6030 125 * standard AD types:
iv123 0:4946262d6030 126 * @li AD Flags
iv123 0:4946262d6030 127 * @li TX Power Level
iv123 0:4946262d6030 128 *
iv123 0:4946262d6030 129 * When advertising timeout happens (i.e. limited discovery period has elapsed), controller generates
iv123 0:4946262d6030 130 * @ref EVT_BLUE_GAP_LIMITED_DISCOVERABLE event.
iv123 0:4946262d6030 131 *
iv123 0:4946262d6030 132 * Example:
iv123 0:4946262d6030 133 * @code
iv123 0:4946262d6030 134 *
iv123 0:4946262d6030 135 * #define ADV_INTERVAL_MIN_MS 100
iv123 0:4946262d6030 136 * #define ADV_INTERVAL_MAX_MS 200
iv123 0:4946262d6030 137 *
iv123 0:4946262d6030 138 * tBleStatus ret;
iv123 0:4946262d6030 139 *
iv123 0:4946262d6030 140 * const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
iv123 0:4946262d6030 141 * const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
iv123 0:4946262d6030 142 *
iv123 0:4946262d6030 143 * ret = aci_gap_set_limited_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/0.625,
iv123 0:4946262d6030 144 * (ADV_INTERVAL_MAX_MS*1000)/0.625,
iv123 0:4946262d6030 145 * STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
iv123 0:4946262d6030 146 * sizeof(local_name), local_name,
iv123 0:4946262d6030 147 * sizeof(serviceUUIDList), serviceUUIDList,
iv123 0:4946262d6030 148 * 0, 0);
iv123 0:4946262d6030 149 * @endcode
iv123 0:4946262d6030 150 *
iv123 0:4946262d6030 151 * @param AdvType One of the advertising types:
iv123 0:4946262d6030 152 * @arg @ref ADV_IND Connectable undirected advertising
iv123 0:4946262d6030 153 * @arg @ref ADV_SCAN_IND Scannable undirected advertising
iv123 0:4946262d6030 154 * @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
iv123 0:4946262d6030 155 * @param AdvIntervMin Minimum advertising interval.
iv123 0:4946262d6030 156 * Range: 0x0020 to 0x4000
iv123 0:4946262d6030 157 * Default: 250 ms
iv123 0:4946262d6030 158 * Time = N * 0.625 msec
iv123 0:4946262d6030 159 * Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
iv123 0:4946262d6030 160 * @param AdvIntervMax Maximum advertising interval.
iv123 0:4946262d6030 161 * Range: 0x0020 to 0x4000
iv123 0:4946262d6030 162 * Default: 500 ms
iv123 0:4946262d6030 163 * Time = N * 0.625 msec
iv123 0:4946262d6030 164 * Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
iv123 0:4946262d6030 165 * @param OwnAddrType Type of our address used during advertising
iv123 0:4946262d6030 166 * (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 167 * @param AdvFilterPolicy Filter policy:
iv123 0:4946262d6030 168 * @arg NO_WHITE_LIST_USE
iv123 0:4946262d6030 169 * @arg WHITE_LIST_FOR_ONLY_SCAN
iv123 0:4946262d6030 170 * @arg WHITE_LIST_FOR_ONLY_CONN
iv123 0:4946262d6030 171 * @arg WHITE_LIST_FOR_ALL
iv123 0:4946262d6030 172 * @param LocalNameLen Length of LocalName array.
iv123 0:4946262d6030 173 * @param LocalName Array containing the Local Name AD data. First byte is the AD type:
iv123 0:4946262d6030 174 * @ref AD_TYPE_SHORTENED_LOCAL_NAME or @ref AD_TYPE_COMPLETE_LOCAL_NAME.
iv123 0:4946262d6030 175 * @param ServiceUUIDLen Length of ServiceUUIDList array.
iv123 0:4946262d6030 176 * @param ServiceUUIDList This is the list of the UUIDs AD Types as defined in Volume 3,
iv123 0:4946262d6030 177 * Section 11.1.1 of GAP Specification. First byte is the AD Type.
iv123 0:4946262d6030 178 * @arg @ref AD_TYPE_16_BIT_SERV_UUID
iv123 0:4946262d6030 179 * @arg @ref AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST
iv123 0:4946262d6030 180 * @arg @ref AD_TYPE_128_BIT_SERV_UUID
iv123 0:4946262d6030 181 * @arg @ref AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST
iv123 0:4946262d6030 182 * @param SlaveConnIntervMin Slave connection interval minimum value suggested by Peripheral.
iv123 0:4946262d6030 183 * If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
iv123 0:4946262d6030 184 * Slave Connection Interval Range AD structure will be added in advertising
iv123 0:4946262d6030 185 * data.
iv123 0:4946262d6030 186 * Connection interval is defined in the following manner:
iv123 0:4946262d6030 187 * connIntervalmin = Slave_Conn_Interval_Min x 1.25ms
iv123 0:4946262d6030 188 * Slave_Conn_Interval_Min range: 0x0006 to 0x0C80
iv123 0:4946262d6030 189 * Value of 0xFFFF indicates no specific minimum.
iv123 0:4946262d6030 190 * @param SlaveConnIntervMax Slave connection interval maximum value suggested by Peripheral.
iv123 0:4946262d6030 191 * If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
iv123 0:4946262d6030 192 * Slave Connection Interval Range AD structure will be added in advertising
iv123 0:4946262d6030 193 * data.
iv123 0:4946262d6030 194 * ConnIntervalmax = Slave_Conn_Interval_Max x 1.25ms
iv123 0:4946262d6030 195 * Slave_Conn_Interval_Max range: 0x0006 to 0x0C80
iv123 0:4946262d6030 196 * Slave_ Conn_Interval_Max shall be equal to or greater than the Slave_Conn_Interval_Min.
iv123 0:4946262d6030 197 * Value of 0xFFFF indicates no specific maximum.
iv123 0:4946262d6030 198 *
iv123 0:4946262d6030 199 * @retval tBleStatus Value indicating success or error code.
iv123 0:4946262d6030 200 */
iv123 0:4946262d6030 201 tBleStatus aci_gap_set_limited_discoverable(uint8_t AdvType, uint16_t AdvIntervMin, uint16_t AdvIntervMax,
iv123 0:4946262d6030 202 uint8_t OwnAddrType, uint8_t AdvFilterPolicy, uint8_t LocalNameLen,
iv123 0:4946262d6030 203 const char *LocalName, uint8_t ServiceUUIDLen, uint8_t* ServiceUUIDList,
iv123 0:4946262d6030 204 uint16_t SlaveConnIntervMin, uint16_t SlaveConnIntervMax);
iv123 0:4946262d6030 205 /**
iv123 0:4946262d6030 206 * @brief Put the Device in general discoverable mode (as defined in GAP specification volume 3, section 9.2.4).
iv123 0:4946262d6030 207 * @note The device will be discoverable until the Host issue Bluehci_Gap_Set_Non_Discoverable command.
iv123 0:4946262d6030 208 * The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are set to 0, the GAP uses
iv123 0:4946262d6030 209 * the default values for advertising intervals for IDB04A1 (1.28 s and 2.56 s respectively).
iv123 0:4946262d6030 210 * For IDB05A1:
iv123 0:4946262d6030 211 * When using connectable undirected advertising events:\n
iv123 0:4946262d6030 212 * @li Adv_Interval_Min = 30 ms
iv123 0:4946262d6030 213 * @li Adv_Interval_Max = 60 ms
iv123 0:4946262d6030 214 * \nWhen using non-connectable advertising events or scannable undirected advertising events:\n
iv123 0:4946262d6030 215 * @li Adv_Interval_Min = 100 ms
iv123 0:4946262d6030 216 * @li Adv_Interval_Max = 150 ms
iv123 0:4946262d6030 217 * Host can set the Local Name, a Service UUID list and the Slave Connection Interval Range. If provided,
iv123 0:4946262d6030 218 * these data will be inserted into the advertising packet payload as AD data. These parameters are optional
iv123 0:4946262d6030 219 * in this command. These values can be also set using aci_gap_update_adv_data() separately.
iv123 0:4946262d6030 220 * The total size of data in advertising packet cannot exceed 31 bytes.
iv123 0:4946262d6030 221 * With this command, the BLE Stack will also add automatically the following standard AD types:
iv123 0:4946262d6030 222 * @li AD Flags
iv123 0:4946262d6030 223 * @li TX Power Level
iv123 0:4946262d6030 224 *
iv123 0:4946262d6030 225 * Usage example:
iv123 0:4946262d6030 226 *
iv123 0:4946262d6030 227 * @code
iv123 0:4946262d6030 228 *
iv123 0:4946262d6030 229 * #define ADV_INTERVAL_MIN_MS 800
iv123 0:4946262d6030 230 * #define ADV_INTERVAL_MAX_MS 900
iv123 0:4946262d6030 231 * #define CONN_INTERVAL_MIN_MS 100
iv123 0:4946262d6030 232 * #define CONN_INTERVAL_MAX_MS 300
iv123 0:4946262d6030 233 *
iv123 0:4946262d6030 234 * tBleStatus ret;
iv123 0:4946262d6030 235 *
iv123 0:4946262d6030 236 * const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
iv123 0:4946262d6030 237 * const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
iv123 0:4946262d6030 238 *
iv123 0:4946262d6030 239 * ret = aci_gap_set_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/625,
iv123 0:4946262d6030 240 * (ADV_INTERVAL_MAX_MS*1000)/625,
iv123 0:4946262d6030 241 * STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
iv123 0:4946262d6030 242 * sizeof(local_name), local_name,
iv123 0:4946262d6030 243 * 0, NULL,
iv123 0:4946262d6030 244 * (CONN_INTERVAL_MIN_MS*1000)/1250,
iv123 0:4946262d6030 245 * (CONN_INTERVAL_MAX_MS*1000)/1250);
iv123 0:4946262d6030 246 * @endcode
iv123 0:4946262d6030 247 *
iv123 0:4946262d6030 248 * @param AdvType One of the advertising types:
iv123 0:4946262d6030 249 * @arg @ref ADV_IND Connectable undirected advertising
iv123 0:4946262d6030 250 * @arg @ref ADV_SCAN_IND Scannable undirected advertising
iv123 0:4946262d6030 251 * @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
iv123 0:4946262d6030 252 * @param AdvIntervMin Minimum advertising interval.
iv123 0:4946262d6030 253 * Range: 0x0020 to 0x4000
iv123 0:4946262d6030 254 * Default: 1.28 s
iv123 0:4946262d6030 255 * Time = N * 0.625 msec
iv123 0:4946262d6030 256 * Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
iv123 0:4946262d6030 257 * @param AdvIntervMax Maximum advertising interval.
iv123 0:4946262d6030 258 * Range: 0x0020 to 0x4000
iv123 0:4946262d6030 259 * Default: 2.56 s
iv123 0:4946262d6030 260 * Time = N * 0.625 msec
iv123 0:4946262d6030 261 * Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
iv123 0:4946262d6030 262 * @param OwnAddrType Type of our address used during advertising
iv123 0:4946262d6030 263 * (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 264 * @param AdvFilterPolicy Filter policy:
iv123 0:4946262d6030 265 * @arg @ref NO_WHITE_LIST_USE
iv123 0:4946262d6030 266 * @arg @ref WHITE_LIST_FOR_ONLY_SCAN
iv123 0:4946262d6030 267 * @arg @ref WHITE_LIST_FOR_ONLY_CONN
iv123 0:4946262d6030 268 * @arg @ref WHITE_LIST_FOR_ALL
iv123 0:4946262d6030 269 * @param LocalNameLen Length of LocalName array.
iv123 0:4946262d6030 270 * @param LocalName Array containing the Local Name AD data. First byte is the AD type:
iv123 0:4946262d6030 271 * @ref AD_TYPE_SHORTENED_LOCAL_NAME or @ref AD_TYPE_COMPLETE_LOCAL_NAME.
iv123 0:4946262d6030 272 * @param ServiceUUIDLen Length of ServiceUUIDList array.
iv123 0:4946262d6030 273 * @param ServiceUUIDList This is the list of the UUIDs AD Types as defined in Volume 3,
iv123 0:4946262d6030 274 * Section 11.1.1 of GAP Specification. First byte is the AD Type.
iv123 0:4946262d6030 275 * @arg @ref AD_TYPE_16_BIT_SERV_UUID
iv123 0:4946262d6030 276 * @arg @ref AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST
iv123 0:4946262d6030 277 * @arg @ref AD_TYPE_128_BIT_SERV_UUID
iv123 0:4946262d6030 278 * @arg @ref AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST
iv123 0:4946262d6030 279 * @param SlaveConnIntervMin Slave connection interval minimum value suggested by Peripheral.
iv123 0:4946262d6030 280 * If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
iv123 0:4946262d6030 281 * Slave Connection Interval Range AD structure will be added in advertising
iv123 0:4946262d6030 282 * data.
iv123 0:4946262d6030 283 * Connection interval is defined in the following manner:
iv123 0:4946262d6030 284 * connIntervalmin = Slave_Conn_Interval_Min x 1.25ms
iv123 0:4946262d6030 285 * Slave_Conn_Interval_Min range: 0x0006 to 0x0C80
iv123 0:4946262d6030 286 * Value of 0xFFFF indicates no specific minimum.
iv123 0:4946262d6030 287 * @param SlaveConnIntervMax Slave connection interval maximum value suggested by Peripheral.
iv123 0:4946262d6030 288 * If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
iv123 0:4946262d6030 289 * Slave Connection Interval Range AD structure will be added in advertising
iv123 0:4946262d6030 290 * data.
iv123 0:4946262d6030 291 * ConnIntervalmax = Slave_Conn_Interval_Max x 1.25ms
iv123 0:4946262d6030 292 * Slave_Conn_Interval_Max range: 0x0006 to 0x0C80
iv123 0:4946262d6030 293 * Slave_ Conn_Interval_Max shall be equal to or greater than the Slave_Conn_Interval_Min.
iv123 0:4946262d6030 294 * Value of 0xFFFF indicates no specific maximum.
iv123 0:4946262d6030 295 *
iv123 0:4946262d6030 296 * @retval tBleStatus Value indicating success or error code.
iv123 0:4946262d6030 297 */
iv123 0:4946262d6030 298 tBleStatus aci_gap_set_discoverable(uint8_t AdvType, uint16_t AdvIntervMin, uint16_t AdvIntervMax,
iv123 0:4946262d6030 299 uint8_t OwnAddrType, uint8_t AdvFilterPolicy, uint8_t LocalNameLen,
iv123 0:4946262d6030 300 const char *LocalName, uint8_t ServiceUUIDLen, uint8_t* ServiceUUIDList,
iv123 0:4946262d6030 301 uint16_t SlaveConnIntervMin, uint16_t SlaveConnIntervMax);
iv123 0:4946262d6030 302
iv123 0:4946262d6030 303 /**
iv123 0:4946262d6030 304 * @brief Set the Device in direct connectable mode (as defined in GAP specification Volume 3, Section 9.3.3).
iv123 0:4946262d6030 305 * @note If the privacy is enabled, the reconnection address is used for advertising, otherwise the address
iv123 0:4946262d6030 306 * of the type specified in OwnAddrType is used. The device will be in directed connectable mode only
iv123 0:4946262d6030 307 * for 1.28 seconds. If no connection is established within this duration, the device enters non
iv123 0:4946262d6030 308 * discoverable mode and advertising will have to be again enabled explicitly.
iv123 0:4946262d6030 309 * The controller generates a @ref EVT_LE_CONN_COMPLETE event with the status set to @ref HCI_DIRECTED_ADV_TIMEOUT
iv123 0:4946262d6030 310 * if the connection was not established and 0x00 if the connection was successfully established.
iv123 0:4946262d6030 311 *
iv123 0:4946262d6030 312 * Usage example:
iv123 0:4946262d6030 313 * @code
iv123 0:4946262d6030 314 *
iv123 0:4946262d6030 315 * tBleStatus ret;
iv123 0:4946262d6030 316 *
iv123 0:4946262d6030 317 * const uint8_t central_address[] = {0x43,0x27,0x84,0xE1,0x80,0x02};
iv123 0:4946262d6030 318 * ret = aci_gap_set_direct_connectable_IDB05A1(PUBLIC_ADDR, HIGH_DUTY_CYCLE_DIRECTED_ADV, PUBLIC_ADDR, central_address);
iv123 0:4946262d6030 319 * @endcode
iv123 0:4946262d6030 320 *
iv123 0:4946262d6030 321 *
iv123 0:4946262d6030 322 *
iv123 0:4946262d6030 323 * @param OwnAddrType Type of our address used during advertising (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 324 * @param directed_adv_type Type of directed advertising (@ref HIGH_DUTY_CYCLE_DIRECTED_ADV, @ref LOW_DUTY_CYCLE_DIRECTED_ADV).
iv123 0:4946262d6030 325 * @param InitiatorAddrType Type of peer address (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 326 * @param InitiatorAddr Initiator's address (Little Endian).
iv123 0:4946262d6030 327 * @return Value indicating success or error code.
iv123 0:4946262d6030 328 */
iv123 0:4946262d6030 329 tBleStatus aci_gap_set_direct_connectable_IDB05A1(uint8_t own_addr_type, uint8_t directed_adv_type, uint8_t initiator_addr_type, const uint8_t *initiator_addr);
iv123 0:4946262d6030 330 /**
iv123 0:4946262d6030 331 * @brief Set the Device in direct connectable mode (as defined in GAP specification Volume 3, Section 9.3.3).
iv123 0:4946262d6030 332 * @note If the privacy is enabled, the reconnection address is used for advertising, otherwise the address
iv123 0:4946262d6030 333 * of the type specified in OwnAddrType is used. The device will be in directed connectable mode only
iv123 0:4946262d6030 334 * for 1.28 seconds. If no connection is established within this duration, the device enters non
iv123 0:4946262d6030 335 * discoverable mode and advertising will have to be again enabled explicitly.
iv123 0:4946262d6030 336 * The controller generates a @ref EVT_LE_CONN_COMPLETE event with the status set to @ref HCI_DIRECTED_ADV_TIMEOUT
iv123 0:4946262d6030 337 * if the connection was not established and 0x00 if the connection was successfully established.
iv123 0:4946262d6030 338 *
iv123 0:4946262d6030 339 * Usage example:
iv123 0:4946262d6030 340 * @code
iv123 0:4946262d6030 341 *
iv123 0:4946262d6030 342 * tBleStatus ret;
iv123 0:4946262d6030 343 *
iv123 0:4946262d6030 344 * const uint8_t central_address = {0x43,0x27,0x84,0xE1,0x80,0x02};
iv123 0:4946262d6030 345 * ret = aci_gap_set_direct_connectable_IDB04A1(PUBLIC_ADDR, PUBLIC_ADDR, central_address);
iv123 0:4946262d6030 346 * @endcode
iv123 0:4946262d6030 347 *
iv123 0:4946262d6030 348 *
iv123 0:4946262d6030 349 *
iv123 0:4946262d6030 350 * @param OwnAddrType Type of our address used during advertising (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 351 * @param InitiatorAddrType Type of peer address (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 352 * @param InitiatorAddr Initiator's address (Little Endian).
iv123 0:4946262d6030 353 * @return Value indicating success or error code.
iv123 0:4946262d6030 354 */
iv123 0:4946262d6030 355 tBleStatus aci_gap_set_direct_connectable_IDB04A1(uint8_t own_addr_type, uint8_t initiator_addr_type, const uint8_t *initiator_addr);
iv123 0:4946262d6030 356
iv123 0:4946262d6030 357 /**
iv123 0:4946262d6030 358 * @brief Set the IO capabilities of the device.
iv123 0:4946262d6030 359 * @note This command has to be given only when the device is not in a connected state.
iv123 0:4946262d6030 360 * @param io_capability One of the allowed codes for IO Capability:
iv123 0:4946262d6030 361 * @arg @ref IO_CAP_DISPLAY_ONLY
iv123 0:4946262d6030 362 * @arg @ref IO_CAP_DISPLAY_YES_NO
iv123 0:4946262d6030 363 * @arg @ref IO_CAP_KEYBOARD_ONLY
iv123 0:4946262d6030 364 * @arg @ref IO_CAP_NO_INPUT_NO_OUTPUT
iv123 0:4946262d6030 365 * @arg @ref IO_CAP_KEYBOARD_DISPLAY
iv123 0:4946262d6030 366 * @return Value indicating success or error code.
iv123 0:4946262d6030 367 */
iv123 0:4946262d6030 368 tBleStatus aci_gap_set_io_capability(uint8_t io_capability);
iv123 0:4946262d6030 369
iv123 0:4946262d6030 370 /**
iv123 0:4946262d6030 371 * @brief Set the authentication requirements for the device.
iv123 0:4946262d6030 372 * @note If the oob_enable is set to 0, oob_data will be ignored.
iv123 0:4946262d6030 373 * This command has to be given only when the device is not in a connected state.
iv123 0:4946262d6030 374 * @param mitm_mode MITM mode:
iv123 0:4946262d6030 375 * @arg @ref MITM_PROTECTION_NOT_REQUIRED
iv123 0:4946262d6030 376 * @arg @ref MITM_PROTECTION_REQUIRED
iv123 0:4946262d6030 377 * @param oob_enable If OOB data are present or not:
iv123 0:4946262d6030 378 * @arg @ref OOB_AUTH_DATA_ABSENT
iv123 0:4946262d6030 379 * @arg @ref OOB_AUTH_DATA_PRESENT
iv123 0:4946262d6030 380 * @param oob_data Out-Of-Band data
iv123 0:4946262d6030 381 * @param min_encryption_key_size Minimum size of the encryption key to be used during the pairing process
iv123 0:4946262d6030 382 * @param max_encryption_key_size Maximum size of the encryption key to be used during the pairing process
iv123 0:4946262d6030 383 * @param use_fixed_pin If application wants to use a fixed pin or not:
iv123 0:4946262d6030 384 * @arg @ref USE_FIXED_PIN_FOR_PAIRING
iv123 0:4946262d6030 385 * @arg @ref DONOT_USE_FIXED_PIN_FOR_PAIRING
iv123 0:4946262d6030 386 * If a fixed pin is not used, it has to be provided by the application with
iv123 0:4946262d6030 387 * aci_gap_pass_key_response() after @ref EVT_BLUE_GAP_PASS_KEY_REQUEST event.
iv123 0:4946262d6030 388 * @param fixed_pin If use_fixed_pin is USE_FIXED_PIN_FOR_PAIRING, this is the value of the pin that will
iv123 0:4946262d6030 389 * be used during pairing if MIMT protection is enabled. Any value between 0 to 999999 is
iv123 0:4946262d6030 390 * accepted.
iv123 0:4946262d6030 391 * @param bonding_mode One of the bonding modes:
iv123 0:4946262d6030 392 * @arg @ref BONDING
iv123 0:4946262d6030 393 * @arg @ref NO_BONDING
iv123 0:4946262d6030 394 * @return Value indicating success or error code.
iv123 0:4946262d6030 395 */
iv123 0:4946262d6030 396 tBleStatus aci_gap_set_auth_requirement(uint8_t mitm_mode,
iv123 0:4946262d6030 397 uint8_t oob_enable,
iv123 0:4946262d6030 398 uint8_t oob_data[16],
iv123 0:4946262d6030 399 uint8_t min_encryption_key_size,
iv123 0:4946262d6030 400 uint8_t max_encryption_key_size,
iv123 0:4946262d6030 401 uint8_t use_fixed_pin,
iv123 0:4946262d6030 402 uint32_t fixed_pin,
iv123 0:4946262d6030 403 uint8_t bonding_mode);
iv123 0:4946262d6030 404 /**
iv123 0:4946262d6030 405 * @brief Set the authorization requirements of the device.
iv123 0:4946262d6030 406 * @note This command has to be given only when the device is not in a connected state.
iv123 0:4946262d6030 407 * @param conn_handle Handle of the connection in case BlueNRG is configured as a master (otherwise it can be also 0).
iv123 0:4946262d6030 408 * @param authorization_enable @arg @ref AUTHORIZATION_NOT_REQUIRED : Authorization not required
iv123 0:4946262d6030 409 * @arg @ref AUTHORIZATION_REQUIRED : Authorization required. This enables
iv123 0:4946262d6030 410 * the authorization requirement in the device and when a remote device
iv123 0:4946262d6030 411 * tries to connect to GATT server, @ref EVT_BLUE_GAP_AUTHORIZATION_REQUEST event
iv123 0:4946262d6030 412 * will be sent to the Host.
iv123 0:4946262d6030 413 *
iv123 0:4946262d6030 414 * @return Value indicating success or error code.
iv123 0:4946262d6030 415 */
iv123 0:4946262d6030 416 tBleStatus aci_gap_set_author_requirement(uint16_t conn_handle, uint8_t authorization_enable);
iv123 0:4946262d6030 417
iv123 0:4946262d6030 418 /**
iv123 0:4946262d6030 419 * @brief Provide the pass key that will be used during pairing.
iv123 0:4946262d6030 420 * @note This command should be sent by the Host in response to @ref EVT_BLUE_GAP_PASS_KEY_REQUEST event.
iv123 0:4946262d6030 421 * @param conn_handle Connection handle
iv123 0:4946262d6030 422 * @param passkey Pass key that will be used during the pairing process. Must be a number between
iv123 0:4946262d6030 423 * 0 and 999999.
iv123 0:4946262d6030 424 * @return Value indicating success or error code.
iv123 0:4946262d6030 425 */
iv123 0:4946262d6030 426 tBleStatus aci_gap_pass_key_response(uint16_t conn_handle, uint32_t passkey);
iv123 0:4946262d6030 427
iv123 0:4946262d6030 428 /**
iv123 0:4946262d6030 429 * @brief Authorize a device to access attributes.
iv123 0:4946262d6030 430 * @note Application should send this command after it has received a @ref EVT_BLUE_GAP_AUTHORIZATION_REQUEST.
iv123 0:4946262d6030 431 *
iv123 0:4946262d6030 432 * @param conn_handle Connection handle
iv123 0:4946262d6030 433 * @param authorize @arg @ref CONNECTION_AUTHORIZED : Authorize (accept connection)
iv123 0:4946262d6030 434 * @arg @ref CONNECTION_REJECTED : Reject (reject connection)
iv123 0:4946262d6030 435 * @return Value indicating success or error code.
iv123 0:4946262d6030 436 */
iv123 0:4946262d6030 437 tBleStatus aci_gap_authorization_response(uint16_t conn_handle, uint8_t authorize);
iv123 0:4946262d6030 438
iv123 0:4946262d6030 439 /**
iv123 0:4946262d6030 440 * @brief Put the device into non-connectable mode.
iv123 0:4946262d6030 441 * @param adv_type One of the allowed advertising types:
iv123 0:4946262d6030 442 * @arg @ref ADV_SCAN_IND : Scannable undirected advertising
iv123 0:4946262d6030 443 * @arg @ref ADV_NONCONN_IND : Non-connectable undirected advertising
iv123 0:4946262d6030 444 * @param own_address_type If Privacy is disabled, then the peripheral address can be
iv123 0:4946262d6030 445 * @arg @ref PUBLIC_ADDR.
iv123 0:4946262d6030 446 * @arg @ref STATIC_RANDOM_ADDR.
iv123 0:4946262d6030 447 * If Privacy is enabled, then the peripheral address can be
iv123 0:4946262d6030 448 * @arg @ref RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 449 * @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 450 * @return Value indicating success or error code.
iv123 0:4946262d6030 451 */
iv123 0:4946262d6030 452 tBleStatus aci_gap_set_non_connectable_IDB05A1(uint8_t adv_type, uint8_t own_address_type);
iv123 0:4946262d6030 453 /**
iv123 0:4946262d6030 454 * @brief Put the device into non-connectable mode.
iv123 0:4946262d6030 455 * @param adv_type One of the allowed advertising types:
iv123 0:4946262d6030 456 * @arg @ref ADV_SCAN_IND : Scannable undirected advertising
iv123 0:4946262d6030 457 * @arg @ref ADV_NONCONN_IND : Non-connectable undirected advertising
iv123 0:4946262d6030 458 * @return Value indicating success or error code.
iv123 0:4946262d6030 459 */
iv123 0:4946262d6030 460 tBleStatus aci_gap_set_non_connectable_IDB04A1(uint8_t adv_type);
iv123 0:4946262d6030 461
iv123 0:4946262d6030 462 /**
iv123 0:4946262d6030 463 * @brief Put the device into undirected connectable mode.
iv123 0:4946262d6030 464 * @note If privacy is enabled in the device, a resolvable private address is generated and used
iv123 0:4946262d6030 465 * as the advertiser's address. If not, the address of the type specified in own_addr_type
iv123 0:4946262d6030 466 * is used for advertising.
iv123 0:4946262d6030 467 * @param own_addr_type Type of our address used during advertising:
iv123 0:4946262d6030 468 * if BLUENRG (IDB04A1)
iv123 0:4946262d6030 469 * @arg @ref PUBLIC_ADDR.
iv123 0:4946262d6030 470 * @arg @ref STATIC_RANDOM_ADDR.
iv123 0:4946262d6030 471 * else if BLUENRG_MS (IDB05A1)
iv123 0:4946262d6030 472 * If Privacy is disabled:
iv123 0:4946262d6030 473 * @arg @ref PUBLIC_ADDR.
iv123 0:4946262d6030 474 * @arg @ref STATIC_RANDOM_ADDR.
iv123 0:4946262d6030 475 * If Privacy is enabled:
iv123 0:4946262d6030 476 * @arg @ref RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 477 * @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 478 * @param adv_filter_policy Filter policy:
iv123 0:4946262d6030 479 * @arg @ref NO_WHITE_LIST_USE
iv123 0:4946262d6030 480 * @arg @ref WHITE_LIST_FOR_ALL
iv123 0:4946262d6030 481 * @return Value indicating success or error code.
iv123 0:4946262d6030 482 */
iv123 0:4946262d6030 483 tBleStatus aci_gap_set_undirected_connectable(uint8_t own_addr_type, uint8_t adv_filter_policy);
iv123 0:4946262d6030 484
iv123 0:4946262d6030 485 /**
iv123 0:4946262d6030 486 * @brief Send a slave security request to the master.
iv123 0:4946262d6030 487 * @note This command has to be issued to notify the master of the security requirements of the slave.
iv123 0:4946262d6030 488 * The master may encrypt the link, initiate the pairing procedure, or reject the request.
iv123 0:4946262d6030 489 * @param conn_handle Connection handle
iv123 0:4946262d6030 490 * @param bonding One of the bonding modes:
iv123 0:4946262d6030 491 * @arg @ref BONDING
iv123 0:4946262d6030 492 * @arg @ref NO_BONDING
iv123 0:4946262d6030 493 * @param mitm_protection If MITM protection is required or not:
iv123 0:4946262d6030 494 * @arg @ref MITM_PROTECTION_NOT_REQUIRED
iv123 0:4946262d6030 495 * @arg @ref MITM_PROTECTION_REQUIRED
iv123 0:4946262d6030 496 * @return Value indicating success or error code.
iv123 0:4946262d6030 497 */
iv123 0:4946262d6030 498 tBleStatus aci_gap_slave_security_request(uint16_t conn_handle, uint8_t bonding, uint8_t mitm_protection);
iv123 0:4946262d6030 499
iv123 0:4946262d6030 500 /**
iv123 0:4946262d6030 501 * @brief Update advertising data.
iv123 0:4946262d6030 502 * @note This command can be used to update the advertising data for a particular AD type.
iv123 0:4946262d6030 503 * If the AD type specified does not exist, then it is added to the advertising data.
iv123 0:4946262d6030 504 * If the overall advertising data length is more than 31 octets after the update, then
iv123 0:4946262d6030 505 * the command is rejected and the old data is retained.
iv123 0:4946262d6030 506 * @param AdvLen Length of AdvData array
iv123 0:4946262d6030 507 * @param AdvData Advertisement Data, formatted as specified in Bluetooth specification
iv123 0:4946262d6030 508 * (Volume 3, Part C, 11), including data length. It can contain more than one AD type.
iv123 0:4946262d6030 509 * Example
iv123 0:4946262d6030 510 * @code
iv123 0:4946262d6030 511 * tBleStatus ret;
iv123 0:4946262d6030 512 * const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
iv123 0:4946262d6030 513 * const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
iv123 0:4946262d6030 514 * const uint8_t manuf_data[] = {4, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0x05, 0x02, 0x01};
iv123 0:4946262d6030 515 *
iv123 0:4946262d6030 516 * ret = aci_gap_set_discoverable(ADV_IND, 0, 0, STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
iv123 0:4946262d6030 517 * 8, local_name, 3, serviceUUIDList, 0, 0);
iv123 0:4946262d6030 518 * ret = aci_gap_update_adv_data(5, manuf_data);
iv123 0:4946262d6030 519 * @endcode
iv123 0:4946262d6030 520 *
iv123 0:4946262d6030 521 * @return Value indicating success or error code.
iv123 0:4946262d6030 522 */
iv123 0:4946262d6030 523 tBleStatus aci_gap_update_adv_data(uint8_t AdvLen, const uint8_t *AdvData);
iv123 0:4946262d6030 524
iv123 0:4946262d6030 525 /**
iv123 0:4946262d6030 526 * @brief Delete an AD Type
iv123 0:4946262d6030 527 * @note This command can be used to delete the specified AD type from the advertisement data if
iv123 0:4946262d6030 528 * present.
iv123 0:4946262d6030 529 * @param ad_type One of the allowed AD types (see @ref AD_Types)
iv123 0:4946262d6030 530 * @return Value indicating success or error code.
iv123 0:4946262d6030 531 */
iv123 0:4946262d6030 532 tBleStatus aci_gap_delete_ad_type(uint8_t ad_type);
iv123 0:4946262d6030 533
iv123 0:4946262d6030 534 /**
iv123 0:4946262d6030 535 * @brief Get the current security settings
iv123 0:4946262d6030 536 * @note This command can be used to get the current security settings of the device.
iv123 0:4946262d6030 537 * @param mitm_protection @arg 0: Not required
iv123 0:4946262d6030 538 * @arg 1: Required
iv123 0:4946262d6030 539 * @param bonding @arg 0: No bonding mode
iv123 0:4946262d6030 540 * @arg 1: Bonding mode
iv123 0:4946262d6030 541 * @param oob_data @arg 0: Data absent
iv123 0:4946262d6030 542 * @arg 1: Data present
iv123 0:4946262d6030 543 * @param passkey_required @arg 0: Not required
iv123 0:4946262d6030 544 * @arg 1: Fixed pin is present which is being used
iv123 0:4946262d6030 545 * @arg 2: Passkey required for pairing. An event will be generated
iv123 0:4946262d6030 546 * when required.
iv123 0:4946262d6030 547 * @return Value indicating success or error code.
iv123 0:4946262d6030 548 */
iv123 0:4946262d6030 549 tBleStatus aci_gap_get_security_level(uint8_t* mitm_protection, uint8_t* bonding,
iv123 0:4946262d6030 550 uint8_t* oob_data, uint8_t* passkey_required);
iv123 0:4946262d6030 551
iv123 0:4946262d6030 552 /**
iv123 0:4946262d6030 553 * @brief Add addresses of bonded devices into the controller's whitelist.
iv123 0:4946262d6030 554 * @note The command will return an error if there are no devices in the database or if it was unable
iv123 0:4946262d6030 555 * to add the device into the whitelist.
iv123 0:4946262d6030 556 * @return Value indicating success or error code.
iv123 0:4946262d6030 557 */
iv123 0:4946262d6030 558 tBleStatus aci_gap_configure_whitelist(void);
iv123 0:4946262d6030 559
iv123 0:4946262d6030 560 /**
iv123 0:4946262d6030 561 * @brief Terminate a connection.
iv123 0:4946262d6030 562 * @note A @ref EVT_DISCONN_COMPLETE event will be generated when the link is disconnected.
iv123 0:4946262d6030 563 * @param conn_handle Connection handle
iv123 0:4946262d6030 564 * @param reason Reason for requesting disconnection. The error code can be any of ones as specified
iv123 0:4946262d6030 565 * for the disconnected command in the HCI specification (See @ref HCI_Error_codes).
iv123 0:4946262d6030 566 * @return Value indicating success or error code.
iv123 0:4946262d6030 567 */
iv123 0:4946262d6030 568 tBleStatus aci_gap_terminate(uint16_t conn_handle, uint8_t reason);
iv123 0:4946262d6030 569
iv123 0:4946262d6030 570 /**
iv123 0:4946262d6030 571 * @brief Clear the security database.
iv123 0:4946262d6030 572 * @note All the devices in the security database will be removed.
iv123 0:4946262d6030 573 * @return Value indicating success or error code.
iv123 0:4946262d6030 574 */
iv123 0:4946262d6030 575 tBleStatus aci_gap_clear_security_database(void);
iv123 0:4946262d6030 576
iv123 0:4946262d6030 577 /**
iv123 0:4946262d6030 578 * @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
iv123 0:4946262d6030 579 * @note This command can be issued by the application if a @ref EVT_BLUE_GAP_BOND_LOST event is generated.
iv123 0:4946262d6030 580 * @param conn_handle
iv123 0:4946262d6030 581 * @return Value indicating success or error code.
iv123 0:4946262d6030 582 */
iv123 0:4946262d6030 583 tBleStatus aci_gap_allow_rebond_IDB05A1(uint16_t conn_handle);
iv123 0:4946262d6030 584 /**
iv123 0:4946262d6030 585 * @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
iv123 0:4946262d6030 586 * @note This command can be issued by the application if a @ref EVT_BLUE_GAP_BOND_LOST event is generated.
iv123 0:4946262d6030 587 * @return Value indicating success or error code.
iv123 0:4946262d6030 588 */
iv123 0:4946262d6030 589 tBleStatus aci_gap_allow_rebond_IDB04A1(void);
iv123 0:4946262d6030 590
iv123 0:4946262d6030 591 /**
iv123 0:4946262d6030 592 * @brief Start the limited discovery procedure.
iv123 0:4946262d6030 593 * @note The controller is commanded to start active scanning. When this procedure is started,
iv123 0:4946262d6030 594 * only the devices in limited discoverable mode are returned to the upper layers.
iv123 0:4946262d6030 595 * The procedure is terminated when either the upper layers issue a command to terminate the
iv123 0:4946262d6030 596 * procedure by issuing the command aci_gap_terminate_gap_procedure() with the procedure code
iv123 0:4946262d6030 597 * set to @ref GAP_LIMITED_DISCOVERY_PROC or a timeout happens. When the procedure is terminated
iv123 0:4946262d6030 598 * due to any of the above reasons, @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with
iv123 0:4946262d6030 599 * the procedure code set to @ref GAP_LIMITED_DISCOVERY_PROC.
iv123 0:4946262d6030 600 * The device found when the procedure is ongoing is returned to the upper layers through the
iv123 0:4946262d6030 601 * event @ref EVT_BLUE_GAP_DEVICE_FOUND (for IDB04A1) and @ref EVT_LE_ADVERTISING_REPORT (for IDB05A1).
iv123 0:4946262d6030 602 * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 603 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 604 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 605 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 606 * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 607 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 608 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 609 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 610 * @param own_address_type Type of our address used during advertising (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 611 * @param filterDuplicates Duplicate filtering enabled or not.
iv123 0:4946262d6030 612 * @arg 0x00: Do not filter the duplicates
iv123 0:4946262d6030 613 * @arg 0x01: Filter duplicates
iv123 0:4946262d6030 614 *
iv123 0:4946262d6030 615 * @return Value indicating success or error code.
iv123 0:4946262d6030 616 */
iv123 0:4946262d6030 617 tBleStatus aci_gap_start_limited_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
iv123 0:4946262d6030 618 uint8_t own_address_type, uint8_t filterDuplicates);
iv123 0:4946262d6030 619
iv123 0:4946262d6030 620 /**
iv123 0:4946262d6030 621 * @brief Start the general discovery procedure.
iv123 0:4946262d6030 622 * @note The controller is commanded to start active scanning. The procedure is terminated when
iv123 0:4946262d6030 623 * either the upper layers issue a command to terminate the procedure by issuing the command
iv123 0:4946262d6030 624 * aci_gap_terminate_gap_procedure() with the procedure code set to GAP_GENERAL_DISCOVERY_PROC
iv123 0:4946262d6030 625 * or a timeout happens. When the procedure is terminated due to any of the above reasons,
iv123 0:4946262d6030 626 * @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with the procedure code set to
iv123 0:4946262d6030 627 * @ref GAP_GENERAL_DISCOVERY_PROC. The device found when the procedure is ongoing is returned to
iv123 0:4946262d6030 628 * the upper layers through the event @ref EVT_BLUE_GAP_DEVICE_FOUND (for IDB04A1) and @ref EVT_LE_ADVERTISING_REPORT (for IDB05A1).
iv123 0:4946262d6030 629 * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 630 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 631 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 632 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 633 * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 634 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 635 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 636 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 637 * @param own_address_type Type of our address used during advertising (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 638 * @param filterDuplicates Duplicate filtering enabled or not.
iv123 0:4946262d6030 639 * @arg 0x00: Do not filter the duplicates
iv123 0:4946262d6030 640 * @arg 0x01: Filter duplicates
iv123 0:4946262d6030 641 *
iv123 0:4946262d6030 642 * @return Value indicating success or error code.
iv123 0:4946262d6030 643 */
iv123 0:4946262d6030 644 tBleStatus aci_gap_start_general_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
iv123 0:4946262d6030 645 uint8_t own_address_type, uint8_t filterDuplicates);
iv123 0:4946262d6030 646
iv123 0:4946262d6030 647 /**
iv123 0:4946262d6030 648 * @brief Start the name discovery procedure.
iv123 0:4946262d6030 649 * @note A LE_Create_Connection call will be made to the controller by GAP with the initiator filter
iv123 0:4946262d6030 650 * policy set to “ignore whitelist and process connectable advertising packets only for the
iv123 0:4946262d6030 651 * specified device”. Once a connection is established, GATT procedure is started to read the
iv123 0:4946262d6030 652 * device name characteristic. When the read is completed (successfully or unsuccessfully),
iv123 0:4946262d6030 653 * a @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is given to the upper layer. The event also
iv123 0:4946262d6030 654 * contains the name of the device if the device name was read successfully.
iv123 0:4946262d6030 655 * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 656 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 657 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 658 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 659 * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 660 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 661 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 662 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 663 * @param peer_bdaddr_type Type of the peer address (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 664 * @param peer_bdaddr Address of the peer device with which a connection has to be established.
iv123 0:4946262d6030 665 * @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 666 * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
iv123 0:4946262d6030 667 * equal to Conn_Interval_Max.\n
iv123 0:4946262d6030 668 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 669 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 670 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 671 * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
iv123 0:4946262d6030 672 * equal to Conn_Interval_Min.\n
iv123 0:4946262d6030 673 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 674 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 675 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 676 * @param conn_latency Slave latency for the connection in number of connection events.\n
iv123 0:4946262d6030 677 * Range: 0x0000 to 0x01F4
iv123 0:4946262d6030 678 * @param supervision_timeout Supervision timeout for the LE Link.\n
iv123 0:4946262d6030 679 * Range: 0x000A to 0x0C80\n
iv123 0:4946262d6030 680 * Time = N x 10 msec\n
iv123 0:4946262d6030 681 * Time Range: 100 msec to 32 seconds
iv123 0:4946262d6030 682 * @param min_conn_length Minimum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 683 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 684 * Time = N x 0.625 msec.
iv123 0:4946262d6030 685 * @param max_conn_length Maximum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 686 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 687 * Time = N x 0.625 msec.
iv123 0:4946262d6030 688 * @return Value indicating success or error code.
iv123 0:4946262d6030 689 */
iv123 0:4946262d6030 690 tBleStatus aci_gap_start_name_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
iv123 0:4946262d6030 691 uint8_t peer_bdaddr_type, tBDAddr peer_bdaddr,
iv123 0:4946262d6030 692 uint8_t own_bdaddr_type, uint16_t conn_min_interval,
iv123 0:4946262d6030 693 uint16_t conn_max_interval, uint16_t conn_latency,
iv123 0:4946262d6030 694 uint16_t supervision_timeout, uint16_t min_conn_length,
iv123 0:4946262d6030 695 uint16_t max_conn_length);
iv123 0:4946262d6030 696
iv123 0:4946262d6030 697 /**
iv123 0:4946262d6030 698 * @brief Start the auto connection establishment procedure.
iv123 0:4946262d6030 699 * @note The devices specified are added to the white list of the controller and a LE_Create_Connection
iv123 0:4946262d6030 700 * call will be made to the controller by GAP with the initiator filter policy set to
iv123 0:4946262d6030 701 * “use whitelist to determine which advertiser to connect to”. When a command is issued to
iv123 0:4946262d6030 702 * terminate the procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the
iv123 0:4946262d6030 703 * controller by GAP.
iv123 0:4946262d6030 704 * The procedure is terminated when either a connection is successfully established with one of
iv123 0:4946262d6030 705 * the specified devices in the white list or the procedure is explicitly terminated by issuing
iv123 0:4946262d6030 706 * the command aci_gap_terminate_gap_procedure() with the procedure code set to
iv123 0:4946262d6030 707 * @ref GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC. A @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with
iv123 0:4946262d6030 708 * the procedure code set to @ref GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC.
iv123 0:4946262d6030 709 * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 710 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 711 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 712 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 713 * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 714 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 715 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 716 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 717 * @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 718 * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
iv123 0:4946262d6030 719 * equal to Conn_Interval_Max.\n
iv123 0:4946262d6030 720 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 721 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 722 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 723 * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
iv123 0:4946262d6030 724 * equal to Conn_Interval_Min.\n
iv123 0:4946262d6030 725 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 726 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 727 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 728 * @param conn_latency Slave latency for the connection in number of connection events.\n
iv123 0:4946262d6030 729 * Range: 0x0000 to 0x01F4
iv123 0:4946262d6030 730 * @param supervision_timeout Supervision timeout for the LE Link.\n
iv123 0:4946262d6030 731 * Range: 0x000A to 0x0C80\n
iv123 0:4946262d6030 732 * Time = N x 10 msec\n
iv123 0:4946262d6030 733 * Time Range: 100 msec to 32 seconds
iv123 0:4946262d6030 734 * @param min_conn_length Minimum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 735 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 736 * Time = N x 0.625 msec.
iv123 0:4946262d6030 737 * @param max_conn_length Maximum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 738 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 739 * Time = N x 0.625 msec.
iv123 0:4946262d6030 740 * @cond BLUENRG
iv123 0:4946262d6030 741 * @param use_reconn_addr If 1, the provided reconnection address is used as our address during the procedure (the address
iv123 0:4946262d6030 742 * has been previously notified to the application through @ref EVT_BLUE_GAP_RECONNECTION_ADDRESS event).\n
iv123 0:4946262d6030 743 * @param reconn_addr Reconnection address used if use_reconn_addr is 1.
iv123 0:4946262d6030 744 * @endcond
iv123 0:4946262d6030 745 * @param num_whitelist_entries Number of devices that have to be added to the whitelist.
iv123 0:4946262d6030 746 * @param addr_array addr_array will contain the addresses that have to be added into the whitelist. The
iv123 0:4946262d6030 747 * format of the addr_array should be: address type followed by address.
iv123 0:4946262d6030 748 * Example:
iv123 0:4946262d6030 749 * @code
iv123 0:4946262d6030 750 * uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
iv123 0:4946262d6030 751 * PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
iv123 0:4946262d6030 752 * @endcode
iv123 0:4946262d6030 753 * @return Value indicating success or error code.
iv123 0:4946262d6030 754 */
iv123 0:4946262d6030 755 tBleStatus aci_gap_start_auto_conn_establish_proc_IDB05A1(uint16_t scanInterval, uint16_t scanWindow,
iv123 0:4946262d6030 756 uint8_t own_bdaddr_type, uint16_t conn_min_interval,
iv123 0:4946262d6030 757 uint16_t conn_max_interval, uint16_t conn_latency,
iv123 0:4946262d6030 758 uint16_t supervision_timeout, uint16_t min_conn_length,
iv123 0:4946262d6030 759 uint16_t max_conn_length,
iv123 0:4946262d6030 760 uint8_t num_whitelist_entries,
iv123 0:4946262d6030 761 const uint8_t *addr_array);
iv123 0:4946262d6030 762 tBleStatus aci_gap_start_auto_conn_establish_proc_IDB04A1(uint16_t scanInterval, uint16_t scanWindow,
iv123 0:4946262d6030 763 uint8_t own_bdaddr_type, uint16_t conn_min_interval,
iv123 0:4946262d6030 764 uint16_t conn_max_interval, uint16_t conn_latency,
iv123 0:4946262d6030 765 uint16_t supervision_timeout, uint16_t min_conn_length,
iv123 0:4946262d6030 766 uint16_t max_conn_length,
iv123 0:4946262d6030 767 uint8_t use_reconn_addr,
iv123 0:4946262d6030 768 const tBDAddr reconn_addr,
iv123 0:4946262d6030 769 uint8_t num_whitelist_entries,
iv123 0:4946262d6030 770 const uint8_t *addr_array);
iv123 0:4946262d6030 771
iv123 0:4946262d6030 772 /**
iv123 0:4946262d6030 773 * @brief Start a general connection establishment procedure.
iv123 0:4946262d6030 774 * @note The host enables scanning in the controller with the scanner filter policy set
iv123 0:4946262d6030 775 * to “accept all advertising packets” and from the scanning results all the devices
iv123 0:4946262d6030 776 * are sent to the upper layer using the event @ref EVT_BLUE_GAP_DEVICE_FOUND (for IDB04A1) and @ref EVT_LE_ADVERTISING_REPORT (for IDB05A1).
iv123 0:4946262d6030 777 * The upper layer then has to select one of the devices to which it wants to connect
iv123 0:4946262d6030 778 * by issuing the command aci_gap_create_connection(). The procedure is terminated
iv123 0:4946262d6030 779 * when a connection is established or the upper layer terminates the procedure by
iv123 0:4946262d6030 780 * issuing the command aci_gap_terminate_gap_procedure() with the procedure code set to
iv123 0:4946262d6030 781 * @ref GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC. On completion of the procedure a
iv123 0:4946262d6030 782 * @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is generated with the procedure code set to
iv123 0:4946262d6030 783 * @ref GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC.
iv123 0:4946262d6030 784 * @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
iv123 0:4946262d6030 785 * @param scan_interval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 786 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 787 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 788 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 789 * @param scan_window Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 790 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 791 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 792 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 793 * @param own_address_type Type of our address used during active scanning (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 794 * @param filter_duplicates Duplicate filtering enabled or not.
iv123 0:4946262d6030 795 * @arg 0x00: Do not filter the duplicates
iv123 0:4946262d6030 796 * @arg 0x01: Filter duplicates
iv123 0:4946262d6030 797 * @cond BLUENRG
iv123 0:4946262d6030 798 * @param use_reconn_addr If 1, the provided reconnection address is used as our address during the procedure (the address
iv123 0:4946262d6030 799 * has been previously notified to the application through @ref EVT_BLUE_GAP_RECONNECTION_ADDRESS event).\n
iv123 0:4946262d6030 800 * @param reconn_addr Reconnection address used if use_reconn_addr is 1.
iv123 0:4946262d6030 801 * @endcond
iv123 0:4946262d6030 802 *
iv123 0:4946262d6030 803 * @return Value indicating success or error code.
iv123 0:4946262d6030 804 */
iv123 0:4946262d6030 805 tBleStatus aci_gap_start_general_conn_establish_proc_IDB05A1(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
iv123 0:4946262d6030 806 uint8_t own_address_type, uint8_t filter_duplicates);
iv123 0:4946262d6030 807 tBleStatus aci_gap_start_general_conn_establish_proc_IDB04A1(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
iv123 0:4946262d6030 808 uint8_t own_address_type, uint8_t filter_duplicates, uint8_t use_reconn_addr, const tBDAddr reconn_addr);
iv123 0:4946262d6030 809
iv123 0:4946262d6030 810 /**
iv123 0:4946262d6030 811 * @brief Start a selective connection establishment procedure.
iv123 0:4946262d6030 812 * @note The GAP adds the specified device addresses into white list and enables scanning in
iv123 0:4946262d6030 813 * the controller with the scanner filter policy set to “accept packets only from
iv123 0:4946262d6030 814 * devices in whitelist”. All the devices found are sent to the upper layer by the
iv123 0:4946262d6030 815 * event @ref EVT_BLUE_GAP_DEVICE_FOUND (for IDB04A1) and @ref EVT_LE_ADVERTISING_REPORT (for IDB05A1). The upper layer then has to select one of the
iv123 0:4946262d6030 816 * devices to which it wants to connect by issuing the command aci_gap_create_connection().
iv123 0:4946262d6030 817 * On completion of the procedure a @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is generated
iv123 0:4946262d6030 818 * with the procedure code set to @ref GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC.
iv123 0:4946262d6030 819 * The procedure is terminated when a connection is established or the upper layer terminates
iv123 0:4946262d6030 820 * the procedure by issuing the command aci_gap_terminate_gap_procedure with the procedure
iv123 0:4946262d6030 821 * code set to @ref GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC.
iv123 0:4946262d6030 822 * @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
iv123 0:4946262d6030 823 * @param scan_interval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 824 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 825 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 826 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 827 * @param scan_window Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 828 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 829 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 830 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 831 * @param own_address_type Type of our address used during active scanning (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 832 * @param filter_duplicates Duplicate filtering enabled or not.
iv123 0:4946262d6030 833 * @arg 0x00: Do not filter the duplicates
iv123 0:4946262d6030 834 * @arg 0x01: Filter duplicates
iv123 0:4946262d6030 835 * @param num_whitelist_entries Number of devices that have to be added to the whitelist.
iv123 0:4946262d6030 836 * @param addr_array addr_array will contain the addresses that have to be added into the whitelist. The
iv123 0:4946262d6030 837 * format of the addr_array should be: address type followed by address.
iv123 0:4946262d6030 838 * Example:
iv123 0:4946262d6030 839 * @code
iv123 0:4946262d6030 840 * uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
iv123 0:4946262d6030 841 * PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
iv123 0:4946262d6030 842 * @endcode
iv123 0:4946262d6030 843 *
iv123 0:4946262d6030 844 * @return Value indicating success or error code.
iv123 0:4946262d6030 845 */
iv123 0:4946262d6030 846 tBleStatus aci_gap_start_selective_conn_establish_proc(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
iv123 0:4946262d6030 847 uint8_t own_address_type, uint8_t filter_duplicates, uint8_t num_whitelist_entries,
iv123 0:4946262d6030 848 const uint8_t *addr_array);
iv123 0:4946262d6030 849
iv123 0:4946262d6030 850 /**
iv123 0:4946262d6030 851 * @brief Start the direct connection establishment procedure.
iv123 0:4946262d6030 852 * @note A LE_Create_Connection call will be made to the controller by GAP with the initiator filter
iv123 0:4946262d6030 853 * policy set to “ignore whitelist and process connectable advertising packets only for the
iv123 0:4946262d6030 854 * specified device”. The procedure can be terminated explicitly by the upper layer by issuing
iv123 0:4946262d6030 855 * the command aci_gap_terminate_gap_procedure(). When a command is issued to terminate the
iv123 0:4946262d6030 856 * procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the controller
iv123 0:4946262d6030 857 * by GAP.
iv123 0:4946262d6030 858 * On termination of the procedure, a @ref EVT_LE_CONN_COMPLETE event is returned. The procedure can
iv123 0:4946262d6030 859 * be explicitly terminated by the upper layer by issuing the command
iv123 0:4946262d6030 860 * aci_gap_terminate_gap_procedure() with the procedure_code set to @ref GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC.
iv123 0:4946262d6030 861 * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
iv123 0:4946262d6030 862 * the subsequent LE scan. The scan interval should be a number in the range
iv123 0:4946262d6030 863 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 864 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 865 * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
iv123 0:4946262d6030 866 * or equal to Scan_Interval. The scan window should be a number in the range
iv123 0:4946262d6030 867 * 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
iv123 0:4946262d6030 868 * For a number N, Time = N x 0.625 msec.
iv123 0:4946262d6030 869 * @param peer_bdaddr_type Type of the peer address (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 870 * @param peer_bdaddr Address of the peer device with which a connection has to be established.
iv123 0:4946262d6030 871 * @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
iv123 0:4946262d6030 872 * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
iv123 0:4946262d6030 873 * equal to Conn_Interval_Max.\n
iv123 0:4946262d6030 874 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 875 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 876 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 877 * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
iv123 0:4946262d6030 878 * equal to Conn_Interval_Min.\n
iv123 0:4946262d6030 879 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 880 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 881 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 882 * @param conn_latency Slave latency for the connection in number of connection events.\n
iv123 0:4946262d6030 883 * Range: 0x0000 to 0x01F4
iv123 0:4946262d6030 884 * @param supervision_timeout Supervision timeout for the LE Link.\n
iv123 0:4946262d6030 885 * Range: 0x000A to 0x0C80\n
iv123 0:4946262d6030 886 * Time = N x 10 msec\n
iv123 0:4946262d6030 887 * Time Range: 100 msec to 32 seconds
iv123 0:4946262d6030 888 * @param min_conn_length Minimum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 889 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 890 * Time = N x 0.625 msec.
iv123 0:4946262d6030 891 * @param max_conn_length Maximum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 892 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 893 * Time = N x 0.625 msec.
iv123 0:4946262d6030 894 * @return Value indicating success or error code.
iv123 0:4946262d6030 895 */
iv123 0:4946262d6030 896 tBleStatus aci_gap_create_connection(uint16_t scanInterval, uint16_t scanWindow,
iv123 0:4946262d6030 897 uint8_t peer_bdaddr_type, tBDAddr peer_bdaddr,
iv123 0:4946262d6030 898 uint8_t own_bdaddr_type, uint16_t conn_min_interval,
iv123 0:4946262d6030 899 uint16_t conn_max_interval, uint16_t conn_latency,
iv123 0:4946262d6030 900 uint16_t supervision_timeout, uint16_t min_conn_length,
iv123 0:4946262d6030 901 uint16_t max_conn_length);
iv123 0:4946262d6030 902
iv123 0:4946262d6030 903 /**
iv123 0:4946262d6030 904 * @brief Terminate the specified GAP procedure. @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is
iv123 0:4946262d6030 905 * returned with the procedure code set to the corresponding procedure.
iv123 0:4946262d6030 906 * @param procedure_code One of the procedure codes (@ref gap_procedure_codes "GAP procedure codes").
iv123 0:4946262d6030 907 * @return Value indicating success or error code.
iv123 0:4946262d6030 908 */
iv123 0:4946262d6030 909 tBleStatus aci_gap_terminate_gap_procedure(uint8_t procedure_code);
iv123 0:4946262d6030 910
iv123 0:4946262d6030 911 /**
iv123 0:4946262d6030 912 * @brief Start the connection parameter update procedure.
iv123 0:4946262d6030 913 * @note Allowed by the Central to update the connection parameter of the specified connection.
iv123 0:4946262d6030 914 * A Link Layer Connection Update procedure is started on the controller.
iv123 0:4946262d6030 915 * On completion of the procedure, a @ref EVT_LE_CONN_UPDATE_COMPLETE event is returned to
iv123 0:4946262d6030 916 * the upper layer.
iv123 0:4946262d6030 917 * @param conn_handle Handle of the connection for which the update procedure has to be started.
iv123 0:4946262d6030 918 * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
iv123 0:4946262d6030 919 * equal to Conn_Interval_Max.\n
iv123 0:4946262d6030 920 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 921 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 922 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 923 * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
iv123 0:4946262d6030 924 * equal to Conn_Interval_Min.\n
iv123 0:4946262d6030 925 * Range: 0x0006 to 0x0C80\n
iv123 0:4946262d6030 926 * Time = N x 1.25 msec\n
iv123 0:4946262d6030 927 * Time Range: 7.5 msec to 4 seconds
iv123 0:4946262d6030 928 * @param conn_latency Slave latency for the connection in number of connection events.\n
iv123 0:4946262d6030 929 * Range: 0x0000 to 0x01F4
iv123 0:4946262d6030 930 * @param supervision_timeout Supervision timeout for the LE Link.\n
iv123 0:4946262d6030 931 * Range: 0x000A to 0x0C80\n
iv123 0:4946262d6030 932 * Time = N x 10 msec\n
iv123 0:4946262d6030 933 * Time Range: 100 msec to 32 seconds
iv123 0:4946262d6030 934 * @param min_conn_length Minimum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 935 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 936 * Time = N x 0.625 msec.
iv123 0:4946262d6030 937 * @param max_conn_length Maximum length of connection needed for the LE connection.\n
iv123 0:4946262d6030 938 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 939 * Time = N x 0.625 msec.
iv123 0:4946262d6030 940 * @return Value indicating success or error code.
iv123 0:4946262d6030 941 */
iv123 0:4946262d6030 942 tBleStatus aci_gap_start_connection_update(uint16_t conn_handle, uint16_t conn_min_interval,
iv123 0:4946262d6030 943 uint16_t conn_max_interval, uint16_t conn_latency,
iv123 0:4946262d6030 944 uint16_t supervision_timeout, uint16_t min_conn_length,
iv123 0:4946262d6030 945 uint16_t max_conn_length);
iv123 0:4946262d6030 946
iv123 0:4946262d6030 947 /**
iv123 0:4946262d6030 948 * @brief Send a pairing request.
iv123 0:4946262d6030 949 * @note Send the SM pairing request to start a pairing process from a Central. The authentication
iv123 0:4946262d6030 950 * requirements and IO capabilities should be set before issuing this command using
iv123 0:4946262d6030 951 * aci_gap_set_io_capability() and aci_gap_set_auth_requirement().
iv123 0:4946262d6030 952 * A @ref EVT_BLUE_GAP_PAIRING_CMPLT event is returned after the pairing process is completed.
iv123 0:4946262d6030 953 * @param conn_handle Handle of the connection for which the pairing request has to be sent.
iv123 0:4946262d6030 954 * @param force_rebond @arg 0x00: Pairing request is sent only if the device has not previously bonded
iv123 0:4946262d6030 955 * @arg 0x01: Pairing request will be sent even if the device was previously bonded
iv123 0:4946262d6030 956 * @return Value indicating success or error code.
iv123 0:4946262d6030 957 */
iv123 0:4946262d6030 958 tBleStatus aci_gap_send_pairing_request(uint16_t conn_handle, uint8_t force_rebond);
iv123 0:4946262d6030 959
iv123 0:4946262d6030 960 /**
iv123 0:4946262d6030 961 * @brief Resolve a private address.
iv123 0:4946262d6030 962 * @note This command tries to resolve the address provided with the IRKs present in its database. If
iv123 0:4946262d6030 963 * the address is resolved successfully with any one of the IRKs present in the database, it
iv123 0:4946262d6030 964 * returns success.
iv123 0:4946262d6030 965 * @param address Address to be resolved.
iv123 0:4946262d6030 966 * @param[in] actual_address The public or static random address of the peer device, distributed during pairing phase.
iv123 0:4946262d6030 967 * @return Value indicating success or error code.
iv123 0:4946262d6030 968 */
iv123 0:4946262d6030 969 tBleStatus aci_gap_resolve_private_address_IDB05A1(const tBDAddr private_address, tBDAddr actual_address);
iv123 0:4946262d6030 970
iv123 0:4946262d6030 971 /**
iv123 0:4946262d6030 972 * @brief Resolve a private address.
iv123 0:4946262d6030 973 * @note This command tries to resolve the address provided with the IRKs present in its database. If
iv123 0:4946262d6030 974 * the address is resolved successfully with any one of the IRKs present in the database, it
iv123 0:4946262d6030 975 * returns success.
iv123 0:4946262d6030 976 * @param address Address to be resolved.
iv123 0:4946262d6030 977 * @return Value indicating success or error code.
iv123 0:4946262d6030 978 */
iv123 0:4946262d6030 979 tBleStatus aci_gap_resolve_private_address_IDB04A1(const tBDAddr private_address);
iv123 0:4946262d6030 980
iv123 0:4946262d6030 981 /**
iv123 0:4946262d6030 982 * @brief This command gets the list of bonded devices.
iv123 0:4946262d6030 983 * @note It returns the number of addresses and the corresponding address types and values.
iv123 0:4946262d6030 984 * Example:
iv123 0:4946262d6030 985 * @code
iv123 0:4946262d6030 986 * tBleStatus ret;
iv123 0:4946262d6030 987 * uint8_t num_devices = 0;
iv123 0:4946262d6030 988 * uint8_t device_list[12*7];
iv123 0:4946262d6030 989 * ret = aci_gap_get_bonded_devices(&num_devices, device_list, sizeof(device_list));
iv123 0:4946262d6030 990 * for(int i = 0; i < num_devices; i+=7){
iv123 0:4946262d6030 991 * uint8_t addr_type = device_list[i];
iv123 0:4946262d6030 992 * uint8_t addr = device_list[i+1];
iv123 0:4946262d6030 993 * printf("Type: %d, Addr: %02X%02X%02X%02X%02X%02X\n",addr_type,addr[5],addr[4],addr[3],addr[2],addr[1],addr[0]);
iv123 0:4946262d6030 994 * }
iv123 0:4946262d6030 995 * @endcode
iv123 0:4946262d6030 996 *
iv123 0:4946262d6030 997 * @param[in] num_devices The number of bonded devices.
iv123 0:4946262d6030 998 * @param[in] device_list List of addresses. It contains a sequence of [address type, address] pairs, where address
iv123 0:4946262d6030 999 * type can be @ref PUBLIC_ADDR or @arg @ref STATIC_RANDOM_ADDR.
iv123 0:4946262d6030 1000 * @param device_list_size Maximum size of the device_list buffer used to return the device list.
iv123 0:4946262d6030 1001 * @return Value indicating success or error code.
iv123 0:4946262d6030 1002 */
iv123 0:4946262d6030 1003 tBleStatus aci_gap_get_bonded_devices(uint8_t *num_devices, uint8_t *device_list, uint8_t device_list_size);
iv123 0:4946262d6030 1004
iv123 0:4946262d6030 1005 /**
iv123 0:4946262d6030 1006 * @brief Puts the device into broadcast mode
iv123 0:4946262d6030 1007 * @note A privacy enabled device uses either a resolvable private address or a non-resolvable private address
iv123 0:4946262d6030 1008 * as specified in the own_addr_type parameter of the command.
iv123 0:4946262d6030 1009 * @param adv_interv_min Minimum advertising interval.
iv123 0:4946262d6030 1010 * Range: 0x00A0 to 0x4000
iv123 0:4946262d6030 1011 * Time = N * 0.625 msec
iv123 0:4946262d6030 1012 * Time Range: 100 ms to 10.24 sec
iv123 0:4946262d6030 1013 * @param adv_interv_max Maximum advertising interval.
iv123 0:4946262d6030 1014 * Range: 0x00A0 to 0x4000
iv123 0:4946262d6030 1015 * Time = N * 0.625 msec
iv123 0:4946262d6030 1016 * Time Range: 100 ms to 10.24 sec
iv123 0:4946262d6030 1017 * @param adv_type One of the allowed advertising types:
iv123 0:4946262d6030 1018 * @arg @ref ADV_SCAN_IND Scannable undirected advertising
iv123 0:4946262d6030 1019 * @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
iv123 0:4946262d6030 1020 * @param own_address_type If Privacy is disabled, the broadcaster address can be
iv123 0:4946262d6030 1021 * @arg @ref PUBLIC_ADDR.
iv123 0:4946262d6030 1022 * @arg @ref STATIC_RANDOM_ADDR.
iv123 0:4946262d6030 1023 * If Privacy is enabled, then the broadcaster address can be
iv123 0:4946262d6030 1024 * @arg @ref RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 1025 * @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 1026 * @param adv_data_length Length of the advertising data in the advertising packet
iv123 0:4946262d6030 1027 * @param adv_data Advertising data used by the device while advertising
iv123 0:4946262d6030 1028 * @param num_whitelist_entries Number of devices to be added to whitelist
iv123 0:4946262d6030 1029 * @param addr_array It will contain the addresses that have to be added into the whitelist. The
iv123 0:4946262d6030 1030 * format of the addr_array should be: address type followed by address.
iv123 0:4946262d6030 1031 * Example:
iv123 0:4946262d6030 1032 * @code
iv123 0:4946262d6030 1033 * uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
iv123 0:4946262d6030 1034 * PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
iv123 0:4946262d6030 1035 * @endcode
iv123 0:4946262d6030 1036 * @return Value indicating success or error code.
iv123 0:4946262d6030 1037 */
iv123 0:4946262d6030 1038 tBleStatus aci_gap_set_broadcast_mode_IDB05A1(uint16_t adv_interv_min, uint16_t adv_interv_max, uint8_t adv_type,
iv123 0:4946262d6030 1039 uint8_t own_addr_type, uint8_t adv_data_length, const uint8_t *adv_data, uint8_t num_whitelist_entries,
iv123 0:4946262d6030 1040 const uint8_t *addr_array);
iv123 0:4946262d6030 1041
iv123 0:4946262d6030 1042 /**
iv123 0:4946262d6030 1043 * @brief Starts an observation procedure, when the device is in Observer role.
iv123 0:4946262d6030 1044 * @note The host enables scanning in the controller. The advertising reports are sent to the upper layer
iv123 0:4946262d6030 1045 * using standard @ref EVT_LE_ADVERTISING_REPORT subevent in @ref EVT_LE_META_EVENT. See Bluetooth
iv123 0:4946262d6030 1046 * Core v4.0, Vol. 2, part E, Ch. 7.7.65.2, LE Advertising Report Event.
iv123 0:4946262d6030 1047 * @param scan_interval Time interval from when the Controller started its last LE scan until it begins the subsequent LE scan.
iv123 0:4946262d6030 1048 * The scan interval should be a number in the range 0x0004 to 0x4000. This corresponds to a time range from 2.5 msec
iv123 0:4946262d6030 1049 * to 10240 msec. For a number N, Time = N * 0.625 msec.
iv123 0:4946262d6030 1050 * @param scan_window Amount of time for the duration of the LE scan. scan_window shall be less than or equal to scan_interval.
iv123 0:4946262d6030 1051 * The scan window should be a number in the range 0x0004 to 0x4000. This corresponds to a time range from 2.5 msec
iv123 0:4946262d6030 1052 * to 10240 msec. For a number N, Time = N * 0.625 msec.
iv123 0:4946262d6030 1053 * @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
iv123 0:4946262d6030 1054 * @param own_address_type If Privacy is disabled, then the scanner address can be
iv123 0:4946262d6030 1055 * @arg @ref PUBLIC_ADDR.
iv123 0:4946262d6030 1056 * @arg @ref STATIC_RANDOM_ADDR.
iv123 0:4946262d6030 1057 * If Privacy is enabled, then the scanner address can be
iv123 0:4946262d6030 1058 * @arg @ref RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 1059 * @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
iv123 0:4946262d6030 1060 * @param filter_duplicates Duplicate filtering enabled or not.
iv123 0:4946262d6030 1061 * @arg 0x00: Do not filter the duplicates
iv123 0:4946262d6030 1062 * @arg 0x01: Filter duplicates
iv123 0:4946262d6030 1063 * @return Value indicating success or error code.
iv123 0:4946262d6030 1064 */
iv123 0:4946262d6030 1065 tBleStatus aci_gap_start_observation_procedure(uint16_t scan_interval, uint16_t scan_window, uint8_t scan_type,
iv123 0:4946262d6030 1066 uint8_t own_address_type, uint8_t filter_duplicates);
iv123 0:4946262d6030 1067
iv123 0:4946262d6030 1068 /**
iv123 0:4946262d6030 1069 * @brief The command finds whether a device is bonded.
iv123 0:4946262d6030 1070 * @note If the device is using a resolvable private address and it has been bonded, then the command will return
iv123 0:4946262d6030 1071 * BLE_STATUS_SUCCESS.
iv123 0:4946262d6030 1072 * @param peer_address_type The address type of the peer device
iv123 0:4946262d6030 1073 * @arg @ref PUBLIC_ADDR.
iv123 0:4946262d6030 1074 * @arg @ref RANDOM_ADDR.
iv123 0:4946262d6030 1075 * @param peer_address Address used by the peer device while advertising.
iv123 0:4946262d6030 1076 * @return Value indicating success or error code.
iv123 0:4946262d6030 1077 */
iv123 0:4946262d6030 1078 tBleStatus aci_gap_is_device_bonded_IDB05A1(uint8_t peer_address_type, const tBDAddr peer_address);
iv123 0:4946262d6030 1079
iv123 0:4946262d6030 1080
iv123 0:4946262d6030 1081 /**
iv123 0:4946262d6030 1082 * @}
iv123 0:4946262d6030 1083 */
iv123 0:4946262d6030 1084
iv123 0:4946262d6030 1085 /**
iv123 0:4946262d6030 1086 * @defgroup GAP_Events GAP events
iv123 0:4946262d6030 1087 * @{
iv123 0:4946262d6030 1088 */
iv123 0:4946262d6030 1089
iv123 0:4946262d6030 1090 /**
iv123 0:4946262d6030 1091 * This event is generated by the controller when the limited discoverable
iv123 0:4946262d6030 1092 * mode ends due to timeout (180 seconds). No parameters in the event.
iv123 0:4946262d6030 1093 */
iv123 0:4946262d6030 1094 #define EVT_BLUE_GAP_LIMITED_DISCOVERABLE (0x0400)
iv123 0:4946262d6030 1095
iv123 0:4946262d6030 1096
iv123 0:4946262d6030 1097 /**
iv123 0:4946262d6030 1098 * This event is generated when the pairing process has completed successfully
iv123 0:4946262d6030 1099 * or a pairing procedure timeout has occurred or the pairing has failed.
iv123 0:4946262d6030 1100 * This is to notify the application that we have paired with a remote device
iv123 0:4946262d6030 1101 * so that it can take further actions or to notify that a timeout has occurred
iv123 0:4946262d6030 1102 * so that the upper layer can decide to disconnect the link. See @ref _evt_gap_pairing_cmplt.
iv123 0:4946262d6030 1103 */
iv123 0:4946262d6030 1104 #define EVT_BLUE_GAP_PAIRING_CMPLT (0x0401)
iv123 0:4946262d6030 1105 typedef __packed struct _evt_gap_pairing_cmplt{
iv123 0:4946262d6030 1106 uint16_t conn_handle; /**< Connection handle on which the pairing procedure completed */
iv123 0:4946262d6030 1107 /**
iv123 0:4946262d6030 1108 * 0x00: Pairing Success. Pairing with a remote device was successful\n
iv123 0:4946262d6030 1109 * 0x01: Pairing Timeout. The SMP timeout has elapsed and no further SMP commands will be processed until reconnection\n
iv123 0:4946262d6030 1110 * 0x02: Pairing Failed. The pairing failed with the remote device.
iv123 0:4946262d6030 1111 */
iv123 0:4946262d6030 1112 uint8_t status;
iv123 0:4946262d6030 1113 } PACKED evt_gap_pairing_cmplt;
iv123 0:4946262d6030 1114
iv123 0:4946262d6030 1115
iv123 0:4946262d6030 1116 /**
iv123 0:4946262d6030 1117 * This event is generated by the Security manager to the application when a pass key is required for pairing.
iv123 0:4946262d6030 1118 * When this event is received, the application has to respond with the aci_gap_pass_key_response() command.
iv123 0:4946262d6030 1119 * See @ref _evt_gap_pass_key_req.
iv123 0:4946262d6030 1120 */
iv123 0:4946262d6030 1121 #define EVT_BLUE_GAP_PASS_KEY_REQUEST (0x0402)
iv123 0:4946262d6030 1122 typedef __packed struct _evt_gap_pass_key_req{
iv123 0:4946262d6030 1123 uint16_t conn_handle; /**< Connection handle for which the passkey has been requested. */
iv123 0:4946262d6030 1124 } PACKED evt_gap_pass_key_req;
iv123 0:4946262d6030 1125
iv123 0:4946262d6030 1126
iv123 0:4946262d6030 1127 /**
iv123 0:4946262d6030 1128 * This event is generated by the Security manager to the application when the application
iv123 0:4946262d6030 1129 * has set that authorization is required for reading/writing of attributes. This event will
iv123 0:4946262d6030 1130 * be generated as soon as the pairing is complete. When this event is received,
iv123 0:4946262d6030 1131 * aci_gap_authorization_response() command should be used by the application.
iv123 0:4946262d6030 1132 * See @ref _evt_gap_author_req.
iv123 0:4946262d6030 1133 */
iv123 0:4946262d6030 1134 #define EVT_BLUE_GAP_AUTHORIZATION_REQUEST (0x0403)
iv123 0:4946262d6030 1135 typedef __packed struct _evt_gap_author_req{
iv123 0:4946262d6030 1136 uint16_t conn_handle; /**< Connection handle for which authorization has been requested. */
iv123 0:4946262d6030 1137 } PACKED evt_gap_author_req;
iv123 0:4946262d6030 1138
iv123 0:4946262d6030 1139 /**
iv123 0:4946262d6030 1140 * This event is generated when the slave security request is successfully sent to the master.
iv123 0:4946262d6030 1141 * No parameters for this event.
iv123 0:4946262d6030 1142 */
iv123 0:4946262d6030 1143 #define EVT_BLUE_GAP_SLAVE_SECURITY_INITIATED (0X0404)
iv123 0:4946262d6030 1144
iv123 0:4946262d6030 1145 /**
iv123 0:4946262d6030 1146 * This event is generated when a pairing request is issued in response to a slave security
iv123 0:4946262d6030 1147 * request from a master which has previously bonded with the slave. When this event is received,
iv123 0:4946262d6030 1148 * the upper layer has to issue the command aci_gap_allow_rebond() in order to allow the slave
iv123 0:4946262d6030 1149 * to continue the pairing process with the master. No parameters for this event
iv123 0:4946262d6030 1150 */
iv123 0:4946262d6030 1151 #define EVT_BLUE_GAP_BOND_LOST (0X0405)
iv123 0:4946262d6030 1152
iv123 0:4946262d6030 1153 /**
iv123 0:4946262d6030 1154 * The event is given by the GAP layer to the upper layers when a device is discovered during scanning
iv123 0:4946262d6030 1155 * as a consequence of one of the GAP procedures started by the upper layers. See @ref _evt_gap_device_found.
iv123 0:4946262d6030 1156 */
iv123 0:4946262d6030 1157 #define EVT_BLUE_GAP_DEVICE_FOUND (0x0406)
iv123 0:4946262d6030 1158 typedef __packed struct _evt_gap_device_found{
iv123 0:4946262d6030 1159 uint8_t evt_type; /**< Type of event (@ref ADV_IND, @ref ADV_DIRECT_IND, @ref ADV_SCAN_IND, @ref ADV_NONCONN_IND, @ref SCAN_RSP) */
iv123 0:4946262d6030 1160 uint8_t bdaddr_type; /**< Type of the peer address (@ref PUBLIC_ADDR, @ref RANDOM_ADDR). */
iv123 0:4946262d6030 1161 tBDAddr bdaddr; /**< Address of the peer device found during scanning. */
iv123 0:4946262d6030 1162 uint8_t data_length; /**< Length of advertising or scan response data. */
iv123 0:4946262d6030 1163 uint8_t data_RSSI[VARIABLE_SIZE]; /**< Advertising or scan response data + RSSI. RSSI is last octect (signed integer). */
iv123 0:4946262d6030 1164 } PACKED evt_gap_device_found;
iv123 0:4946262d6030 1165
iv123 0:4946262d6030 1166 /**
iv123 0:4946262d6030 1167 * This event is sent by the GAP to the upper layers when a procedure previously started has been terminated
iv123 0:4946262d6030 1168 * by the upper layer or has completed for any other reason. See @ref _evt_gap_procedure_complete.
iv123 0:4946262d6030 1169 */
iv123 0:4946262d6030 1170 #define EVT_BLUE_GAP_PROCEDURE_COMPLETE (0x0407)
iv123 0:4946262d6030 1171 typedef __packed struct _evt_gap_procedure_complete{
iv123 0:4946262d6030 1172 uint8_t procedure_code; /**< Terminated procedure. See @ref gap_procedure_codes "GAP procedure codes". */
iv123 0:4946262d6030 1173 /**
iv123 0:4946262d6030 1174 * @ref BLE_STATUS_SUCCESS, @ref BLE_STATUS_FAILED or @ref ERR_AUTH_FAILURE (procedure failed
iv123 0:4946262d6030 1175 * due to authentication requirements).
iv123 0:4946262d6030 1176 */
iv123 0:4946262d6030 1177 uint8_t status;
iv123 0:4946262d6030 1178 /**
iv123 0:4946262d6030 1179 * Procedure specific data.\n
iv123 0:4946262d6030 1180 * @li For Name Discovery Procedure:\n
iv123 0:4946262d6030 1181 * the name of the peer device if the procedure completed successfully.
iv123 0:4946262d6030 1182 * @li For General Connection Establishment Procedure:\n
iv123 0:4946262d6030 1183 * The reconnection address written to the peripheral device if the peripheral is privacy enabled
iv123 0:4946262d6030 1184 */
iv123 0:4946262d6030 1185 uint8_t data[VARIABLE_SIZE];
iv123 0:4946262d6030 1186 } PACKED evt_gap_procedure_complete;
iv123 0:4946262d6030 1187
iv123 0:4946262d6030 1188 /**
iv123 0:4946262d6030 1189 * This event is sent only by a privacy enabled Peripheral. The event is sent to the upper layers when the peripheral
iv123 0:4946262d6030 1190 * is not able to resolve the private address of the peer device after connecting to it.
iv123 0:4946262d6030 1191 */
iv123 0:4946262d6030 1192 #define EVT_BLUE_GAP_ADDR_NOT_RESOLVED_IDB05A1 (0x0408)
iv123 0:4946262d6030 1193 typedef __packed struct _evt_gap_addr_not_resolved_IDB05A1{
iv123 0:4946262d6030 1194 uint16_t conn_handle; /**< Connection handle for which the private address could not be resolved with any of the stored IRK's. */
iv123 0:4946262d6030 1195 } PACKED evt_gap_addr_not_resolved_IDB05A1;
iv123 0:4946262d6030 1196 /**
iv123 0:4946262d6030 1197 * This event is raised when the reconnection address is generated during the general connection
iv123 0:4946262d6030 1198 * establishment procedure. The same address is set into the peer device also as a part of the general
iv123 0:4946262d6030 1199 * connection establishment procedure. In order to make use of the reconnection address the next time
iv123 0:4946262d6030 1200 * while connecting to the bonded peripheral, the application needs to use this reconnection address
iv123 0:4946262d6030 1201 * as its own address as well as the peer address to which it wants to connect. See aci_gap_start_general_conn_establish_proc()
iv123 0:4946262d6030 1202 * and aci_gap_start_auto_conn_establish_proc().
iv123 0:4946262d6030 1203 */
iv123 0:4946262d6030 1204 #define EVT_BLUE_GAP_RECONNECTION_ADDRESS_IDB04A1 (0x0408)
iv123 0:4946262d6030 1205 typedef __packed struct _evt_gap_reconnection_addr_IDB04A1{
iv123 0:4946262d6030 1206 uint8_t reconnection_address[6]; /**< 6 bytes of reconnection address that has been generated */
iv123 0:4946262d6030 1207 } PACKED evt_gap_reconnection_addr_IDB04A1;
iv123 0:4946262d6030 1208
iv123 0:4946262d6030 1209 /**
iv123 0:4946262d6030 1210 * @}
iv123 0:4946262d6030 1211 */
iv123 0:4946262d6030 1212
iv123 0:4946262d6030 1213 /**
iv123 0:4946262d6030 1214 * @}
iv123 0:4946262d6030 1215 */
iv123 0:4946262d6030 1216
iv123 0:4946262d6030 1217
iv123 0:4946262d6030 1218 #endif /* __BLUENRG_GAP_ACI_H__ */