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

Dependents:   Nucleo_Zumo_BLE_IDB04A1 contest_IOT5 contest_IOT6 contest_IOT_10 ... more

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bluenrg_gap.h Source File

bluenrg_gap.h

00001 /******************** (C) COPYRIGHT 2012 STMicroelectronics ********************
00002 * File Name          : bluenrg_gap.h
00003 * Author             : AMS - HEA&RF BU
00004 * Version            : V1.0.0
00005 * Date               : 19-July-2012
00006 * Description        : Header file for BlueNRG's GAP layer. 
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 #ifndef __BNRG_GAP_H__
00016 #define __BNRG_GAP_H__
00017 
00018 #include <ble_link_layer.h>
00019 
00020 /**
00021  *@addtogroup GAP GAP
00022  *@brief API for GAP layer.
00023  *@{
00024  */
00025 
00026 /**
00027  * @name GAP UUIDs
00028  * @{
00029  */
00030 #define GAP_SERVICE_UUID                        (0x1800)
00031 #define DEVICE_NAME_UUID                        (0x2A00)
00032 #define APPEARANCE_UUID                         (0x2A01)
00033 #define PERIPHERAL_PRIVACY_FLAG_UUID            (0x2A02)
00034 #define RECONNECTION_ADDR_UUID                  (0x2A03)
00035 #define PERIPHERAL_PREFERRED_CONN_PARAMS_UUID   (0x2A04)
00036 /**
00037  * @}
00038  */
00039 
00040 /**
00041  * @name Characteristic value lengths
00042  * @{
00043  */
00044 #define DEVICE_NAME_CHARACTERISTIC_LEN                  (8)
00045 #define APPEARANCE_CHARACTERISTIC_LEN                   (2)
00046 #define PERIPHERAL_PRIVACY_CHARACTERISTIC_LEN           (1)
00047 #define RECONNECTION_ADDR_CHARACTERISTIC_LEN            (6)
00048 #define PERIPHERAL_PREF_CONN_PARAMS_CHARACTERISTIC_LEN  (8)
00049 /**
00050  * @}
00051  */
00052 
00053 /*------------- AD types for adv data and scan response data ----------------*/
00054 
00055 /**
00056  * @defgroup AD_Types AD Types
00057  * @brief AD Types
00058  * @{
00059  */
00060 
00061 /* FLAGS AD type */
00062 #define AD_TYPE_FLAGS                           (0x01)
00063 /* flag bits */
00064 /**
00065  * @anchor Flags_AD_Type_bits
00066  * @name Flags AD Type bits
00067  * @brief Bits in Flags AD Type
00068  * @{
00069  */
00070 #define FLAG_BIT_LE_LIMITED_DISCOVERABLE_MODE   (0x01)
00071 #define FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE   (0x02)
00072 #define FLAG_BIT_BR_EDR_NOT_SUPPORTED           (0x04)
00073 #define FLAG_BIT_LE_BR_EDR_CONTROLLER           (0x08)
00074 #define FLAG_BIT_LE_BR_EDR_HOST                 (0x10)
00075 /**
00076  * @}
00077  */
00078 
00079 /**
00080  * @name Service UUID AD types
00081  * @{
00082  */
00083 #define AD_TYPE_16_BIT_SERV_UUID                (0x02)
00084 #define AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST     (0x03)
00085 #define AD_TYPE_32_BIT_SERV_UUID                (0x04)
00086 #define AD_TYPE_32_BIT_SERV_UUID_CMPLT_LIST     (0x05)
00087 #define AD_TYPE_128_BIT_SERV_UUID               (0x06)
00088 #define AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST    (0x07)
00089 /**
00090  * @}
00091  */
00092 
00093 /* LOCAL NAME AD types */
00094 /**
00095  * @name Local name AD types
00096  * @{
00097  */
00098 #define AD_TYPE_SHORTENED_LOCAL_NAME            (0x08)
00099 #define AD_TYPE_COMPLETE_LOCAL_NAME             (0x09)
00100 /**
00101  * @}
00102  */
00103 
00104 /* TX power level AD type*/
00105 #define AD_TYPE_TX_POWER_LEVEL                  (0x0A)
00106 
00107 /* Class of device */
00108 #define AD_TYPE_CLASS_OF_DEVICE                 (0x0D)
00109 
00110 /* security manager TK value AD type */
00111 #define AD_TYPE_SEC_MGR_TK_VALUE                (0x10)
00112 
00113 /* security manager OOB flags */
00114 #define AD_TYPE_SEC_MGR_OOB_FLAGS               (0x11)
00115 
00116 /* slave connection interval AD type */
00117 #define AD_TYPE_SLAVE_CONN_INTERVAL             (0x12)
00118 
00119 /* service solicitation UUID list Ad types*/
00120 /**
00121  * @name Service solicitation UUID list AD types
00122  * @{
00123  */
00124 #define AD_TYPE_SERV_SOLICIT_16_BIT_UUID_LIST   (0x14)
00125 #define AD_TYPE_SERV_SOLICIT_32_BIT_UUID_LIST   (0x1F)
00126 #define AD_TYPE_SERV_SOLICIT_128_BIT_UUID_LIST  (0x15)
00127 /**
00128  * @}
00129  */
00130 
00131 /* service data AD type */
00132 #define AD_TYPE_SERVICE_DATA            (0x16)
00133 
00134 /* manufaturer specific data AD type */
00135 #define AD_TYPE_MANUFACTURER_SPECIFIC_DATA  (0xFF)
00136 
00137 /* appearance AD type */
00138 #define AD_TYPE_APPEARANCE          (0x19)
00139 
00140 /* advertising interval AD type */
00141 #define AD_TYPE_ADVERTISING_INTERVAL        (0x1A)
00142 
00143 /**
00144  * @}
00145  */
00146 
00147 #define MAX_ADV_DATA_LEN                        (31)
00148 
00149 #define DEVICE_NAME_LEN                         (7)
00150 #define BD_ADDR_SIZE                            (6)
00151 
00152 /**
00153  * @name Privacy flag values
00154  * @{
00155  */
00156 #define PRIVACY_ENABLED                         (0x01)
00157 #define PRIVACY_DISABLED                        (0x00)
00158 /**
00159  * @}
00160  */
00161 
00162 /**
00163  * @name Intervals
00164  * Intervals in terms of 625 micro sec
00165  * @{
00166  */
00167 #define DIR_CONN_ADV_INT_MIN                    (0x190)/*250ms*/
00168 #define DIR_CONN_ADV_INT_MAX                    (0x320)/*500ms*/
00169 #define UNDIR_CONN_ADV_INT_MIN                  (0x800)/*1.28s*/
00170 #define UNDIR_CONN_ADV_INT_MAX                  (0x1000)/*2.56s*/
00171 #define LIM_DISC_ADV_INT_MIN                    (0x190)/*250ms*/
00172 #define LIM_DISC_ADV_INT_MAX                    (0x320)/*500ms*/
00173 #define GEN_DISC_ADV_INT_MIN                    (0x800)/*1.28s*/
00174 #define GEN_DISC_ADV_INT_MAX                    (0x1000)/*2.56s*/
00175 /**
00176  * @}
00177  */
00178 
00179 /**
00180  * @name Timeout values
00181  * @{
00182  */
00183 #define LIM_DISC_MODE_TIMEOUT                   (180000)/* 180 seconds. according to the errata published */
00184 #define PRIVATE_ADDR_INT_TIMEOUT                (900000)/* 15 minutes */
00185 /**
00186  * @}
00187  */
00188 
00189 /**
00190  * @anchor gap_roles
00191  * @name GAP Roles
00192  * @{
00193 */
00194 #define GAP_PERIPHERAL_ROLE_IDB05A1         (0x01)
00195 #define GAP_BROADCASTER_ROLE_IDB05A1                (0x02)
00196 #define GAP_CENTRAL_ROLE_IDB05A1            (0x04)
00197 #define GAP_OBSERVER_ROLE_IDB05A1           (0x08)
00198 
00199 #define GAP_PERIPHERAL_ROLE_IDB04A1         (0x01)
00200 #define GAP_BROADCASTER_ROLE_IDB04A1                (0x02)
00201 #define GAP_CENTRAL_ROLE_IDB04A1            (0x03)
00202 #define GAP_OBSERVER_ROLE_IDB04A1           (0x04)
00203 /**
00204  * @}
00205  */
00206 
00207 /**
00208  * @anchor gap_procedure_codes
00209  * @name GAP procedure codes
00210  * Procedure codes for EVT_BLUE_GAP_PROCEDURE_COMPLETE event
00211  * and aci_gap_terminate_gap_procedure() command.
00212  * @{
00213  */
00214 #define GAP_LIMITED_DISCOVERY_PROC                  (0x01)
00215 #define GAP_GENERAL_DISCOVERY_PROC                  (0x02)
00216 #define GAP_NAME_DISCOVERY_PROC                     (0x04)
00217 #define GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC      (0x08)
00218 #define GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC   (0x10)
00219 #define GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC (0x20)
00220 #define GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC    (0x40)
00221 #define GAP_OBSERVATION_PROC_IDB05A1                (0x80)
00222 /**
00223  * @}
00224  */
00225 
00226 /**
00227  * @}
00228  */
00229 
00230 #endif /* __BNRG_GAP_H__ */