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

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Committer:
avilei
Date:
Fri Jun 17 16:07:05 2016 +0000
Revision:
232:f2a7da5d24e1
Parent:
215:719cd18d73a6
Add firmware update capabilities

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 132:51056160fa4a 1 /******************** (C) COPYRIGHT 2012 STMicroelectronics ********************
Wolfgang Betz 132:51056160fa4a 2 * File Name : bluenrg_gap.h
Wolfgang Betz 132:51056160fa4a 3 * Author : AMS - HEA&RF BU
Wolfgang Betz 132:51056160fa4a 4 * Version : V1.0.0
Wolfgang Betz 132:51056160fa4a 5 * Date : 19-July-2012
Wolfgang Betz 132:51056160fa4a 6 * Description : Header file for BlueNRG's GAP layer.
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 #ifndef __BNRG_GAP_H__
Wolfgang Betz 132:51056160fa4a 16 #define __BNRG_GAP_H__
Wolfgang Betz 132:51056160fa4a 17
Wolfgang Betz 132:51056160fa4a 18 #include <link_layer.h>
Wolfgang Betz 132:51056160fa4a 19
Wolfgang Betz 132:51056160fa4a 20 /**
Wolfgang Betz 132:51056160fa4a 21 *@addtogroup GAP GAP
Wolfgang Betz 132:51056160fa4a 22 *@brief API for GAP layer.
Wolfgang Betz 132:51056160fa4a 23 *@{
Wolfgang Betz 132:51056160fa4a 24 */
Wolfgang Betz 132:51056160fa4a 25
Wolfgang Betz 132:51056160fa4a 26 /**
Wolfgang Betz 132:51056160fa4a 27 * @name GAP UUIDs
Wolfgang Betz 132:51056160fa4a 28 * @{
Wolfgang Betz 132:51056160fa4a 29 */
Wolfgang Betz 132:51056160fa4a 30 #define GAP_SERVICE_UUID (0x1800)
Wolfgang Betz 132:51056160fa4a 31 #define DEVICE_NAME_UUID (0x2A00)
Wolfgang Betz 132:51056160fa4a 32 #define APPEARANCE_UUID (0x2A01)
Wolfgang Betz 132:51056160fa4a 33 #define PERIPHERAL_PRIVACY_FLAG_UUID (0x2A02)
Wolfgang Betz 132:51056160fa4a 34 #define RECONNECTION_ADDR_UUID (0x2A03)
Wolfgang Betz 132:51056160fa4a 35 #define PERIPHERAL_PREFERRED_CONN_PARAMS_UUID (0x2A04)
Wolfgang Betz 132:51056160fa4a 36 /**
Wolfgang Betz 132:51056160fa4a 37 * @}
Wolfgang Betz 132:51056160fa4a 38 */
Wolfgang Betz 132:51056160fa4a 39
Wolfgang Betz 132:51056160fa4a 40 /**
Wolfgang Betz 132:51056160fa4a 41 * @name Characteristic value lengths
Wolfgang Betz 132:51056160fa4a 42 * @{
Wolfgang Betz 132:51056160fa4a 43 */
Wolfgang Betz 132:51056160fa4a 44 #define DEVICE_NAME_CHARACTERISTIC_LEN (8)
Wolfgang Betz 132:51056160fa4a 45 #define APPEARANCE_CHARACTERISTIC_LEN (2)
Wolfgang Betz 132:51056160fa4a 46 #define PERIPHERAL_PRIVACY_CHARACTERISTIC_LEN (1)
Wolfgang Betz 132:51056160fa4a 47 #define RECONNECTION_ADDR_CHARACTERISTIC_LEN (6)
Wolfgang Betz 132:51056160fa4a 48 #define PERIPHERAL_PREF_CONN_PARAMS_CHARACTERISTIC_LEN (8)
Wolfgang Betz 132:51056160fa4a 49 /**
Wolfgang Betz 132:51056160fa4a 50 * @}
Wolfgang Betz 132:51056160fa4a 51 */
Wolfgang Betz 132:51056160fa4a 52
Wolfgang Betz 132:51056160fa4a 53 /*------------- AD types for adv data and scan response data ----------------*/
Wolfgang Betz 132:51056160fa4a 54
Wolfgang Betz 132:51056160fa4a 55 /**
Wolfgang Betz 132:51056160fa4a 56 * @defgroup AD_Types AD Types
Wolfgang Betz 132:51056160fa4a 57 * @brief AD Types
Wolfgang Betz 132:51056160fa4a 58 * @{
Wolfgang Betz 132:51056160fa4a 59 */
Wolfgang Betz 132:51056160fa4a 60
Wolfgang Betz 132:51056160fa4a 61 /* FLAGS AD type */
Wolfgang Betz 132:51056160fa4a 62 #define AD_TYPE_FLAGS (0x01)
Wolfgang Betz 132:51056160fa4a 63 /* flag bits */
Wolfgang Betz 132:51056160fa4a 64 /**
Wolfgang Betz 132:51056160fa4a 65 * @anchor Flags_AD_Type_bits
Wolfgang Betz 132:51056160fa4a 66 * @name Flags AD Type bits
Wolfgang Betz 132:51056160fa4a 67 * @brief Bits in Flags AD Type
Wolfgang Betz 132:51056160fa4a 68 * @{
Wolfgang Betz 132:51056160fa4a 69 */
Wolfgang Betz 132:51056160fa4a 70 #define FLAG_BIT_LE_LIMITED_DISCOVERABLE_MODE (0x01)
Wolfgang Betz 132:51056160fa4a 71 #define FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE (0x02)
Wolfgang Betz 132:51056160fa4a 72 #define FLAG_BIT_BR_EDR_NOT_SUPPORTED (0x04)
Wolfgang Betz 132:51056160fa4a 73 #define FLAG_BIT_LE_BR_EDR_CONTROLLER (0x08)
Wolfgang Betz 132:51056160fa4a 74 #define FLAG_BIT_LE_BR_EDR_HOST (0x10)
Wolfgang Betz 132:51056160fa4a 75 /**
Wolfgang Betz 132:51056160fa4a 76 * @}
Wolfgang Betz 132:51056160fa4a 77 */
Wolfgang Betz 132:51056160fa4a 78
Wolfgang Betz 132:51056160fa4a 79 /**
Wolfgang Betz 132:51056160fa4a 80 * @name Service UUID AD types
Wolfgang Betz 132:51056160fa4a 81 * @{
Wolfgang Betz 132:51056160fa4a 82 */
Wolfgang Betz 132:51056160fa4a 83 #define AD_TYPE_16_BIT_SERV_UUID (0x02)
Wolfgang Betz 132:51056160fa4a 84 #define AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST (0x03)
Wolfgang Betz 132:51056160fa4a 85 #define AD_TYPE_32_BIT_SERV_UUID (0x04)
Wolfgang Betz 132:51056160fa4a 86 #define AD_TYPE_32_BIT_SERV_UUID_CMPLT_LIST (0x05)
Wolfgang Betz 132:51056160fa4a 87 #define AD_TYPE_128_BIT_SERV_UUID (0x06)
Wolfgang Betz 132:51056160fa4a 88 #define AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST (0x07)
Wolfgang Betz 132:51056160fa4a 89 /**
Wolfgang Betz 132:51056160fa4a 90 * @}
Wolfgang Betz 132:51056160fa4a 91 */
Wolfgang Betz 132:51056160fa4a 92
Wolfgang Betz 132:51056160fa4a 93 /* LOCAL NAME AD types */
Wolfgang Betz 132:51056160fa4a 94 /**
Wolfgang Betz 132:51056160fa4a 95 * @name Local name AD types
Wolfgang Betz 132:51056160fa4a 96 * @{
Wolfgang Betz 132:51056160fa4a 97 */
Wolfgang Betz 132:51056160fa4a 98 #define AD_TYPE_SHORTENED_LOCAL_NAME (0x08)
Wolfgang Betz 132:51056160fa4a 99 #define AD_TYPE_COMPLETE_LOCAL_NAME (0x09)
Wolfgang Betz 132:51056160fa4a 100 /**
Wolfgang Betz 132:51056160fa4a 101 * @}
Wolfgang Betz 132:51056160fa4a 102 */
Wolfgang Betz 132:51056160fa4a 103
Wolfgang Betz 132:51056160fa4a 104 /* TX power level AD type*/
Wolfgang Betz 132:51056160fa4a 105 #define AD_TYPE_TX_POWER_LEVEL (0x0A)
Wolfgang Betz 132:51056160fa4a 106
Wolfgang Betz 132:51056160fa4a 107 /* Class of device */
Wolfgang Betz 132:51056160fa4a 108 #define AD_TYPE_CLASS_OF_DEVICE (0x0D)
Wolfgang Betz 132:51056160fa4a 109
Wolfgang Betz 132:51056160fa4a 110 /* security manager TK value AD type */
Wolfgang Betz 132:51056160fa4a 111 #define AD_TYPE_SEC_MGR_TK_VALUE (0x10)
Wolfgang Betz 132:51056160fa4a 112
Wolfgang Betz 132:51056160fa4a 113 /* security manager OOB flags */
Wolfgang Betz 132:51056160fa4a 114 #define AD_TYPE_SEC_MGR_OOB_FLAGS (0x11)
Wolfgang Betz 132:51056160fa4a 115
Wolfgang Betz 132:51056160fa4a 116 /* slave connection interval AD type */
Wolfgang Betz 132:51056160fa4a 117 #define AD_TYPE_SLAVE_CONN_INTERVAL (0x12)
Wolfgang Betz 132:51056160fa4a 118
Wolfgang Betz 132:51056160fa4a 119 /* service solicitation UUID list Ad types*/
Wolfgang Betz 132:51056160fa4a 120 /**
Wolfgang Betz 132:51056160fa4a 121 * @name Service solicitation UUID list AD types
Wolfgang Betz 132:51056160fa4a 122 * @{
Wolfgang Betz 132:51056160fa4a 123 */
Wolfgang Betz 132:51056160fa4a 124 #define AD_TYPE_SERV_SOLICIT_16_BIT_UUID_LIST (0x14)
Wolfgang Betz 132:51056160fa4a 125 #define AD_TYPE_SERV_SOLICIT_32_BIT_UUID_LIST (0x1F)
Wolfgang Betz 132:51056160fa4a 126 #define AD_TYPE_SERV_SOLICIT_128_BIT_UUID_LIST (0x15)
Wolfgang Betz 132:51056160fa4a 127 /**
Wolfgang Betz 132:51056160fa4a 128 * @}
Wolfgang Betz 132:51056160fa4a 129 */
Wolfgang Betz 132:51056160fa4a 130
Wolfgang Betz 132:51056160fa4a 131 /* service data AD type */
Andrea Palmieri 215:719cd18d73a6 132 #define AD_TYPE_SERVICE_DATA (0x16)
Wolfgang Betz 132:51056160fa4a 133
Wolfgang Betz 132:51056160fa4a 134 /* manufaturer specific data AD type */
Andrea Palmieri 215:719cd18d73a6 135 #define AD_TYPE_MANUFACTURER_SPECIFIC_DATA (0xFF)
Andrea Palmieri 215:719cd18d73a6 136
Andrea Palmieri 215:719cd18d73a6 137 /* appearance AD type */
Andrea Palmieri 215:719cd18d73a6 138 #define AD_TYPE_APPEARANCE (0x19)
Wolfgang Betz 132:51056160fa4a 139
Wolfgang Betz 132:51056160fa4a 140 /**
Wolfgang Betz 132:51056160fa4a 141 * @}
Wolfgang Betz 132:51056160fa4a 142 */
Wolfgang Betz 132:51056160fa4a 143
Wolfgang Betz 132:51056160fa4a 144 #define MAX_ADV_DATA_LEN (31)
Wolfgang Betz 132:51056160fa4a 145
Wolfgang Betz 132:51056160fa4a 146 #define DEVICE_NAME_LEN (7)
Wolfgang Betz 132:51056160fa4a 147 #define BD_ADDR_SIZE (6)
Wolfgang Betz 132:51056160fa4a 148
Wolfgang Betz 132:51056160fa4a 149 /**
Wolfgang Betz 132:51056160fa4a 150 * @name Privacy flag values
Wolfgang Betz 132:51056160fa4a 151 * @{
Wolfgang Betz 132:51056160fa4a 152 */
Wolfgang Betz 132:51056160fa4a 153 #define PRIVACY_ENABLED (0x01)
Wolfgang Betz 132:51056160fa4a 154 #define PRIVACY_DISABLED (0x00)
Wolfgang Betz 132:51056160fa4a 155 /**
Wolfgang Betz 132:51056160fa4a 156 * @}
Wolfgang Betz 132:51056160fa4a 157 */
Wolfgang Betz 132:51056160fa4a 158
Wolfgang Betz 132:51056160fa4a 159 /**
Wolfgang Betz 132:51056160fa4a 160 * @name Intervals
Wolfgang Betz 132:51056160fa4a 161 * Intervals in terms of 625 micro sec
Wolfgang Betz 132:51056160fa4a 162 * @{
Wolfgang Betz 132:51056160fa4a 163 */
Wolfgang Betz 132:51056160fa4a 164 #define DIR_CONN_ADV_INT_MIN (0x190)/*250ms*/
Wolfgang Betz 132:51056160fa4a 165 #define DIR_CONN_ADV_INT_MAX (0x320)/*500ms*/
Wolfgang Betz 132:51056160fa4a 166 #define UNDIR_CONN_ADV_INT_MIN (0x800)/*1.28s*/
Wolfgang Betz 132:51056160fa4a 167 #define UNDIR_CONN_ADV_INT_MAX (0x1000)/*2.56s*/
Wolfgang Betz 132:51056160fa4a 168 #define LIM_DISC_ADV_INT_MIN (0x190)/*250ms*/
Wolfgang Betz 132:51056160fa4a 169 #define LIM_DISC_ADV_INT_MAX (0x320)/*500ms*/
Wolfgang Betz 132:51056160fa4a 170 #define GEN_DISC_ADV_INT_MIN (0x800)/*1.28s*/
Wolfgang Betz 132:51056160fa4a 171 #define GEN_DISC_ADV_INT_MAX (0x1000)/*2.56s*/
Wolfgang Betz 132:51056160fa4a 172 /**
Wolfgang Betz 132:51056160fa4a 173 * @}
Wolfgang Betz 132:51056160fa4a 174 */
Wolfgang Betz 132:51056160fa4a 175
Wolfgang Betz 132:51056160fa4a 176 /**
Wolfgang Betz 132:51056160fa4a 177 * @name Timeout values
Wolfgang Betz 132:51056160fa4a 178 * @{
Wolfgang Betz 132:51056160fa4a 179 */
Wolfgang Betz 132:51056160fa4a 180 #define LIM_DISC_MODE_TIMEOUT (180000)/* 180 seconds. according to the errata published */
Wolfgang Betz 132:51056160fa4a 181 #define PRIVATE_ADDR_INT_TIMEOUT (900000)/* 15 minutes */
Wolfgang Betz 132:51056160fa4a 182 /**
Wolfgang Betz 132:51056160fa4a 183 * @}
Wolfgang Betz 132:51056160fa4a 184 */
Wolfgang Betz 132:51056160fa4a 185
Wolfgang Betz 132:51056160fa4a 186 /**
Wolfgang Betz 132:51056160fa4a 187 * @anchor gap_roles
Wolfgang Betz 132:51056160fa4a 188 * @name GAP Roles
Wolfgang Betz 132:51056160fa4a 189 * @{
Wolfgang Betz 132:51056160fa4a 190 */
Wolfgang Betz 132:51056160fa4a 191 #define GAP_PERIPHERAL_ROLE_IDB05A1 (0x01)
Wolfgang Betz 132:51056160fa4a 192 #define GAP_BROADCASTER_ROLE_IDB05A1 (0x02)
Wolfgang Betz 132:51056160fa4a 193 #define GAP_CENTRAL_ROLE_IDB05A1 (0x04)
Wolfgang Betz 132:51056160fa4a 194 #define GAP_OBSERVER_ROLE_IDB05A1 (0x08)
Wolfgang Betz 132:51056160fa4a 195
Wolfgang Betz 132:51056160fa4a 196 #define GAP_PERIPHERAL_ROLE_IDB04A1 (0x01)
Wolfgang Betz 132:51056160fa4a 197 #define GAP_BROADCASTER_ROLE_IDB04A1 (0x02)
Wolfgang Betz 132:51056160fa4a 198 #define GAP_CENTRAL_ROLE_IDB04A1 (0x03)
Wolfgang Betz 132:51056160fa4a 199 #define GAP_OBSERVER_ROLE_IDB04A1 (0x04)
Wolfgang Betz 132:51056160fa4a 200 /**
Wolfgang Betz 132:51056160fa4a 201 * @}
Wolfgang Betz 132:51056160fa4a 202 */
Wolfgang Betz 132:51056160fa4a 203
Wolfgang Betz 132:51056160fa4a 204 /**
Wolfgang Betz 132:51056160fa4a 205 * @anchor gap_procedure_codes
Wolfgang Betz 132:51056160fa4a 206 * @name GAP procedure codes
Wolfgang Betz 132:51056160fa4a 207 * Procedure codes for EVT_BLUE_GAP_PROCEDURE_COMPLETE event
Wolfgang Betz 132:51056160fa4a 208 * and aci_gap_terminate_gap_procedure() command.
Wolfgang Betz 132:51056160fa4a 209 * @{
Wolfgang Betz 132:51056160fa4a 210 */
Wolfgang Betz 132:51056160fa4a 211 #define GAP_LIMITED_DISCOVERY_PROC (0x01)
Wolfgang Betz 132:51056160fa4a 212 #define GAP_GENERAL_DISCOVERY_PROC (0x02)
Wolfgang Betz 132:51056160fa4a 213 #define GAP_NAME_DISCOVERY_PROC (0x04)
Wolfgang Betz 132:51056160fa4a 214 #define GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC (0x08)
Wolfgang Betz 132:51056160fa4a 215 #define GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC (0x10)
Wolfgang Betz 132:51056160fa4a 216 #define GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC (0x20)
Wolfgang Betz 132:51056160fa4a 217 #define GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC (0x40)
Wolfgang Betz 132:51056160fa4a 218 #define GAP_OBSERVATION_PROC_IDB05A1 (0x80)
Wolfgang Betz 132:51056160fa4a 219 /**
Wolfgang Betz 132:51056160fa4a 220 * @}
Wolfgang Betz 132:51056160fa4a 221 */
Wolfgang Betz 132:51056160fa4a 222
Wolfgang Betz 132:51056160fa4a 223 /**
Wolfgang Betz 132:51056160fa4a 224 * @}
Wolfgang Betz 132:51056160fa4a 225 */
Wolfgang Betz 132:51056160fa4a 226
Wolfgang Betz 132:51056160fa4a 227 #endif /* __BNRG_GAP_H__ */