My fork of X_NUCLEO_IDB0XA1

Fork of X_NUCLEO_IDB0XA1 by ST

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bluenrg_gap_aci.h Source File

bluenrg_gap_aci.h

00001 /******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
00002 * File Name          : bluenrg_gap_aci.h
00003 * Author             : AMS - AAS
00004 * Version            : V1.0.0
00005 * Date               : 26-Jun-2014
00006 * Description        : Header file with GAP commands for BlueNRG FW6.3.
00007 ********************************************************************************
00008 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00009 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
00010 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
00011 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
00012 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
00013 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00014 *******************************************************************************/
00015 
00016 #ifndef __BLUENRG_GAP_ACI_H__
00017 #define __BLUENRG_GAP_ACI_H__
00018 
00019 /**
00020  *@addtogroup GAP GAP
00021  *@brief GAP layer.
00022  *@{
00023  */
00024 
00025 /**
00026  *@defgroup GAP_Functions GAP functions
00027  *@brief API for GAP layer.
00028  *@{
00029  */
00030 
00031 /**
00032   * @brief  Initialize the GAP layer.
00033   * @note   Register the GAP service with the GATT. 
00034   *         All the standard GAP characteristics will also be added:
00035   *         @li Device Name
00036   *         @li Appearance
00037   *         @li Peripheral Preferred Connection Parameters (peripheral role only)
00038   *         @code
00039 
00040               tBleStatus ret;
00041               uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
00042 
00043               ret = aci_gap_init_IDB05A1(1, 0, 0x07, &service_handle, &dev_name_char_handle, &appearance_char_handle);
00044               if(ret){
00045                 PRINTF("GAP_Init failed.\n");
00046                 reboot();    
00047               }  
00048               const char *name = "BlueNRG";  
00049               ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t *)name);        
00050               if(ret){
00051                 PRINTF("aci_gatt_update_char_value failed.\n");
00052               }  
00053   *         @endcode
00054   * @param       role     Bitmap of allowed roles: see @ref gap_roles "GAP roles".
00055   * @param       privacy_enabled     Enable (1) or disable (0) privacy.
00056   * @param       device_name_char_len Length of the device name characteristic
00057   * @param[out]  service_handle  Handle of the GAP service.
00058   * @param[out]  dev_name_char_handle  Device Name Characteristic handle
00059   * @param[out]  appearance_char_handle Appearance Characteristic handle
00060   * @retval tBleStatus Value indicating success or error code.
00061   */
00062 tBleStatus aci_gap_init_IDB05A1(uint8_t role, uint8_t privacy_enabled,
00063                         uint8_t device_name_char_len,
00064                         uint16_t* service_handle,
00065                         uint16_t* dev_name_char_handle,
00066                         uint16_t* appearance_char_handle);
00067 /**
00068   * @brief  Initialize the GAP layer.
00069   * @note   Register the GAP service with the GATT.
00070   *         All the standard GAP characteristics will also be added:
00071   *         @li Device Name
00072   *         @li Appearance
00073   *         @li Peripheral Privacy Flag (peripheral role only)
00074   *         @li Reconnection Address (peripheral role only)
00075   *         @li Peripheral Preferred Connection Parameters (peripheral role only)
00076   *         @code
00077 
00078               tBleStatus ret;
00079               uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
00080 
00081               ret = aci_gap_init_IDB04A1(1, &service_handle, &dev_name_char_handle, &appearance_char_handle);
00082               if(ret){
00083                 PRINTF("GAP_Init failed.\n");
00084                 reboot();    
00085               }  
00086               const char *name = "BlueNRG";  
00087               ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t *)name);        
00088               if(ret){
00089                 PRINTF("aci_gatt_update_char_value failed.\n");
00090               }  
00091   *         @endcode
00092   * @param       role     One of the allowed roles: @ref GAP_PERIPHERAL_ROLE or @ref GAP_CENTRAL_ROLE. See @ref gap_roles "GAP roles".
00093   * @param[out]  service_handle  Handle of the GAP service.
00094   * @param[out]  dev_name_char_handle  Device Name Characteristic handle
00095   * @param[out]  appearance_char_handle Appearance Characteristic handle
00096   * @retval tBleStatus Value indicating success or error code.
00097   */
00098 tBleStatus aci_gap_init_IDB04A1(uint8_t role,
00099                  uint16_t* service_handle,
00100                  uint16_t* dev_name_char_handle,
00101                  uint16_t* appearance_char_handle);
00102 
00103 /**
00104   * @brief   Set the Device in non-discoverable mode.
00105   * @note    This command will disable the LL advertising.
00106   * @retval  tBleStatus Value indicating success or error code.
00107   */
00108 tBleStatus aci_gap_set_non_discoverable(void);
00109 
00110 /**
00111  * @brief  Put the device in limited discoverable mode
00112  *         (as defined in GAP specification volume 3, section 9.2.3).
00113  * @note    The device will be discoverable for TGAP (lim_adv_timeout) = 180 seconds.
00114  *          The advertising can be disabled at any time by issuing
00115  *          aci_gap_set_non_discoverable() command.
00116  *          The AdvIntervMin and AdvIntervMax parameters are optional. If both
00117  *          are set to 0, the GAP will use default values (250 ms and 500 ms respectively).
00118  *          Host can set the Local Name, a Service UUID list and the Slave Connection
00119  *          Minimum and Maximum. If provided, these data will be inserted into the
00120  *          advertising packet payload as AD data. These parameters are optional
00121  *          in this command. These values can be also set using aci_gap_update_adv_data()
00122  *          separately.
00123  *          The total size of data in advertising packet cannot exceed 31 bytes.
00124  *          With this command, the BLE Stack will also add automatically the following
00125  *          standard AD types:
00126  *          @li AD Flags
00127  *          @li TX Power Level
00128  *
00129  *          When advertising timeout happens (i.e. limited discovery period has elapsed), controller generates
00130  *          @ref EVT_BLUE_GAP_LIMITED_DISCOVERABLE event.
00131  *
00132  *          Example:
00133  * @code
00134  *
00135  *              #define  ADV_INTERVAL_MIN_MS  100
00136  *              #define  ADV_INTERVAL_MAX_MS  200
00137  *
00138  *              tBleStatus ret;
00139  *
00140  *              const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
00141  *              const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
00142  *
00143  *              ret = aci_gap_set_limited_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/0.625,
00144  *                                                     (ADV_INTERVAL_MAX_MS*1000)/0.625,
00145  *                                                     STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
00146  *                                                    sizeof(local_name), local_name,
00147  *                                                     sizeof(serviceUUIDList), serviceUUIDList,
00148  *                                                     0, 0);
00149  * @endcode
00150  *
00151  * @param       AdvType     One of the advertising types:
00152  *               @arg @ref ADV_IND Connectable undirected advertising
00153  *               @arg @ref ADV_SCAN_IND Scannable undirected advertising
00154  *               @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
00155  * @param       AdvIntervMin    Minimum advertising interval.
00156  *                               Range: 0x0020 to 0x4000
00157  *                               Default: 250 ms
00158  *                               Time = N * 0.625 msec
00159  *                               Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
00160  * @param       AdvIntervMax    Maximum advertising interval.
00161  *                              Range: 0x0020 to 0x4000
00162  *                              Default: 500 ms
00163  *                              Time = N * 0.625 msec
00164  *                              Time Range: 20 ms to 10.24 sec  (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
00165  * @param       OwnAddrType     Type of our address used during advertising
00166  *                              (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
00167  * @param       AdvFilterPolicy  Filter policy:
00168  *                               @arg NO_WHITE_LIST_USE
00169  *                               @arg WHITE_LIST_FOR_ONLY_SCAN
00170  *                               @arg WHITE_LIST_FOR_ONLY_CONN
00171  *                               @arg WHITE_LIST_FOR_ALL
00172  * @param  LocalNameLen  Length of LocalName array.
00173  * @param  LocalName  Array containing the Local Name AD data. First byte is the AD type:
00174  *                       @ref AD_TYPE_SHORTENED_LOCAL_NAME or @ref AD_TYPE_COMPLETE_LOCAL_NAME.
00175  * @param  ServiceUUIDLen Length of ServiceUUIDList array.
00176  * @param  ServiceUUIDList  This is the list of the UUIDs AD Types as defined in Volume 3,
00177  *                              Section 11.1.1 of GAP Specification. First byte is the AD Type.
00178  *                              @arg @ref AD_TYPE_16_BIT_SERV_UUID
00179  *                              @arg @ref AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST
00180  *                              @arg @ref AD_TYPE_128_BIT_SERV_UUID
00181  *                              @arg @ref AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST
00182  * @param  SlaveConnIntervMin Slave connection interval minimum value suggested by Peripheral.
00183  *                           If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
00184  *                           Slave Connection Interval Range AD structure will be added in advertising
00185  *                           data.
00186  *                           Connection interval is defined in the following manner:
00187  *                           connIntervalmin = Slave_Conn_Interval_Min x 1.25ms
00188  *                           Slave_Conn_Interval_Min range: 0x0006 to 0x0C80
00189  *                           Value of 0xFFFF indicates no specific minimum.
00190  * @param  SlaveConnIntervMax Slave connection interval maximum value suggested by Peripheral.
00191  *                           If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
00192  *                           Slave Connection Interval Range AD structure will be added in advertising
00193  *                           data.
00194  *                           ConnIntervalmax = Slave_Conn_Interval_Max x 1.25ms
00195  *                           Slave_Conn_Interval_Max range: 0x0006 to 0x0C80
00196  *                           Slave_ Conn_Interval_Max shall be equal to or greater than the Slave_Conn_Interval_Min.
00197  *                           Value of 0xFFFF indicates no specific maximum.
00198  *
00199  * @retval tBleStatus Value indicating success or error code.
00200  */
00201 tBleStatus aci_gap_set_limited_discoverable(uint8_t AdvType, uint16_t AdvIntervMin, uint16_t AdvIntervMax,
00202                         uint8_t OwnAddrType, uint8_t AdvFilterPolicy, uint8_t LocalNameLen,
00203                         const char *LocalName, uint8_t ServiceUUIDLen, uint8_t* ServiceUUIDList,
00204                         uint16_t SlaveConnIntervMin, uint16_t SlaveConnIntervMax);
00205 /**
00206  * @brief Put the Device in general discoverable mode (as defined in GAP specification volume 3, section 9.2.4).
00207  * @note  The device will be discoverable until the Host issue Bluehci_Gap_Set_Non_Discoverable command.
00208  *        The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are set to 0, the GAP uses
00209  *        the default values for advertising intervals for IDB04A1 (1.28 s and 2.56 s respectively).
00210  *        For IDB05A1:
00211  *        When using connectable undirected advertising events:\n
00212  *        @li Adv_Interval_Min = 30 ms
00213  *        @li Adv_Interval_Max = 60 ms
00214  *        \nWhen using non-connectable advertising events or scannable undirected advertising events:\n
00215  *        @li Adv_Interval_Min = 100 ms
00216  *        @li Adv_Interval_Max = 150 ms
00217  *        Host can set the Local Name, a Service UUID list and the Slave Connection Interval Range. If provided,
00218  *        these data will be inserted into the advertising packet payload as AD data. These parameters are optional
00219  *        in this command. These values can be also set using aci_gap_update_adv_data() separately.
00220  *        The total size of data in advertising packet cannot exceed 31 bytes.
00221  *        With this command, the BLE Stack will also add automatically the following standard AD types:
00222  *        @li AD Flags
00223  *        @li TX Power Level
00224  *
00225  *        Usage example:
00226  *
00227  *        @code
00228  *
00229  *              #define  ADV_INTERVAL_MIN_MS  800
00230  *              #define  ADV_INTERVAL_MAX_MS  900
00231  *              #define  CONN_INTERVAL_MIN_MS 100
00232  *              #define  CONN_INTERVAL_MAX_MS 300
00233  *
00234  *              tBleStatus ret;
00235  *
00236  *              const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
00237  *              const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
00238  *
00239  *              ret = aci_gap_set_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/625,
00240  *                                                     (ADV_INTERVAL_MAX_MS*1000)/625,
00241  *                                                     STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
00242  *                                                     sizeof(local_name), local_name,
00243  *                                                     0, NULL,
00244  *                                                     (CONN_INTERVAL_MIN_MS*1000)/1250,
00245  *                                                     (CONN_INTERVAL_MAX_MS*1000)/1250);
00246  *          @endcode
00247  *
00248  * @param AdvType One of the advertising types:
00249  *                @arg @ref ADV_IND Connectable undirected advertising
00250  *                @arg @ref ADV_SCAN_IND Scannable undirected advertising
00251  *                @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
00252  * @param       AdvIntervMin    Minimum advertising interval.
00253  *                               Range: 0x0020 to 0x4000
00254  *                               Default: 1.28 s
00255  *                               Time = N * 0.625 msec
00256  *                               Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
00257  * @param       AdvIntervMax    Maximum advertising interval.
00258  *                              Range: 0x0020 to 0x4000
00259  *                              Default: 2.56 s
00260  *                              Time = N * 0.625 msec
00261  *                              Time Range: 20 ms to 10.24 sec  (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
00262  * @param       OwnAddrType     Type of our address used during advertising
00263  *                              (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
00264  * @param       AdvFilterPolicy  Filter policy:
00265  *                               @arg @ref NO_WHITE_LIST_USE
00266  *                               @arg @ref WHITE_LIST_FOR_ONLY_SCAN
00267  *                               @arg @ref WHITE_LIST_FOR_ONLY_CONN
00268  *                               @arg @ref WHITE_LIST_FOR_ALL
00269  * @param  LocalNameLen  Length of LocalName array.
00270  * @param  LocalName  Array containing the Local Name AD data. First byte is the AD type:
00271  *                       @ref AD_TYPE_SHORTENED_LOCAL_NAME or @ref AD_TYPE_COMPLETE_LOCAL_NAME.
00272  * @param  ServiceUUIDLen Length of ServiceUUIDList array.
00273  * @param  ServiceUUIDList  This is the list of the UUIDs AD Types as defined in Volume 3,
00274  *                              Section 11.1.1 of GAP Specification. First byte is the AD Type.
00275  *                              @arg @ref AD_TYPE_16_BIT_SERV_UUID
00276  *                              @arg @ref AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST
00277  *                              @arg @ref AD_TYPE_128_BIT_SERV_UUID
00278  *                              @arg @ref AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST
00279  * @param  SlaveConnIntervMin Slave connection interval minimum value suggested by Peripheral.
00280  *                           If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
00281  *                           Slave Connection Interval Range AD structure will be added in advertising
00282  *                           data.
00283  *                           Connection interval is defined in the following manner:
00284  *                           connIntervalmin = Slave_Conn_Interval_Min x 1.25ms
00285  *                           Slave_Conn_Interval_Min range: 0x0006 to 0x0C80
00286  *                           Value of 0xFFFF indicates no specific minimum.
00287  * @param  SlaveConnIntervMax Slave connection interval maximum value suggested by Peripheral.
00288  *                           If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
00289  *                           Slave Connection Interval Range AD structure will be added in advertising
00290  *                           data.
00291  *                           ConnIntervalmax = Slave_Conn_Interval_Max x 1.25ms
00292  *                           Slave_Conn_Interval_Max range: 0x0006 to 0x0C80
00293  *                           Slave_ Conn_Interval_Max shall be equal to or greater than the Slave_Conn_Interval_Min.
00294  *                           Value of 0xFFFF indicates no specific maximum.
00295  *
00296  * @retval tBleStatus Value indicating success or error code.
00297  */
00298 tBleStatus aci_gap_set_discoverable(uint8_t AdvType, uint16_t AdvIntervMin, uint16_t AdvIntervMax,
00299                              uint8_t OwnAddrType, uint8_t AdvFilterPolicy, uint8_t LocalNameLen,
00300                              const char *LocalName, uint8_t ServiceUUIDLen, uint8_t* ServiceUUIDList,
00301                              uint16_t SlaveConnIntervMin, uint16_t SlaveConnIntervMax);
00302 
00303 /**
00304  * @brief Set the Device in direct connectable mode (as defined in GAP specification Volume 3, Section 9.3.3).
00305  * @note  If the privacy is enabled, the reconnection address is used for advertising, otherwise the address
00306  *        of the type specified in OwnAddrType is used. The device will be in directed connectable mode only
00307  *        for 1.28 seconds. If no connection is established within this duration, the device enters non
00308  *        discoverable mode and advertising will have to be again enabled explicitly.
00309  *        The controller generates a @ref EVT_LE_CONN_COMPLETE event with the status set to @ref HCI_DIRECTED_ADV_TIMEOUT
00310  *        if the connection was not established and 0x00 if the connection was successfully established.
00311  *
00312  *        Usage example:
00313  *        @code
00314  *
00315  *        tBleStatus ret;
00316  *
00317  *        const uint8_t central_address[] = {0x43,0x27,0x84,0xE1,0x80,0x02};
00318  *        ret = aci_gap_set_direct_connectable_IDB05A1(PUBLIC_ADDR, HIGH_DUTY_CYCLE_DIRECTED_ADV, PUBLIC_ADDR, central_address);
00319  *        @endcode
00320  *
00321  *
00322  *
00323  * @param OwnAddrType  Type of our address used during advertising (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
00324  * @param directed_adv_type  Type of directed advertising (@ref HIGH_DUTY_CYCLE_DIRECTED_ADV, @ref LOW_DUTY_CYCLE_DIRECTED_ADV).
00325  * @param InitiatorAddrType Type of peer address (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
00326  * @param InitiatorAddr     Initiator's address (Little Endian).
00327  * @return Value indicating success or error code.
00328  */
00329 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);
00330 /**
00331  * @brief Set the Device in direct connectable mode (as defined in GAP specification Volume 3, Section 9.3.3).
00332  * @note  If the privacy is enabled, the reconnection address is used for advertising, otherwise the address
00333  *        of the type specified in OwnAddrType is used. The device will be in directed connectable mode only
00334  *        for 1.28 seconds. If no connection is established within this duration, the device enters non
00335  *        discoverable mode and advertising will have to be again enabled explicitly.
00336  *        The controller generates a @ref EVT_LE_CONN_COMPLETE event with the status set to @ref HCI_DIRECTED_ADV_TIMEOUT
00337  *        if the connection was not established and 0x00 if the connection was successfully established.
00338  *
00339  *        Usage example:
00340  *        @code
00341  *
00342  *        tBleStatus ret;
00343  *
00344  *        const uint8_t central_address = {0x43,0x27,0x84,0xE1,0x80,0x02};
00345  *        ret = aci_gap_set_direct_connectable_IDB04A1(PUBLIC_ADDR, PUBLIC_ADDR, central_address);
00346  *        @endcode
00347  *
00348  *
00349  *
00350  * @param OwnAddrType  Type of our address used during advertising (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
00351  * @param InitiatorAddrType Type of peer address (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
00352  * @param InitiatorAddr     Initiator's address (Little Endian).
00353  * @return Value indicating success or error code.
00354  */
00355 tBleStatus aci_gap_set_direct_connectable_IDB04A1(uint8_t own_addr_type, uint8_t initiator_addr_type, const uint8_t *initiator_addr);
00356 
00357 /**
00358  * @brief Set the IO capabilities of the device.
00359  * @note This command has to be given only when the device is not in a connected state.
00360  * @param io_capability One of the allowed codes for IO Capability:
00361  *        @arg @ref IO_CAP_DISPLAY_ONLY
00362  *        @arg @ref IO_CAP_DISPLAY_YES_NO
00363  *        @arg @ref IO_CAP_KEYBOARD_ONLY
00364  *        @arg @ref IO_CAP_NO_INPUT_NO_OUTPUT
00365  *        @arg @ref IO_CAP_KEYBOARD_DISPLAY
00366  * @return Value indicating success or error code.
00367  */
00368 tBleStatus aci_gap_set_io_capability(uint8_t io_capability);
00369 
00370 /**
00371  * @brief Set the authentication requirements for the device.
00372  * @note  If the oob_enable is set to 0, oob_data will be ignored.
00373  *        This command has to be given only when the device is not in a connected state.
00374  * @param mitm_mode MITM mode:
00375  *                  @arg @ref MITM_PROTECTION_NOT_REQUIRED
00376  *                  @arg @ref MITM_PROTECTION_REQUIRED
00377  * @param oob_enable If OOB data are present or not:
00378  *                   @arg @ref OOB_AUTH_DATA_ABSENT
00379  *                   @arg @ref OOB_AUTH_DATA_PRESENT
00380  * @param oob_data   Out-Of-Band data
00381  * @param min_encryption_key_size Minimum size of the encryption key to be used during the pairing process
00382  * @param max_encryption_key_size Maximum size of the encryption key to be used during the pairing process
00383  * @param use_fixed_pin If application wants to use a fixed pin or not:
00384  *                      @arg @ref USE_FIXED_PIN_FOR_PAIRING
00385  *                      @arg @ref DONOT_USE_FIXED_PIN_FOR_PAIRING
00386  *                      If a fixed pin is not used, it has to be provided by the application with
00387  *                      aci_gap_pass_key_response() after @ref EVT_BLUE_GAP_PASS_KEY_REQUEST event.
00388  * @param fixed_pin If use_fixed_pin is USE_FIXED_PIN_FOR_PAIRING, this is the value of the pin that will
00389  *                  be used during pairing if MIMT protection is enabled. Any value between 0 to 999999 is
00390  *                  accepted.
00391  * @param bonding_mode One of the bonding modes:
00392  *                     @arg @ref BONDING
00393  *                     @arg @ref NO_BONDING
00394  * @return Value indicating success or error code.
00395  */
00396 tBleStatus aci_gap_set_auth_requirement(uint8_t mitm_mode,
00397                                         uint8_t oob_enable,
00398                                         uint8_t oob_data[16],
00399                                         uint8_t min_encryption_key_size,
00400                                         uint8_t max_encryption_key_size,
00401                                         uint8_t use_fixed_pin,
00402                                         uint32_t fixed_pin,
00403                                         uint8_t bonding_mode);
00404  /**
00405   * @brief Set the authorization requirements of the device.
00406   * @note This command has to be given only when the device is not in a connected state.
00407   * @param conn_handle Handle of the connection in case BlueNRG is configured as a master (otherwise it can be also 0).
00408   * @param authorization_enable @arg @ref AUTHORIZATION_NOT_REQUIRED : Authorization not required
00409   *                             @arg @ref AUTHORIZATION_REQUIRED : Authorization required. This enables
00410   *                             the authorization requirement in the device and when a remote device
00411   *                             tries to connect to GATT server, @ref EVT_BLUE_GAP_AUTHORIZATION_REQUEST event
00412   *                             will be sent to the Host.
00413   *
00414   * @return Value indicating success or error code.
00415   */
00416 tBleStatus aci_gap_set_author_requirement(uint16_t conn_handle, uint8_t authorization_enable);
00417 
00418 /**
00419  * @brief Provide the pass key that will be used during pairing.
00420  * @note This command should be sent by the Host in response to @ref EVT_BLUE_GAP_PASS_KEY_REQUEST event.
00421  * @param conn_handle Connection handle
00422  * @param passkey     Pass key that will be used during the pairing process. Must be a number between
00423  *                    0 and 999999.
00424  * @return Value indicating success or error code.
00425  */
00426 tBleStatus aci_gap_pass_key_response(uint16_t conn_handle, uint32_t passkey);
00427 
00428 /**
00429  * @brief Authorize a device to access attributes.
00430  * @note Application should send this command after it has received a @ref EVT_BLUE_GAP_AUTHORIZATION_REQUEST.
00431  *
00432  * @param conn_handle Connection handle
00433  * @param authorize   @arg @ref CONNECTION_AUTHORIZED : Authorize (accept connection)
00434  *                    @arg @ref CONNECTION_REJECTED : Reject (reject connection)
00435  * @return Value indicating success or error code.
00436  */
00437 tBleStatus aci_gap_authorization_response(uint16_t conn_handle, uint8_t authorize);
00438 
00439 /**
00440  * @brief Put the device into non-connectable mode.
00441  * @param adv_type One of the allowed advertising types:
00442  *                 @arg @ref ADV_SCAN_IND : Scannable undirected advertising
00443  *                 @arg @ref ADV_NONCONN_IND : Non-connectable undirected advertising
00444  * @param own_address_type If Privacy is disabled, then the peripheral address can be
00445  *                         @arg @ref PUBLIC_ADDR.
00446  *                         @arg @ref STATIC_RANDOM_ADDR.
00447  *                         If Privacy is enabled, then the peripheral address can be 
00448  *                         @arg @ref RESOLVABLE_PRIVATE_ADDR
00449  *                         @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
00450  * @return Value indicating success or error code.
00451  */
00452 tBleStatus aci_gap_set_non_connectable_IDB05A1(uint8_t adv_type, uint8_t own_address_type);
00453 /**
00454  * @brief Put the device into non-connectable mode.
00455  * @param adv_type One of the allowed advertising types:
00456  *                 @arg @ref ADV_SCAN_IND : Scannable undirected advertising
00457  *                 @arg @ref ADV_NONCONN_IND : Non-connectable undirected advertising
00458  * @return Value indicating success or error code.
00459  */
00460 tBleStatus aci_gap_set_non_connectable_IDB04A1(uint8_t adv_type);
00461 
00462 /**
00463  * @brief Put the device into undirected connectable mode.
00464  * @note  If privacy is enabled in the device, a resolvable private address is generated and used
00465  *        as the advertiser's address. If not, the address of the type specified in own_addr_type
00466  *        is used for advertising.
00467  * @param own_addr_type Type of our address used during advertising:
00468  *                      if BLUENRG (IDB04A1)
00469  *                      @arg @ref PUBLIC_ADDR.
00470  *                      @arg @ref STATIC_RANDOM_ADDR.
00471  *                      else if BLUENRG_MS (IDB05A1)
00472  *                      If Privacy is disabled:
00473  *                      @arg @ref PUBLIC_ADDR.
00474  *                      @arg @ref STATIC_RANDOM_ADDR.
00475  *                      If Privacy is enabled:
00476  *                      @arg @ref RESOLVABLE_PRIVATE_ADDR
00477  *                      @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
00478  * @param adv_filter_policy  Filter policy:
00479  *                         @arg @ref NO_WHITE_LIST_USE
00480  *                         @arg @ref WHITE_LIST_FOR_ALL
00481  * @return Value indicating success or error code.
00482  */
00483 tBleStatus aci_gap_set_undirected_connectable(uint8_t own_addr_type, uint8_t adv_filter_policy);
00484 
00485 /**
00486  * @brief Send a slave security request to the master.
00487  * @note This command has to be issued to notify the master of the security requirements of the slave.
00488  *       The master may encrypt the link, initiate the pairing procedure, or reject the request.
00489  * @param conn_handle Connection handle
00490  * @param bonding      One of the bonding modes:
00491  *                     @arg @ref BONDING
00492  *                     @arg @ref NO_BONDING
00493  * @param mitm_protection  If MITM protection is required or not:
00494  *                         @arg @ref MITM_PROTECTION_NOT_REQUIRED
00495  *                         @arg @ref MITM_PROTECTION_REQUIRED
00496  * @return Value indicating success or error code.
00497  */
00498 tBleStatus aci_gap_slave_security_request(uint16_t conn_handle, uint8_t bonding, uint8_t mitm_protection);
00499 
00500 /**
00501  * @brief Update advertising data.
00502  * @note This command can be used to update the advertising data for a particular AD type.
00503  *       If the AD type specified does not exist, then it is added to the advertising data.
00504  *       If the overall advertising data length is more than 31 octets after the update, then
00505  *       the command is rejected and the old data is retained.
00506  * @param AdvLen Length of AdvData array
00507  * @param AdvData Advertisement Data,  formatted as specified in Bluetooth specification
00508  *        (Volume 3, Part C, 11), including data length. It can contain more than one AD type.
00509  *        Example
00510  * @code
00511  *  tBleStatus ret;
00512  *  const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
00513  *  const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
00514  *  const uint8_t manuf_data[] = {4, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0x05, 0x02, 0x01};
00515  *
00516  *  ret = aci_gap_set_discoverable(ADV_IND, 0, 0, STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
00517  *                                 8, local_name, 3, serviceUUIDList, 0, 0);
00518  *  ret = aci_gap_update_adv_data(5, manuf_data);
00519  * @endcode
00520  *
00521  * @return Value indicating success or error code.
00522  */
00523 tBleStatus aci_gap_update_adv_data(uint8_t AdvLen, const uint8_t *AdvData);
00524 
00525 /**
00526  * @brief Delete an AD Type
00527  * @note This command can be used to delete the specified AD type from the advertisement data if
00528  *       present.
00529  * @param ad_type One of the allowed AD types (see @ref AD_Types)
00530  * @return Value indicating success or error code.
00531  */
00532 tBleStatus aci_gap_delete_ad_type(uint8_t ad_type);
00533 
00534 /**
00535  * @brief Get the current security settings
00536  * @note This command can be used to get the current security settings of the device.
00537  * @param mitm_protection   @arg 0: Not required
00538  *                          @arg 1: Required
00539  * @param bonding           @arg 0: No bonding mode
00540  *                          @arg 1: Bonding mode
00541  * @param oob_data          @arg 0: Data absent
00542  *                          @arg 1: Data present
00543  * @param passkey_required  @arg 0: Not required
00544  *                          @arg 1: Fixed pin is present which is being used
00545  *                          @arg 2: Passkey required for pairing. An event will be generated
00546  *                          when required.
00547  * @return Value indicating success or error code.
00548  */
00549 tBleStatus aci_gap_get_security_level(uint8_t* mitm_protection, uint8_t* bonding,
00550                                       uint8_t* oob_data, uint8_t* passkey_required);
00551 
00552 /**
00553  * @brief Add addresses of bonded devices into the controller's whitelist.
00554  * @note  The command will return an error if there are no devices in the database or if it was unable
00555  *        to add the device into the whitelist.
00556  * @return Value indicating success or error code.
00557  */
00558 tBleStatus aci_gap_configure_whitelist(void);
00559 
00560 /**
00561  * @brief Terminate a connection.
00562  * @note  A @ref EVT_DISCONN_COMPLETE event will be generated when the link is disconnected.
00563  * @param conn_handle Connection handle
00564  * @param reason  Reason for requesting disconnection. The error code can be any of ones as specified
00565  *                for the disconnected command in the HCI specification (See @ref HCI_Error_codes).
00566  * @return Value indicating success or error code.
00567  */
00568 tBleStatus aci_gap_terminate(uint16_t conn_handle, uint8_t reason);
00569 
00570 /**
00571  * @brief Clear the security database.
00572  * @note  All the devices in the security database will be removed.
00573  * @return Value indicating success or error code.
00574  */
00575 tBleStatus aci_gap_clear_security_database(void);
00576 
00577 /**
00578  * @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
00579  * @note This command can be issued by the application if a @ref EVT_BLUE_GAP_BOND_LOST event is generated.
00580  * @param conn_handle 
00581  * @return Value indicating success or error code.
00582  */
00583 tBleStatus aci_gap_allow_rebond_IDB05A1(uint16_t conn_handle);
00584 /**
00585  * @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
00586  * @note This command can be issued by the application if a @ref EVT_BLUE_GAP_BOND_LOST event is generated.
00587  * @return Value indicating success or error code.
00588  */
00589 tBleStatus aci_gap_allow_rebond_IDB04A1(void);
00590 
00591 /**
00592  * @brief Start the limited discovery procedure.
00593  * @note  The controller is commanded to start active scanning. When this procedure is started,
00594  *        only the devices in limited discoverable mode are returned to the upper layers.
00595  *        The procedure is terminated when either the upper layers issue a command to terminate the
00596  *        procedure by issuing the command aci_gap_terminate_gap_procedure() with the procedure code
00597  *        set to @ref GAP_LIMITED_DISCOVERY_PROC or a timeout happens. When the procedure is terminated
00598  *        due to any of the above  reasons, @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with
00599  *        the procedure code set to @ref GAP_LIMITED_DISCOVERY_PROC.
00600  *        The device found when the procedure is ongoing is returned to the upper layers through the
00601  *        event @ref EVT_BLUE_GAP_DEVICE_FOUND (for IDB04A1) and @ref EVT_LE_ADVERTISING_REPORT (for IDB05A1).
00602  * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
00603  *                     the subsequent LE scan. The scan interval should be a number in the range
00604  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00605  *                     For a number N, Time = N x 0.625 msec.
00606  * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
00607  *                   or equal to Scan_Interval. The scan window should be a number in the range
00608  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00609  *                   For a number N, Time = N x 0.625 msec.
00610  * @param own_address_type Type of our address used during advertising (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
00611  * @param filterDuplicates Duplicate filtering enabled or not.
00612  *                         @arg 0x00: Do not filter the duplicates
00613  *                         @arg 0x01: Filter duplicates
00614  *
00615  * @return Value indicating success or error code.
00616  */
00617 tBleStatus aci_gap_start_limited_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
00618                         uint8_t own_address_type, uint8_t filterDuplicates);
00619 
00620 /**
00621  * @brief Start the general discovery procedure.
00622  * @note  The controller is commanded to start active scanning. The procedure is terminated when
00623  *        either the upper layers issue a command to terminate the procedure by issuing the command
00624  *        aci_gap_terminate_gap_procedure() with the procedure code set to GAP_GENERAL_DISCOVERY_PROC
00625  *        or a timeout happens. When the procedure is terminated due to any of the above reasons,
00626  *        @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with the procedure code set to
00627  *        @ref GAP_GENERAL_DISCOVERY_PROC. The device found when the procedure is ongoing is returned to
00628  *        the upper layers through the event @ref EVT_BLUE_GAP_DEVICE_FOUND (for IDB04A1) and @ref EVT_LE_ADVERTISING_REPORT (for IDB05A1).
00629  * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
00630  *                     the subsequent LE scan. The scan interval should be a number in the range
00631  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00632  *                     For a number N, Time = N x 0.625 msec.
00633  * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
00634  *                   or equal to Scan_Interval. The scan window should be a number in the range
00635  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00636  *                   For a number N, Time = N x 0.625 msec.
00637  * @param own_address_type Type of our address used during advertising (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
00638  * @param filterDuplicates Duplicate filtering enabled or not.
00639  *                         @arg 0x00: Do not filter the duplicates
00640  *                         @arg 0x01: Filter duplicates
00641  *
00642  * @return Value indicating success or error code.
00643  */
00644 tBleStatus aci_gap_start_general_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
00645                         uint8_t own_address_type, uint8_t filterDuplicates);
00646 
00647 /**
00648  * @brief Start the name discovery procedure.
00649  * @note  A LE_Create_Connection call will be made to the controller by GAP with the initiator filter
00650  *        policy set to “ignore whitelist and process connectable advertising packets only for the
00651  *        specified device”. Once a connection is established, GATT procedure is started to read the
00652  *        device name characteristic. When the read is completed (successfully or unsuccessfully),
00653  *        a @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is given to the upper layer. The event also
00654  *        contains the name of the device if the device name was read successfully.
00655  * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
00656  *                     the subsequent LE scan. The scan interval should be a number in the range
00657  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00658  *                     For a number N, Time = N x 0.625 msec.
00659  * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
00660  *                   or equal to Scan_Interval. The scan window should be a number in the range
00661  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00662  *                   For a number N, Time = N x 0.625 msec.
00663  * @param peer_bdaddr_type Type of the peer address (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
00664  * @param peer_bdaddr Address of the peer device with which a connection has to be established.
00665  * @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
00666  * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
00667  *                          equal to Conn_Interval_Max.\n
00668  *                          Range: 0x0006 to 0x0C80\n
00669  *                          Time = N x 1.25 msec\n
00670  *                          Time Range: 7.5 msec to 4 seconds
00671  * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
00672  *                          equal to Conn_Interval_Min.\n
00673  *                          Range: 0x0006 to 0x0C80\n
00674  *                          Time = N x 1.25 msec\n
00675  *                          Time Range: 7.5 msec to 4 seconds
00676  * @param conn_latency Slave latency for the connection in number of connection events.\n
00677  *                       Range: 0x0000 to 0x01F4
00678  * @param supervision_timeout Supervision timeout for the LE Link.\n
00679  *                            Range: 0x000A to 0x0C80\n
00680  *                            Time = N x 10 msec\n
00681  *                            Time Range: 100 msec to 32 seconds
00682  * @param min_conn_length Minimum length of connection needed for the LE connection.\n
00683  *                        Range: 0x0000 - 0xFFFF\n
00684  *                        Time = N x 0.625 msec.
00685  * @param max_conn_length Maximum length of connection needed for the LE connection.\n
00686  *                        Range: 0x0000 - 0xFFFF\n
00687  *                        Time = N x 0.625 msec.
00688  * @return Value indicating success or error code.
00689  */
00690 tBleStatus aci_gap_start_name_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
00691                      uint8_t peer_bdaddr_type, tBDAddr peer_bdaddr, 
00692                      uint8_t own_bdaddr_type, uint16_t conn_min_interval,   
00693                      uint16_t conn_max_interval, uint16_t conn_latency, 
00694                      uint16_t supervision_timeout, uint16_t min_conn_length, 
00695                      uint16_t max_conn_length);
00696 
00697 /**
00698  * @brief Start the auto connection establishment procedure.
00699  * @note The devices specified are added to the white list of the controller and a LE_Create_Connection
00700  *       call will be made to the controller by GAP with the initiator filter policy set to
00701  *       “use whitelist to determine which advertiser to connect to”. When a command is issued to
00702  *       terminate the procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the
00703  *       controller by GAP.
00704  *       The procedure is terminated when either a connection is successfully established with one of
00705  *       the specified devices in the white list or the procedure is explicitly terminated by issuing
00706  *       the command aci_gap_terminate_gap_procedure() with the procedure code set to
00707  *       @ref GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC. A @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with
00708  *       the procedure code set to @ref GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC.
00709  * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
00710  *                     the subsequent LE scan. The scan interval should be a number in the range
00711  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00712  *                     For a number N, Time = N x 0.625 msec.
00713  * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
00714  *                   or equal to Scan_Interval. The scan window should be a number in the range
00715  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00716  *                   For a number N, Time = N x 0.625 msec.
00717  * @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
00718  * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
00719  *                          equal to Conn_Interval_Max.\n
00720  *                          Range: 0x0006 to 0x0C80\n
00721  *                          Time = N x 1.25 msec\n
00722  *                          Time Range: 7.5 msec to 4 seconds
00723  * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
00724  *                          equal to Conn_Interval_Min.\n
00725  *                          Range: 0x0006 to 0x0C80\n
00726  *                          Time = N x 1.25 msec\n
00727  *                          Time Range: 7.5 msec to 4 seconds
00728  * @param conn_latency Slave latency for the connection in number of connection events.\n
00729  *                       Range: 0x0000 to 0x01F4
00730  * @param supervision_timeout Supervision timeout for the LE Link.\n
00731  *                            Range: 0x000A to 0x0C80\n
00732  *                            Time = N x 10 msec\n
00733  *                            Time Range: 100 msec to 32 seconds
00734  * @param min_conn_length Minimum length of connection needed for the LE connection.\n
00735  *                        Range: 0x0000 - 0xFFFF\n
00736  *                        Time = N x 0.625 msec.
00737  * @param max_conn_length Maximum length of connection needed for the LE connection.\n
00738  *                        Range: 0x0000 - 0xFFFF\n
00739  *                        Time = N x 0.625 msec.
00740  * @cond BLUENRG
00741  * @param use_reconn_addr If 1, the provided reconnection address is used as our address during the procedure (the address
00742  *                        has been previously notified to the application through @ref EVT_BLUE_GAP_RECONNECTION_ADDRESS event).\n
00743  * @param reconn_addr   Reconnection address used if use_reconn_addr is 1.
00744  * @endcond
00745  * @param num_whitelist_entries Number of devices that have to be added to the whitelist.
00746  * @param addr_array addr_array will contain the addresses that have to be added into the whitelist. The
00747  *                   format of the addr_array should be: address type followed by address.
00748  *                   Example:
00749  *                   @code
00750  *                   uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
00751  *                      PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
00752  *                   @endcode
00753  * @return Value indicating success or error code.
00754  */
00755 tBleStatus aci_gap_start_auto_conn_establish_proc_IDB05A1(uint16_t scanInterval, uint16_t scanWindow,
00756                          uint8_t own_bdaddr_type, uint16_t conn_min_interval,   
00757                          uint16_t conn_max_interval, uint16_t conn_latency, 
00758                          uint16_t supervision_timeout, uint16_t min_conn_length, 
00759                          uint16_t max_conn_length,
00760                          uint8_t num_whitelist_entries,
00761                          const uint8_t *addr_array);
00762 tBleStatus aci_gap_start_auto_conn_establish_proc_IDB04A1(uint16_t scanInterval, uint16_t scanWindow,
00763                          uint8_t own_bdaddr_type, uint16_t conn_min_interval,   
00764                          uint16_t conn_max_interval, uint16_t conn_latency, 
00765                          uint16_t supervision_timeout, uint16_t min_conn_length, 
00766                          uint16_t max_conn_length,
00767                                                  uint8_t use_reconn_addr,
00768                                                  const tBDAddr reconn_addr,
00769                                                  uint8_t num_whitelist_entries,
00770                                                  const uint8_t *addr_array);
00771 
00772 /**
00773  * @brief Start a general connection establishment procedure.
00774  * @note  The host enables scanning in the controller with the scanner filter policy set
00775  *        to “accept all advertising packets” and from the scanning results all the devices
00776  *        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).
00777  *        The upper layer then has to select one of the devices to which it wants to connect
00778  *        by issuing the command aci_gap_create_connection(). The procedure is terminated
00779  *        when a connection is established or the upper layer terminates the procedure by
00780  *        issuing the command aci_gap_terminate_gap_procedure() with the procedure code set to
00781  *        @ref GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC. On completion of the procedure a
00782  *        @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is generated with the procedure code set to
00783  *        @ref GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC.
00784  * @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
00785  * @param scan_interval Time interval from when the Controller started its last LE scan until it begins
00786  *                     the subsequent LE scan. The scan interval should be a number in the range
00787  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00788  *                     For a number N, Time = N x 0.625 msec.
00789  * @param scan_window Amount of time for the duration of the LE scan. Scan_Window shall be less than
00790  *                   or equal to Scan_Interval. The scan window should be a number in the range
00791  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00792  *                   For a number N, Time = N x 0.625 msec.
00793  * @param own_address_type Type of our address used during active scanning (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
00794  * @param filter_duplicates Duplicate filtering enabled or not.
00795  *                         @arg 0x00: Do not filter the duplicates
00796  *                         @arg 0x01: Filter duplicates
00797  * @cond BLUENRG
00798  * @param use_reconn_addr If 1, the provided reconnection address is used as our address during the procedure (the address
00799  *                        has been previously notified to the application through @ref EVT_BLUE_GAP_RECONNECTION_ADDRESS event).\n
00800  * @param reconn_addr   Reconnection address used if use_reconn_addr is 1.
00801  * @endcond
00802  *
00803  * @return Value indicating success or error code.
00804  */
00805 tBleStatus aci_gap_start_general_conn_establish_proc_IDB05A1(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
00806                          uint8_t own_address_type, uint8_t filter_duplicates);
00807 tBleStatus aci_gap_start_general_conn_establish_proc_IDB04A1(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
00808                          uint8_t own_address_type, uint8_t filter_duplicates, uint8_t use_reconn_addr, const tBDAddr reconn_addr);
00809 
00810 /**
00811  * @brief Start a selective connection establishment procedure.
00812  * @note  The GAP adds the specified device addresses into white list and enables scanning in
00813  *        the controller with the scanner filter policy set to “accept packets only from
00814  *        devices in whitelist”. All the devices found are sent to the upper layer by the
00815  *        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
00816  *        devices to which it wants to connect by issuing the command aci_gap_create_connection().
00817  *        On completion of the procedure a  @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is generated
00818  *        with the procedure code set to @ref GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC.
00819  *        The procedure is terminated when a connection is established or the upper layer terminates
00820  *        the procedure by issuing the command aci_gap_terminate_gap_procedure with the procedure
00821  *        code set to @ref GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC.
00822  * @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
00823  * @param scan_interval Time interval from when the Controller started its last LE scan until it begins
00824  *                     the subsequent LE scan. The scan interval should be a number in the range
00825  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00826  *                     For a number N, Time = N x 0.625 msec.
00827  * @param scan_window Amount of time for the duration of the LE scan. Scan_Window shall be less than
00828  *                   or equal to Scan_Interval. The scan window should be a number in the range
00829  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00830  *                   For a number N, Time = N x 0.625 msec.
00831  * @param own_address_type Type of our address used during active scanning (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
00832  * @param filter_duplicates Duplicate filtering enabled or not.
00833  *                         @arg 0x00: Do not filter the duplicates
00834  *                         @arg 0x01: Filter duplicates
00835  * @param num_whitelist_entries Number of devices that have to be added to the whitelist.
00836  * @param addr_array addr_array will contain the addresses that have to be added into the whitelist. The
00837  *                   format of the addr_array should be: address type followed by address.
00838  *                   Example:
00839  *                   @code
00840  *                   uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
00841  *                      PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
00842  *                   @endcode
00843  *
00844  * @return Value indicating success or error code.
00845  */
00846 tBleStatus aci_gap_start_selective_conn_establish_proc(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
00847                          uint8_t own_address_type, uint8_t filter_duplicates, uint8_t num_whitelist_entries,
00848                          const uint8_t *addr_array);
00849 
00850 /**
00851  * @brief Start the direct connection establishment procedure.
00852  * @note  A LE_Create_Connection call will be made to the controller by GAP with the initiator filter
00853  *        policy set to “ignore whitelist and process connectable advertising packets only for the
00854  *        specified device”. The procedure can be terminated explicitly by the upper layer by issuing
00855  *        the command aci_gap_terminate_gap_procedure(). When a command is issued to terminate the
00856  *        procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the controller
00857  *        by GAP.
00858  *        On termination of the procedure, a @ref EVT_LE_CONN_COMPLETE event is returned. The procedure can
00859  *        be explicitly terminated by the upper layer by issuing the command
00860  *        aci_gap_terminate_gap_procedure() with the procedure_code set to @ref GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC.
00861  * @param scanInterval Time interval from when the Controller started its last LE scan until it begins
00862  *                     the subsequent LE scan. The scan interval should be a number in the range
00863  *                     0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00864  *                     For a number N, Time = N x 0.625 msec.
00865  * @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
00866  *                   or equal to Scan_Interval. The scan window should be a number in the range
00867  *                   0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
00868  *                   For a number N, Time = N x 0.625 msec.
00869  * @param peer_bdaddr_type Type of the peer address (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
00870  * @param peer_bdaddr Address of the peer device with which a connection has to be established.
00871  * @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
00872  * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
00873  *                          equal to Conn_Interval_Max.\n
00874  *                          Range: 0x0006 to 0x0C80\n
00875  *                          Time = N x 1.25 msec\n
00876  *                          Time Range: 7.5 msec to 4 seconds
00877  * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
00878  *                          equal to Conn_Interval_Min.\n
00879  *                          Range: 0x0006 to 0x0C80\n
00880  *                          Time = N x 1.25 msec\n
00881  *                          Time Range: 7.5 msec to 4 seconds
00882  * @param conn_latency Slave latency for the connection in number of connection events.\n
00883  *                       Range: 0x0000 to 0x01F4
00884  * @param supervision_timeout Supervision timeout for the LE Link.\n
00885  *                            Range: 0x000A to 0x0C80\n
00886  *                            Time = N x 10 msec\n
00887  *                            Time Range: 100 msec to 32 seconds
00888  * @param min_conn_length Minimum length of connection needed for the LE connection.\n
00889  *                        Range: 0x0000 - 0xFFFF\n
00890  *                        Time = N x 0.625 msec.
00891  * @param max_conn_length Maximum length of connection needed for the LE connection.\n
00892  *                        Range: 0x0000 - 0xFFFF\n
00893  *                        Time = N x 0.625 msec.
00894  * @return Value indicating success or error code.
00895  */
00896 tBleStatus aci_gap_create_connection(uint16_t scanInterval, uint16_t scanWindow,
00897                      uint8_t peer_bdaddr_type, tBDAddr peer_bdaddr, 
00898                      uint8_t own_bdaddr_type, uint16_t conn_min_interval,   
00899                      uint16_t conn_max_interval, uint16_t conn_latency, 
00900                      uint16_t supervision_timeout, uint16_t min_conn_length, 
00901                      uint16_t max_conn_length);
00902 
00903 /**
00904  * @brief Terminate the specified GAP procedure. @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is
00905  *        returned with the procedure code set to the corresponding procedure.
00906  * @param procedure_code One of the procedure codes (@ref gap_procedure_codes "GAP procedure codes").
00907  * @return Value indicating success or error code.
00908  */
00909 tBleStatus aci_gap_terminate_gap_procedure(uint8_t procedure_code);
00910 
00911 /**
00912  * @brief Start the connection parameter update procedure.
00913  * @note  Allowed by the Central to update the connection parameter of the specified connection.
00914  *        A Link Layer Connection Update procedure is started on the controller.
00915  *        On completion of the procedure, a @ref EVT_LE_CONN_UPDATE_COMPLETE event is returned to
00916  *        the upper layer.
00917  * @param conn_handle Handle of the connection for which the update procedure has to be started.
00918  * @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
00919  *                          equal to Conn_Interval_Max.\n
00920  *                          Range: 0x0006 to 0x0C80\n
00921  *                          Time = N x 1.25 msec\n
00922  *                          Time Range: 7.5 msec to 4 seconds
00923  * @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
00924  *                          equal to Conn_Interval_Min.\n
00925  *                          Range: 0x0006 to 0x0C80\n
00926  *                          Time = N x 1.25 msec\n
00927  *                          Time Range: 7.5 msec to 4 seconds
00928  * @param conn_latency Slave latency for the connection in number of connection events.\n
00929  *                       Range: 0x0000 to 0x01F4
00930  * @param supervision_timeout Supervision timeout for the LE Link.\n
00931  *                            Range: 0x000A to 0x0C80\n
00932  *                            Time = N x 10 msec\n
00933  *                            Time Range: 100 msec to 32 seconds
00934  * @param min_conn_length Minimum length of connection needed for the LE connection.\n
00935  *                        Range: 0x0000 - 0xFFFF\n
00936  *                        Time = N x 0.625 msec.
00937  * @param max_conn_length Maximum length of connection needed for the LE connection.\n
00938  *                        Range: 0x0000 - 0xFFFF\n
00939  *                        Time = N x 0.625 msec.
00940  * @return Value indicating success or error code.
00941  */
00942 tBleStatus aci_gap_start_connection_update(uint16_t conn_handle, uint16_t conn_min_interval,    
00943                                            uint16_t conn_max_interval, uint16_t conn_latency,   
00944                                            uint16_t supervision_timeout, uint16_t min_conn_length, 
00945                                            uint16_t max_conn_length);
00946 
00947 /**
00948  * @brief Send a pairing request.
00949  * @note  Send the SM pairing request to start a pairing process from a Central. The authentication
00950  *        requirements and  IO capabilities should be set before issuing this command using
00951  *        aci_gap_set_io_capability() and aci_gap_set_auth_requirement().
00952  *        A @ref EVT_BLUE_GAP_PAIRING_CMPLT event is returned after the pairing process is completed.
00953  * @param conn_handle Handle of the connection for which the pairing request has to be sent.
00954  * @param force_rebond  @arg 0x00: Pairing request is sent only if the device has not previously bonded
00955  *                      @arg 0x01: Pairing request will be sent even if the device was previously bonded
00956  * @return Value indicating success or error code.
00957  */
00958 tBleStatus aci_gap_send_pairing_request(uint16_t conn_handle, uint8_t force_rebond);
00959 
00960 /**
00961  * @brief Resolve a private address.
00962  * @note  This command tries to resolve the address provided with the IRKs present in its database. If
00963  *        the address is resolved successfully with any one of the IRKs present in the database, it
00964  *        returns success.
00965  * @param address Address to be resolved.
00966  * @param[in] actual_address The public or static random address of the peer device, distributed during pairing phase.
00967  * @return Value indicating success or error code.
00968  */
00969 tBleStatus aci_gap_resolve_private_address_IDB05A1(const tBDAddr private_address, tBDAddr actual_address);
00970 
00971 /**
00972  * @brief Resolve a private address.
00973  * @note  This command tries to resolve the address provided with the IRKs present in its database. If
00974  *        the address is resolved successfully with any one of the IRKs present in the database, it
00975  *        returns success.
00976  * @param address Address to be resolved.
00977  * @return Value indicating success or error code.
00978  */
00979 tBleStatus aci_gap_resolve_private_address_IDB04A1(const tBDAddr private_address);
00980 
00981 /**
00982  * @brief This command gets the list of bonded devices.
00983  * @note  It returns the number of addresses and the corresponding address types and values.
00984  *        Example:
00985  *        @code
00986  *        tBleStatus ret;
00987  *        uint8_t num_devices = 0;
00988  *        uint8_t device_list[12*7];
00989  *        ret = aci_gap_get_bonded_devices(&num_devices, device_list, sizeof(device_list));
00990  *        for(int i = 0; i < num_devices; i+=7){
00991  *          uint8_t addr_type = device_list[i];
00992  *          uint8_t addr = device_list[i+1];
00993  *          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]);
00994  *        }
00995  *        @endcode
00996  *
00997  * @param[in] num_devices The number of bonded devices.
00998  * @param[in] device_list List of addresses. It contains a sequence of [address type, address] pairs, where address
00999  *                        type can be @ref PUBLIC_ADDR or @arg @ref STATIC_RANDOM_ADDR.
01000  * @param device_list_size Maximum size of the device_list buffer used to return the device list.
01001  * @return Value indicating success or error code.
01002  */
01003 tBleStatus aci_gap_get_bonded_devices(uint8_t *num_devices, uint8_t *device_list, uint8_t device_list_size);
01004 
01005 /**
01006  * @brief Puts the device into broadcast mode
01007  * @note  A privacy enabled device uses either a resolvable private address or a non-resolvable private address
01008  *        as specified in the own_addr_type parameter of the command.
01009  * @param adv_interv_min    Minimum advertising interval.
01010  *                          Range: 0x00A0 to 0x4000
01011  *                          Time = N * 0.625 msec
01012  *                          Time Range: 100 ms to 10.24 sec
01013  * @param adv_interv_max    Maximum advertising interval.
01014  *                          Range: 0x00A0 to 0x4000
01015  *                          Time = N * 0.625 msec
01016  *                          Time Range: 100 ms to 10.24 sec
01017  * @param adv_type One of the allowed advertising types:
01018  *                @arg @ref ADV_SCAN_IND Scannable undirected advertising
01019  *                @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
01020  * @param own_address_type If Privacy is disabled, the broadcaster address can be
01021  *                         @arg @ref PUBLIC_ADDR.
01022  *                         @arg @ref STATIC_RANDOM_ADDR.
01023  *                         If Privacy is enabled, then the broadcaster address can be
01024  *                         @arg @ref RESOLVABLE_PRIVATE_ADDR
01025  *                         @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
01026  * @param adv_data_length Length of the advertising data in the advertising packet
01027  * @param adv_data        Advertising data used by the device while advertising
01028  * @param num_whitelist_entries Number of devices to be added to whitelist
01029  * @param addr_array It will contain the addresses that have to be added into the whitelist. The
01030  *                   format of the addr_array should be: address type followed by address.
01031  *                   Example:
01032  *                   @code
01033  *                   uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
01034  *                      PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
01035  *                   @endcode
01036  * @return Value indicating success or error code.
01037  */
01038 tBleStatus aci_gap_set_broadcast_mode_IDB05A1(uint16_t adv_interv_min, uint16_t adv_interv_max, uint8_t adv_type,
01039                                       uint8_t own_addr_type, uint8_t adv_data_length, const uint8_t *adv_data,  uint8_t num_whitelist_entries,
01040                                       const uint8_t *addr_array);
01041 
01042 /**
01043  * @brief Starts an observation procedure, when the device is in Observer role.
01044  * @note  The host enables scanning in the controller. The advertising reports are sent to the upper layer
01045  *        using standard @ref EVT_LE_ADVERTISING_REPORT subevent in @ref EVT_LE_META_EVENT. See Bluetooth
01046  *        Core v4.0, Vol. 2, part E, Ch. 7.7.65.2, LE Advertising Report Event.
01047  * @param scan_interval Time interval from when the Controller started its last LE scan until it begins the subsequent LE scan.
01048  *        The scan interval should be a number in the range 0x0004 to 0x4000. This corresponds to a time range from 2.5 msec
01049  *        to 10240 msec. For a number N, Time = N * 0.625 msec.
01050  * @param scan_window Amount of time for the duration of the LE scan. scan_window shall be less than or equal to scan_interval.
01051  *        The scan window should be a number in the range 0x0004 to 0x4000. This corresponds to a time range from 2.5 msec
01052  *        to 10240 msec. For a number N, Time = N * 0.625 msec.
01053  * @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
01054  * @param own_address_type If Privacy is disabled, then the scanner address can be
01055  *                         @arg @ref PUBLIC_ADDR.
01056  *                         @arg @ref STATIC_RANDOM_ADDR.
01057  *                         If Privacy is enabled, then the scanner address can be
01058  *                         @arg @ref RESOLVABLE_PRIVATE_ADDR
01059  *                         @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
01060  * @param filter_duplicates Duplicate filtering enabled or not.
01061  *                         @arg 0x00: Do not filter the duplicates
01062  *                         @arg 0x01: Filter duplicates
01063  * @return Value indicating success or error code.
01064  */
01065 tBleStatus aci_gap_start_observation_procedure(uint16_t scan_interval, uint16_t scan_window, uint8_t scan_type,
01066                          uint8_t own_address_type, uint8_t filter_duplicates);
01067 
01068 /**
01069  * @brief The command finds whether a device is bonded.
01070  * @note If the device is using a resolvable private address and it has been bonded, then the command will return
01071  *       BLE_STATUS_SUCCESS.
01072  * @param peer_address_type The address type of the peer device
01073  *                         @arg @ref PUBLIC_ADDR.
01074  *                         @arg @ref RANDOM_ADDR.
01075  * @param peer_address Address used by the peer device while advertising.
01076  * @return Value indicating success or error code.
01077  */
01078 tBleStatus aci_gap_is_device_bonded_IDB05A1(uint8_t peer_address_type, const tBDAddr peer_address);
01079 
01080 
01081 /**
01082  * @}
01083  */
01084 
01085 /**
01086  * @defgroup GAP_Events GAP events
01087  * @{
01088  */
01089 
01090 /**
01091  * This event is generated by the controller when the limited discoverable
01092  *  mode ends due to timeout (180 seconds). No parameters in the event.
01093  */
01094 #define EVT_BLUE_GAP_LIMITED_DISCOVERABLE     (0x0400)
01095 
01096 
01097 /**
01098  * This event is generated when the pairing process has completed successfully
01099  * or a pairing procedure timeout has occurred or the pairing has failed.
01100  * This is to notify the application that we have paired with a remote device
01101  * so that it can take further actions or to notify that a timeout has occurred
01102  *  so that the upper layer can decide to disconnect the link. See @ref _evt_gap_pairing_cmplt.
01103  */
01104 #define EVT_BLUE_GAP_PAIRING_CMPLT                (0x0401)
01105 typedef __packed struct _evt_gap_pairing_cmplt{
01106   uint16_t conn_handle; /**< Connection handle on which the pairing procedure completed */
01107   /**
01108    * 0x00: Pairing Success. Pairing with a remote device was successful\n
01109    * 0x01: Pairing Timeout. The SMP timeout has elapsed and no further SMP commands will be processed until reconnection\n
01110    * 0x02: Pairing Failed. The pairing failed with the remote device.
01111    */
01112   uint8_t  status;
01113 } PACKED evt_gap_pairing_cmplt;
01114 
01115 
01116 /**
01117  * This event is generated by the Security manager to the application when a pass key is required for pairing.
01118  * When this event is received, the application has to respond with the aci_gap_pass_key_response() command.
01119  * See @ref _evt_gap_pass_key_req.
01120  */
01121 #define EVT_BLUE_GAP_PASS_KEY_REQUEST             (0x0402)
01122 typedef __packed struct _evt_gap_pass_key_req{
01123   uint16_t conn_handle; /**< Connection handle for which the passkey has been requested. */
01124 } PACKED evt_gap_pass_key_req;
01125 
01126 
01127 /**
01128  * This event is generated by the Security manager to the application when the application
01129  * has set that authorization is required for reading/writing of attributes. This event will
01130  * be generated as soon as the pairing is complete. When this event is received,
01131  * aci_gap_authorization_response() command should be used by the application.
01132  * See @ref _evt_gap_author_req.
01133  */
01134 #define EVT_BLUE_GAP_AUTHORIZATION_REQUEST        (0x0403)
01135 typedef __packed struct _evt_gap_author_req{
01136   uint16_t conn_handle; /**< Connection handle for which authorization has been requested. */
01137 } PACKED evt_gap_author_req;
01138 
01139 /**
01140  * This event is generated when the slave security request is successfully sent to the master.
01141  * No parameters for this event.
01142  */
01143 #define EVT_BLUE_GAP_SLAVE_SECURITY_INITIATED     (0X0404)
01144 
01145 /**
01146  * This event is generated when a pairing request is issued in response to a slave security
01147  * request from a master which has previously bonded with the slave. When this event is received,
01148  * the upper layer has to issue the command aci_gap_allow_rebond() in order to allow the slave
01149  * to continue the pairing process with the master. No parameters for this event
01150  */
01151 #define EVT_BLUE_GAP_BOND_LOST                    (0X0405)
01152 
01153 /**
01154  * The event is given by the GAP layer to the upper layers when a device is discovered during scanning
01155  * as a consequence of one of the GAP procedures started by the upper layers. See @ref _evt_gap_device_found.
01156  */
01157 #define EVT_BLUE_GAP_DEVICE_FOUND                 (0x0406)
01158 typedef __packed struct _evt_gap_device_found{
01159     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) */
01160     uint8_t     bdaddr_type;  /**< Type of the peer address (@ref PUBLIC_ADDR, @ref RANDOM_ADDR). */
01161     tBDAddr     bdaddr;       /**< Address of the peer device found during scanning. */
01162     uint8_t     data_length;  /**< Length of advertising or scan response data. */
01163     uint8_t     data_RSSI[VARIABLE_SIZE]; /**< Advertising or scan response data + RSSI. RSSI is last octect (signed integer). */
01164 } PACKED evt_gap_device_found;
01165 
01166 /**
01167  * This event is sent by the GAP to the upper layers when a procedure previously started has been terminated
01168  * by the upper layer or has completed for any other reason. See @ref _evt_gap_procedure_complete.
01169  */
01170 #define EVT_BLUE_GAP_PROCEDURE_COMPLETE           (0x0407)
01171 typedef __packed struct _evt_gap_procedure_complete{
01172   uint8_t procedure_code; /**< Terminated procedure. See @ref gap_procedure_codes "GAP procedure codes". */
01173   /**
01174    * @ref BLE_STATUS_SUCCESS, @ref BLE_STATUS_FAILED or @ref ERR_AUTH_FAILURE (procedure failed
01175    * due to authentication requirements).
01176    */
01177   uint8_t status;
01178   /**
01179    * Procedure specific data.\n
01180    * @li For Name Discovery Procedure:\n
01181    * the name of the peer device if the procedure completed successfully.
01182    * @li For General Connection Establishment Procedure:\n
01183    * The reconnection address written to the peripheral device if the peripheral is privacy enabled
01184    */
01185   uint8_t data[VARIABLE_SIZE];
01186 } PACKED evt_gap_procedure_complete;
01187 
01188 /**
01189  * This event is sent only by a privacy enabled Peripheral. The event is sent to the upper layers when the peripheral
01190  * is not able to resolve the private address of the peer device after connecting to it.
01191  */
01192 #define EVT_BLUE_GAP_ADDR_NOT_RESOLVED_IDB05A1          (0x0408)
01193 typedef __packed struct _evt_gap_addr_not_resolved_IDB05A1{
01194   uint16_t conn_handle; /**< Connection handle for which the private address could not be resolved with any of the stored IRK's.  */
01195 } PACKED evt_gap_addr_not_resolved_IDB05A1;
01196 /**
01197  * This event is raised when the reconnection address is generated during the general connection
01198  * establishment procedure. The same address is set into the peer device also as a part of the general
01199  * connection establishment procedure. In order to make use of the reconnection address the next time
01200  * while connecting to the bonded peripheral, the application needs to use this reconnection address
01201  * as its own address as well as the peer address to which it wants to connect. See aci_gap_start_general_conn_establish_proc()
01202  * and aci_gap_start_auto_conn_establish_proc().
01203  */
01204 #define EVT_BLUE_GAP_RECONNECTION_ADDRESS_IDB04A1       (0x0408)
01205 typedef __packed struct _evt_gap_reconnection_addr_IDB04A1{
01206   uint8_t reconnection_address[6]; /**< 6 bytes of reconnection address that has been generated */
01207 } PACKED evt_gap_reconnection_addr_IDB04A1;
01208 
01209 /**
01210  * @}
01211  */
01212 
01213 /**
01214  * @}
01215  */
01216 
01217 
01218 #endif /* __BLUENRG_GAP_ACI_H__ */