BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Committer:
Andrea Palmieri
Date:
Mon May 16 17:22:03 2016 +0200
Revision:
219:9981f62cdb1a
Parent:
208:48776140c30d
Fix issues and add features

- Fix handles management
- Fix UUIDs management
- Implement API to read random address
- Fix clearing/setting of ADV payload
- Fix scanning behaviour
- Fix scanning while a connection is ongoing
- Implement Char Descriptor discovery
- Implement scanning/advertising filter policy (White List partial management)
- Update underlying BlueNRG stack
- Cosmetics

Signed-off-by: Andrea Palmieri <andrea.palmieri@st.com>

Who changed what in which revision?

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