1 /****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * This file contains the Bluetooth Manager (BTM) API function external 22 * definitions. 23 * 24 ******************************************************************************/ 25 #ifndef BTM_BLE_API_H 26 #define BTM_BLE_API_H 27 28 #include "common/bt_defs.h" 29 #include "stack/btm_api.h" 30 #include "common/bt_common_types.h" 31 32 #define CHANNEL_MAP_LEN 5 33 typedef UINT8 tBTM_BLE_CHNL_MAP[CHANNEL_MAP_LEN]; 34 35 /* 0x00-0x04 only used for set advertising parameter command */ 36 #define BTM_BLE_CONNECT_EVT 0x00 /* 0x00-0x04 only used for set advertising 37 parameter command */ 38 #define BTM_BLE_CONNECT_DIR_EVT 0x01 /* Connectable directed advertising */ 39 #define BTM_BLE_DISCOVER_EVT 0x02 /* Scannable undirected advertising */ 40 #define BTM_BLE_NON_CONNECT_EVT 0x03 /* Non connectable undirected advertising */ 41 #define BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 0x04 /* Connectable low duty 42 cycle directed advertising */ 43 /* 0x00 - 0x05 can be received on adv event type */ 44 #define BTM_BLE_SCAN_RSP_EVT 0x04 45 #define BTM_BLE_SCAN_REQ_EVT 0x05 46 #define BTM_BLE_UNKNOWN_EVT 0xff 47 48 #define BTM_BLE_UNKNOWN_EVT 0xff 49 50 typedef UINT8 tBTM_BLE_EVT; 51 typedef UINT8 tBTM_BLE_CONN_MODE; 52 53 typedef UINT32 tBTM_BLE_REF_VALUE; 54 55 #define BTM_BLE_SCAN_MODE_PASS 0 56 #define BTM_BLE_SCAN_MODE_ACTI 1 57 #define BTM_BLE_SCAN_MODE_NONE 0xff 58 typedef UINT8 tBLE_SCAN_MODE; 59 60 #define BTM_BLE_BATCH_SCAN_MODE_DISABLE 0 61 #define BTM_BLE_BATCH_SCAN_MODE_PASS 1 62 #define BTM_BLE_BATCH_SCAN_MODE_ACTI 2 63 #define BTM_BLE_BATCH_SCAN_MODE_PASS_ACTI 3 64 65 typedef UINT8 tBTM_BLE_BATCH_SCAN_MODE; 66 67 /* advertising channel map */ 68 #define BTM_BLE_ADV_CHNL_37 (0x01 << 0) 69 #define BTM_BLE_ADV_CHNL_38 (0x01 << 1) 70 #define BTM_BLE_ADV_CHNL_39 (0x01 << 2) 71 typedef UINT8 tBTM_BLE_ADV_CHNL_MAP; 72 73 /*d efault advertising channel map */ 74 #ifndef BTM_BLE_DEFAULT_ADV_CHNL_MAP 75 #define BTM_BLE_DEFAULT_ADV_CHNL_MAP (BTM_BLE_ADV_CHNL_37| BTM_BLE_ADV_CHNL_38| BTM_BLE_ADV_CHNL_39) 76 #endif 77 78 /* advertising filter policy */ 79 #define AP_SCAN_CONN_ALL 0x00 /* default */ 80 #define AP_SCAN_WL_CONN_ALL 0x01 81 #define AP_SCAN_ALL_CONN_WL 0x02 82 #define AP_SCAN_CONN_WL 0x03 83 #define AP_SCAN_CONN_POLICY_MAX 0x04 84 typedef UINT8 tBTM_BLE_AFP; 85 86 /* default advertising filter policy */ 87 #ifndef BTM_BLE_DEFAULT_AFP 88 #define BTM_BLE_DEFAULT_AFP AP_SCAN_CONN_ALL 89 #endif 90 91 /* scanning filter policy */ 92 #define SP_ADV_ALL 0x00 /* 0: accept adv packet from all, directed adv pkt not directed */ 93 /* to local device is ignored */ 94 #define SP_ADV_WL 0x01 /* 1: accept adv packet from device in white list, directed adv */ 95 /* packet not directed to local device is ignored */ 96 #define SP_ADV_ALL_RPA_DIR_ADV 0x02 /* 2: accept adv packet from all, directed adv pkt */ 97 /* not directed to me is ignored except direct adv with RPA */ 98 #define SP_ADV_WL_RPA_DIR_ADV 0x03 /* 3: accept adv packet from device in white list, directed */ 99 /* adv pkt not directed to me is ignored except direct adv */ 100 /* with RPA */ 101 typedef UINT8 tBTM_BLE_SFP; 102 103 #ifndef BTM_BLE_DEFAULT_SFP 104 #define BTM_BLE_DEFAULT_SFP SP_ADV_ALL 105 #endif 106 107 /* adv parameter boundary values */ 108 #define BTM_BLE_ADV_INT_MIN 0x0020 109 #define BTM_BLE_ADV_INT_MAX 0x4000 110 111 /* Full scan boundary values */ 112 #define BTM_BLE_ADV_SCAN_FULL_MIN 0x00 113 #define BTM_BLE_ADV_SCAN_FULL_MAX 0x64 114 115 /* Partial scan boundary values */ 116 #define BTM_BLE_ADV_SCAN_TRUNC_MIN BTM_BLE_ADV_SCAN_FULL_MIN 117 #define BTM_BLE_ADV_SCAN_TRUNC_MAX BTM_BLE_ADV_SCAN_FULL_MAX 118 119 /* Threshold values */ 120 #define BTM_BLE_ADV_SCAN_THR_MIN BTM_BLE_ADV_SCAN_FULL_MIN 121 #define BTM_BLE_ADV_SCAN_THR_MAX BTM_BLE_ADV_SCAN_FULL_MAX 122 123 /* connection parameter boundary values */ 124 #define BTM_BLE_SCAN_INT_MIN 0x0004 125 #define BTM_BLE_SCAN_INT_MAX 0x4000 126 #define BTM_BLE_SCAN_WIN_MIN 0x0004 127 #define BTM_BLE_SCAN_WIN_MAX 0x4000 128 #define BTM_BLE_EXT_SCAN_INT_MAX 0x00FFFFFF 129 #define BTM_BLE_EXT_SCAN_WIN_MAX 0xFFFF 130 #define BTM_BLE_CONN_INT_MIN 0x0006 131 #define BTM_BLE_CONN_INT_MAX 0x0C80 132 #define BTM_BLE_CONN_LATENCY_MAX 499 133 #define BTM_BLE_CONN_SUP_TOUT_MIN 0x000A 134 #define BTM_BLE_CONN_SUP_TOUT_MAX 0x0C80 135 #define BTM_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */ 136 #define BTM_BLE_SCAN_PARAM_UNDEF 0xffffffff 137 138 /* default connection parameters if not configured, use GAP recommend value for auto/selective connection */ 139 /* default scan interval */ 140 #ifndef BTM_BLE_SCAN_FAST_INT 141 #define BTM_BLE_SCAN_FAST_INT 96 /* 30 ~ 60 ms (use 60) = 96 *0.625 */ 142 #endif 143 /* default scan window for background connection, applicable for auto connection or selective conenction */ 144 #ifndef BTM_BLE_SCAN_FAST_WIN 145 #define BTM_BLE_SCAN_FAST_WIN 48 /* 30 ms = 48 *0.625 */ 146 #endif 147 148 /* default scan paramter used in reduced power cycle (background scanning) */ 149 #ifndef BTM_BLE_SCAN_SLOW_INT_1 150 #define BTM_BLE_SCAN_SLOW_INT_1 2048 /* 1.28 s = 2048 *0.625 */ 151 #endif 152 #ifndef BTM_BLE_SCAN_SLOW_WIN_1 153 #define BTM_BLE_SCAN_SLOW_WIN_1 48 /* 30 ms = 48 *0.625 */ 154 #endif 155 156 /* default scan paramter used in reduced power cycle (background scanning) */ 157 #ifndef BTM_BLE_SCAN_SLOW_INT_2 158 #define BTM_BLE_SCAN_SLOW_INT_2 4096 /* 2.56 s = 4096 *0.625 */ 159 #endif 160 #ifndef BTM_BLE_SCAN_SLOW_WIN_2 161 #define BTM_BLE_SCAN_SLOW_WIN_2 36 /* 22.5 ms = 36 *0.625 */ 162 #endif 163 164 /* default connection interval min */ 165 #ifndef BTM_BLE_CONN_INT_MIN_DEF 166 #define BTM_BLE_CONN_INT_MIN_DEF 10 /* recommended min: 12.5 ms = 10 * 1.25 */ 167 #endif 168 169 /* default connection interval max */ 170 #ifndef BTM_BLE_CONN_INT_MAX_DEF 171 #if CONFIG_IDF_TARGET_ESP32 172 #define BTM_BLE_CONN_INT_MAX_DEF 12 /* recommended max: 15 ms = 12 * 1.25 */ 173 #else 174 #define BTM_BLE_CONN_INT_MAX_DEF (((MAX_ACL_CONNECTIONS + 1) * 4) > 12 ? ((MAX_ACL_CONNECTIONS + 1) * 4) : 12) /* recommended max: BTM_BLE_CONN_INT_MAX_DEF * 1.25 ms*/ 175 #endif 176 #endif 177 178 /* default slave latency */ 179 #ifndef BTM_BLE_CONN_SLAVE_LATENCY_DEF 180 #define BTM_BLE_CONN_SLAVE_LATENCY_DEF 0 /* 0 */ 181 #endif 182 183 /* default supervision timeout */ 184 #ifndef BTM_BLE_CONN_TIMEOUT_DEF 185 #define BTM_BLE_CONN_TIMEOUT_DEF 600 186 #endif 187 188 /* minimum acceptable connection interval */ 189 #ifndef BTM_BLE_CONN_INT_MIN_LIMIT 190 #define BTM_BLE_CONN_INT_MIN_LIMIT 0x0009 191 #endif 192 193 #define BTM_BLE_DIR_CONN_FALLBACK_UNDIR 1 194 #define BTM_BLE_DIR_CONN_FALLBACK_NO_ADV 2 195 196 #ifndef BTM_BLE_DIR_CONN_FALLBACK 197 #define BTM_BLE_DIR_CONN_FALLBACK BTM_BLE_DIR_CONN_FALLBACK_UNDIR 198 #endif 199 200 #define BTM_CMAC_TLEN_SIZE 8 /* 64 bits */ 201 #define BTM_BLE_AUTH_SIGN_LEN 12 /* BLE data signature length 8 Bytes + 4 bytes counter*/ 202 typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN]; /* Device address */ 203 204 #ifndef BTM_BLE_HOST_SUPPORT 205 #define BTM_BLE_HOST_SUPPORT 0x01 206 #endif 207 208 #ifndef BTM_BLE_SIMULTANEOUS_HOST 209 #define BTM_BLE_SIMULTANEOUS_HOST 0x01 210 #endif 211 212 /* Appearance Values Reported with BTM_BLE_AD_TYPE_APPEARANCE */ 213 #define BTM_BLE_APPEARANCE_UNKNOWN 0x0000 214 #define BTM_BLE_APPEARANCE_GENERIC_PHONE 0x0040 215 #define BTM_BLE_APPEARANCE_GENERIC_COMPUTER 0x0080 216 #define BTM_BLE_APPEARANCE_GENERIC_WATCH 0x00C0 217 #define BTM_BLE_APPEARANCE_SPORTS_WATCH 0x00C1 218 #define BTM_BLE_APPEARANCE_GENERIC_CLOCK 0x0100 219 #define BTM_BLE_APPEARANCE_GENERIC_DISPLAY 0x0140 220 #define BTM_BLE_APPEARANCE_GENERIC_REMOTE 0x0180 221 #define BTM_BLE_APPEARANCE_GENERIC_EYEGLASSES 0x01C0 222 #define BTM_BLE_APPEARANCE_GENERIC_TAG 0x0200 223 #define BTM_BLE_APPEARANCE_GENERIC_KEYRING 0x0240 224 #define BTM_BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 225 #define BTM_BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 226 #define BTM_BLE_APPEARANCE_GENERIC_THERMOMETER 0x0300 227 #define BTM_BLE_APPEARANCE_THERMOMETER_EAR 0x0301 228 #define BTM_BLE_APPEARANCE_GENERIC_HEART_RATE 0x0340 229 #define BTM_BLE_APPEARANCE_HEART_RATE_BELT 0x0341 230 #define BTM_BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 231 #define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381 232 #define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382 233 #define BTM_BLE_APPEARANCE_GENERIC_HID 0x03C0 234 #define BTM_BLE_APPEARANCE_HID_KEYBOARD 0x03C1 235 #define BTM_BLE_APPEARANCE_HID_MOUSE 0x03C2 236 #define BTM_BLE_APPEARANCE_HID_JOYSTICK 0x03C3 237 #define BTM_BLE_APPEARANCE_HID_GAMEPAD 0x03C4 238 #define BTM_BLE_APPEARANCE_HID_DIGITIZER_TABLET 0x03C5 239 #define BTM_BLE_APPEARANCE_HID_CARD_READER 0x03C6 240 #define BTM_BLE_APPEARANCE_HID_DIGITAL_PEN 0x03C7 241 #define BTM_BLE_APPEARANCE_HID_BARCODE_SCANNER 0x03C8 242 #define BTM_BLE_APPEARANCE_GENERIC_GLUCOSE 0x0400 243 #define BTM_BLE_APPEARANCE_GENERIC_WALKING 0x0440 244 #define BTM_BLE_APPEARANCE_WALKING_IN_SHOE 0x0441 245 #define BTM_BLE_APPEARANCE_WALKING_ON_SHOE 0x0442 246 #define BTM_BLE_APPEARANCE_WALKING_ON_HIP 0x0443 247 #define BTM_BLE_APPEARANCE_GENERIC_CYCLING 0x0480 248 #define BTM_BLE_APPEARANCE_CYCLING_COMPUTER 0x0481 249 #define BTM_BLE_APPEARANCE_CYCLING_SPEED 0x0482 250 #define BTM_BLE_APPEARANCE_CYCLING_CADENCE 0x0483 251 #define BTM_BLE_APPEARANCE_CYCLING_POWER 0x0484 252 #define BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 253 #define BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 254 #define BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 255 #define BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 256 #define BTM_BLE_APPEARANCE_GENERIC_WEIGHT 0x0C80 257 #define BTM_BLE_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE 0x0CC0 258 #define BTM_BLE_APPEARANCE_POWERED_WHEELCHAIR 0x0CC1 259 #define BTM_BLE_APPEARANCE_MOBILITY_SCOOTER 0x0CC2 260 #define BTM_BLE_APPEARANCE_GENERIC_CONTINUOUS_GLUCOSE_MONITOR 0x0D00 261 #define BTM_BLE_APPEARANCE_GENERIC_INSULIN_PUMP 0x0D40 262 #define BTM_BLE_APPEARANCE_INSULIN_PUMP_DURABLE_PUMP 0x0D41 263 #define BTM_BLE_APPEARANCE_INSULIN_PUMP_PATCH_PUMP 0x0D44 264 #define BTM_BLE_APPEARANCE_INSULIN_PEN 0x0D48 265 #define BTM_BLE_APPEARANCE_GENERIC_MEDICATION_DELIVERY 0x0D80 266 #define BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS 0x1440 267 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441 268 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV 0x1442 269 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD 0x1443 270 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444 271 272 273 /* Structure returned with Rand/Encrypt complete callback */ 274 typedef struct { 275 UINT8 status; 276 UINT8 param_len; 277 UINT16 opcode; 278 UINT8 param_buf[BT_OCTET16_LEN]; 279 } tBTM_RAND_ENC; 280 281 /* General callback function for notifying an application that a synchronous 282 ** BTM function is complete. The pointer contains the address of any returned data. 283 */ 284 typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1); 285 286 #define BTM_BLE_FILTER_TARGET_SCANNER 0x01 287 #define BTM_BLE_FILTER_TARGET_ADVR 0x00 288 289 #define BTM_BLE_POLICY_BLACK_ALL 0x00 /* relevant to both */ 290 #define BTM_BLE_POLICY_ALLOW_SCAN 0x01 /* relevant to advertiser */ 291 #define BTM_BLE_POLICY_ALLOW_CONN 0x02 /* relevant to advertiser */ 292 #define BTM_BLE_POLICY_WHITE_ALL 0x03 /* relevant to both */ 293 294 /* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */ 295 #define BTM_BLE_LIMIT_DISC_FLAG (0x01 << 0) 296 #define BTM_BLE_GEN_DISC_FLAG (0x01 << 1) 297 #define BTM_BLE_BREDR_NOT_SPT (0x01 << 2) 298 /* 4.1 spec adv flag for simultaneous BR/EDR+LE connection support */ 299 #define BTM_BLE_DMT_CONTROLLER_SPT (0x01 << 3) 300 #define BTM_BLE_DMT_HOST_SPT (0x01 << 4) 301 #define BTM_BLE_NON_LIMIT_DISC_FLAG (0x00 ) /* lowest bit unset */ 302 #define BTM_BLE_ADV_FLAG_MASK (BTM_BLE_LIMIT_DISC_FLAG | BTM_BLE_BREDR_NOT_SPT | BTM_BLE_GEN_DISC_FLAG) 303 #define BTM_BLE_LIMIT_DISC_MASK (BTM_BLE_LIMIT_DISC_FLAG ) 304 305 #define BTM_BLE_AD_BIT_DEV_NAME (0x00000001 << 0) 306 #define BTM_BLE_AD_BIT_FLAGS (0x00000001 << 1) 307 #define BTM_BLE_AD_BIT_MANU (0x00000001 << 2) 308 #define BTM_BLE_AD_BIT_TX_PWR (0x00000001 << 3) 309 #define BTM_BLE_AD_BIT_INT_RANGE (0x00000001 << 5) 310 #define BTM_BLE_AD_BIT_SERVICE (0x00000001 << 6) 311 #define BTM_BLE_AD_BIT_SERVICE_SOL (0x00000001 << 7) 312 #define BTM_BLE_AD_BIT_SERVICE_DATA (0x00000001 << 8) 313 #define BTM_BLE_AD_BIT_SIGN_DATA (0x00000001 << 9) 314 #define BTM_BLE_AD_BIT_SERVICE_128SOL (0x00000001 << 10) 315 #define BTM_BLE_AD_BIT_APPEARANCE (0x00000001 << 11) 316 #define BTM_BLE_AD_BIT_PUBLIC_ADDR (0x00000001 << 12) 317 #define BTM_BLE_AD_BIT_RANDOM_ADDR (0x00000001 << 13) 318 #define BTM_BLE_AD_BIT_SERVICE_32 (0x00000001 << 4) 319 #define BTM_BLE_AD_BIT_SERVICE_32SOL (0x00000001 << 14) 320 #define BTM_BLE_AD_BIT_PROPRIETARY (0x00000001 << 15) 321 #define BTM_BLE_AD_BIT_SERVICE_128 (0x00000001 << 16) /*128-bit Service UUIDs*/ 322 323 typedef UINT32 tBTM_BLE_AD_MASK; 324 325 /* relate to ESP_BLE_AD_TYPE_xxx in esp_gap_ble_api.h */ 326 #define BTM_BLE_AD_TYPE_FLAG HCI_EIR_FLAGS_TYPE /* 0x01 */ 327 #define BTM_BLE_AD_TYPE_16SRV_PART HCI_EIR_MORE_16BITS_UUID_TYPE /* 0x02 */ 328 #define BTM_BLE_AD_TYPE_16SRV_CMPL HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 */ 329 #define BTM_BLE_AD_TYPE_32SRV_PART HCI_EIR_MORE_32BITS_UUID_TYPE /* 0x04 */ 330 #define BTM_BLE_AD_TYPE_32SRV_CMPL HCI_EIR_COMPLETE_32BITS_UUID_TYPE /* 0x05 */ 331 #define BTM_BLE_AD_TYPE_128SRV_PART HCI_EIR_MORE_128BITS_UUID_TYPE /* 0x06 */ 332 #define BTM_BLE_AD_TYPE_128SRV_CMPL HCI_EIR_COMPLETE_128BITS_UUID_TYPE /* 0x07 */ 333 #define BTM_BLE_AD_TYPE_NAME_SHORT HCI_EIR_SHORTENED_LOCAL_NAME_TYPE /* 0x08 */ 334 #define BTM_BLE_AD_TYPE_NAME_CMPL HCI_EIR_COMPLETE_LOCAL_NAME_TYPE /* 0x09 */ 335 #define BTM_BLE_AD_TYPE_TX_PWR HCI_EIR_TX_POWER_LEVEL_TYPE /* 0x0A */ 336 #define BTM_BLE_AD_TYPE_DEV_CLASS 0x0D 337 #define BTM_BLE_AD_TYPE_SM_TK 0x10 338 #define BTM_BLE_AD_TYPE_SM_OOB_FLAG 0x11 339 #define BTM_BLE_AD_TYPE_INT_RANGE 0x12 340 #define BTM_BLE_AD_TYPE_SOL_SRV_UUID 0x14 341 #define BTM_BLE_AD_TYPE_128SOL_SRV_UUID 0x15 342 #define BTM_BLE_AD_TYPE_SERVICE_DATA 0x16 343 #define BTM_BLE_AD_TYPE_PUBLIC_TARGET 0x17 344 #define BTM_BLE_AD_TYPE_RANDOM_TARGET 0x18 345 #define BTM_BLE_AD_TYPE_APPEARANCE 0x19 346 #define BTM_BLE_AD_TYPE_ADV_INT 0x1a 347 #define BTM_BLE_AD_TYPE_LE_DEV_ADDR 0x1b 348 #define BTM_BLE_AD_TYPE_LE_ROLE 0x1c 349 #define BTM_BLE_AD_TYPE_SPAIR_C256 0x1d 350 #define BTM_BLE_AD_TYPE_SPAIR_R256 0x1e 351 #define BTM_BLE_AD_TYPE_32SOL_SRV_UUID 0x1f 352 #define BTM_BLE_AD_TYPE_32SERVICE_DATA 0x20 353 #define BTM_BLE_AD_TYPE_128SERVICE_DATA 0x21 354 #define BTM_BLE_AD_TYPE_LE_SECURE_CONFIRM 0x22 355 #define BTM_BLE_AD_TYPE_LE_SECURE_RANDOM 0x23 356 #define BTM_BLE_AD_TYPE_URI 0x24 357 #define BTM_BLE_AD_TYPE_INDOOR_POSITION 0x25 358 #define BTM_BLE_AD_TYPE_TRANS_DISC_DATA 0x26 359 #define BTM_BLE_AD_TYPE_LE_SUPPORT_FEATURE 0x27 360 #define BTM_BLE_AD_TYPE_CHAN_MAP_UPDATE 0x28 361 362 #define BTM_BLE_AD_TYPE_MANU HCI_EIR_MANUFACTURER_SPECIFIC_TYPE /* 0xff */ 363 typedef UINT8 tBTM_BLE_AD_TYPE; 364 365 #define BTM_BLE_LONG_ADV_MAX_LEN 249 366 367 /* Security settings used with L2CAP LE COC */ 368 #define BTM_SEC_LE_LINK_ENCRYPTED 0x01 369 #define BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM 0x02 370 #define BTM_SEC_LE_LINK_PAIRED_WITH_MITM 0x04 371 372 /* Min/max Preferred number of payload octets that the local Controller 373 should include in a single Link Layer Data Channel PDU. */ 374 #define BTM_BLE_DATA_SIZE_MAX 0x00fb 375 #define BTM_BLE_DATA_SIZE_MIN 0x001b 376 377 /* Preferred maximum number of microseconds that the local Controller 378 should use to transmit a single Link Layer Data Channel PDU. */ 379 #define BTM_BLE_DATA_TX_TIME_MIN 0x0148 380 #if (BLE_50_FEATURE_SUPPORT == TRUE) 381 #define BTM_BLE_DATA_TX_TIME_MAX 0x04290 // define by spec v5.0 382 #else 383 #define BTM_BLE_DATA_TX_TIME_MAX 0x0848 384 #endif 385 386 /* adv tx power level */ 387 #define BTM_BLE_ADV_TX_POWER_MIN 0 /* minimum tx power */ 388 #define BTM_BLE_ADV_TX_POWER_MAX BTM_TX_POWER_LEVEL_MAX /* maximum tx power */ 389 typedef UINT8 tBTM_BLE_ADV_TX_POWER; 390 391 /* adv tx power in dBm */ 392 typedef struct { 393 UINT8 adv_inst_max; /* max adv instance supported in controller */ 394 UINT8 rpa_offloading; 395 UINT16 tot_scan_results_strg; 396 UINT8 max_irk_list_sz; 397 UINT8 filter_support; 398 UINT8 max_filter; 399 UINT8 energy_support; 400 BOOLEAN values_read; 401 UINT16 version_supported; 402 UINT16 total_trackable_advertisers; 403 UINT8 extended_scan_support; 404 UINT8 debug_logging_supported; 405 } tBTM_BLE_VSC_CB; 406 407 /* slave preferred connection interval range */ 408 typedef struct { 409 UINT16 low; 410 UINT16 hi; 411 412 } tBTM_BLE_INT_RANGE; 413 414 /* Service tag supported in the device */ 415 typedef struct { 416 UINT8 num_service; 417 BOOLEAN list_cmpl; 418 UINT16 *p_uuid; 419 } tBTM_BLE_SERVICE; 420 421 /* 32 bits Service supported in the device */ 422 typedef struct { 423 UINT8 num_service; 424 BOOLEAN list_cmpl; 425 UINT32 *p_uuid; 426 } tBTM_BLE_32SERVICE; 427 428 /* 128 bits Service supported in the device */ 429 typedef struct { 430 BOOLEAN list_cmpl; 431 UINT8 uuid128[MAX_UUID_SIZE]; 432 } tBTM_BLE_128SERVICE; 433 434 typedef struct { 435 UINT8 len; 436 UINT8 *p_val; 437 } tBTM_BLE_MANU; 438 439 440 typedef struct { 441 tBT_UUID service_uuid; 442 UINT8 len; 443 UINT8 *p_val; 444 } tBTM_BLE_SERVICE_DATA; 445 446 typedef struct { 447 UINT8 adv_type; 448 UINT8 len; 449 UINT8 *p_val; /* number of len byte */ 450 } tBTM_BLE_PROP_ELEM; 451 452 typedef struct { 453 UINT8 num_elem; 454 tBTM_BLE_PROP_ELEM *p_elem; 455 } tBTM_BLE_PROPRIETARY; 456 457 typedef struct { 458 tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */ 459 tBTM_BLE_MANU *p_manu; /* manufacturer data */ 460 tBTM_BLE_SERVICE *p_services; /* services */ 461 tBTM_BLE_128SERVICE *p_services_128b; /* 128 bits service */ 462 tBTM_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */ 463 tBTM_BLE_SERVICE *p_sol_services; /* 16 bits services Solicitation UUIDs */ 464 tBTM_BLE_32SERVICE *p_sol_service_32b; /* List of 32 bit Service Solicitation UUIDs */ 465 tBTM_BLE_128SERVICE *p_sol_service_128b; /* List of 128 bit Service Solicitation UUIDs */ 466 tBTM_BLE_PROPRIETARY *p_proprietary; 467 tBTM_BLE_SERVICE_DATA *p_service_data; /* service data */ 468 UINT16 appearance; 469 UINT8 flag; 470 UINT8 tx_power; 471 } tBTM_BLE_ADV_DATA; 472 473 #ifndef BTM_BLE_MULTI_ADV_MAX 474 #define BTM_BLE_MULTI_ADV_MAX 16 /* controller returned adv_inst_max should be less 475 than this number */ 476 #endif 477 478 #define BTM_BLE_MULTI_ADV_INVALID 0 479 480 #define BTM_BLE_MULTI_ADV_ENB_EVT 1 481 #define BTM_BLE_MULTI_ADV_DISABLE_EVT 2 482 #define BTM_BLE_MULTI_ADV_PARAM_EVT 3 483 #define BTM_BLE_MULTI_ADV_DATA_EVT 4 484 typedef UINT8 tBTM_BLE_MULTI_ADV_EVT; 485 486 #define BTM_BLE_MULTI_ADV_DEFAULT_STD 0 487 488 typedef struct { 489 UINT16 adv_int_min; 490 UINT16 adv_int_max; 491 UINT8 adv_type; 492 tBTM_BLE_ADV_CHNL_MAP channel_map; 493 tBTM_BLE_AFP adv_filter_policy; 494 tBTM_BLE_ADV_TX_POWER tx_power; 495 } tBTM_BLE_ADV_PARAMS; 496 497 typedef struct { 498 UINT8 *p_sub_code; /* dynamic array to store sub code */ 499 UINT8 *p_inst_id; /* dynamic array to store instance id */ 500 UINT8 pending_idx; 501 UINT8 next_idx; 502 } tBTM_BLE_MULTI_ADV_OPQ; 503 504 typedef void (tBTM_BLE_MULTI_ADV_CBACK)(tBTM_BLE_MULTI_ADV_EVT evt, UINT8 inst_id, 505 void *p_ref, tBTM_STATUS status); 506 507 typedef struct { 508 UINT8 inst_id; 509 BOOLEAN in_use; 510 UINT8 adv_evt; 511 BD_ADDR rpa; 512 TIMER_LIST_ENT raddr_timer_ent; 513 tBTM_BLE_MULTI_ADV_CBACK *p_cback; 514 void *p_ref; 515 UINT8 index; 516 } tBTM_BLE_MULTI_ADV_INST; 517 518 typedef struct { 519 UINT8 inst_index_queue[BTM_BLE_MULTI_ADV_MAX]; 520 int front; 521 int rear; 522 } tBTM_BLE_MULTI_ADV_INST_IDX_Q; 523 524 typedef struct { 525 tBTM_BLE_MULTI_ADV_INST *p_adv_inst; /* dynamic array to store adv instance */ 526 tBTM_BLE_MULTI_ADV_OPQ op_q; 527 } tBTM_BLE_MULTI_ADV_CB; 528 529 typedef UINT8 tGATT_IF; 530 531 typedef void (tBTM_BLE_SCAN_THRESHOLD_CBACK)(tBTM_BLE_REF_VALUE ref_value); 532 typedef void (tBTM_BLE_SCAN_REP_CBACK)(tBTM_BLE_REF_VALUE ref_value, UINT8 report_format, 533 UINT8 num_records, UINT16 total_len, 534 UINT8 *p_rep_data, UINT8 status); 535 typedef void (tBTM_BLE_SCAN_SETUP_CBACK)(UINT8 evt, tBTM_BLE_REF_VALUE ref_value, UINT8 status); 536 537 #ifndef BTM_BLE_BATCH_SCAN_MAX 538 #define BTM_BLE_BATCH_SCAN_MAX 5 539 #endif 540 541 #ifndef BTM_BLE_BATCH_REP_MAIN_Q_SIZE 542 #define BTM_BLE_BATCH_REP_MAIN_Q_SIZE 2 543 #endif 544 545 typedef enum { 546 BTM_BLE_SCAN_INVALID_STATE = 0, 547 BTM_BLE_SCAN_ENABLE_CALLED = 1, 548 BTM_BLE_SCAN_ENABLED_STATE = 2, 549 BTM_BLE_SCAN_DISABLE_CALLED = 3, 550 BTM_BLE_SCAN_DISABLED_STATE = 4 551 } tBTM_BLE_BATCH_SCAN_STATE; 552 553 enum { 554 BTM_BLE_DISCARD_OLD_ITEMS, 555 BTM_BLE_DISCARD_LOWER_RSSI_ITEMS 556 }; 557 typedef UINT8 tBTM_BLE_DISCARD_RULE; 558 559 typedef struct { 560 UINT8 sub_code[BTM_BLE_BATCH_SCAN_MAX]; 561 tBTM_BLE_BATCH_SCAN_STATE cur_state[BTM_BLE_BATCH_SCAN_MAX]; 562 tBTM_BLE_REF_VALUE ref_value[BTM_BLE_BATCH_SCAN_MAX]; 563 UINT8 pending_idx; 564 UINT8 next_idx; 565 } tBTM_BLE_BATCH_SCAN_OPQ; 566 567 typedef struct { 568 UINT8 rep_mode[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 569 tBTM_BLE_REF_VALUE ref_value[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 570 UINT8 num_records[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 571 UINT16 data_len[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 572 UINT8 *p_data[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 573 UINT8 pending_idx; 574 UINT8 next_idx; 575 } tBTM_BLE_BATCH_SCAN_REP_Q; 576 577 typedef struct { 578 tBTM_BLE_BATCH_SCAN_STATE cur_state; 579 tBTM_BLE_BATCH_SCAN_MODE scan_mode; 580 UINT32 scan_interval; 581 UINT32 scan_window; 582 tBLE_ADDR_TYPE addr_type; 583 tBTM_BLE_DISCARD_RULE discard_rule; 584 tBTM_BLE_BATCH_SCAN_OPQ op_q; 585 tBTM_BLE_BATCH_SCAN_REP_Q main_rep_q; 586 tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback; 587 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback; 588 tBTM_BLE_SCAN_REP_CBACK *p_scan_rep_cback; 589 tBTM_BLE_REF_VALUE ref_value; 590 } tBTM_BLE_BATCH_SCAN_CB; 591 592 /// Ble scan duplicate type 593 enum { 594 BTM_BLE_SCAN_DUPLICATE_DISABLE = 0x0, /*!< the Link Layer should generate advertising reports to the host for each packet received */ 595 BTM_BLE_SCAN_DUPLICATE_ENABLE = 0x1, /*!< the Link Layer should filter out duplicate advertising reports to the Host */ 596 BTM_BLE_SCAN_DUPLICATE_MAX = 0x2, /*!< 0x02 – 0xFF, Reserved for future use */ 597 }; 598 /* filter selection bit index */ 599 #define BTM_BLE_PF_ADDR_FILTER 0 600 #define BTM_BLE_PF_SRVC_DATA 1 601 #define BTM_BLE_PF_SRVC_UUID 2 602 #define BTM_BLE_PF_SRVC_SOL_UUID 3 603 #define BTM_BLE_PF_LOCAL_NAME 4 604 #define BTM_BLE_PF_MANU_DATA 5 605 #define BTM_BLE_PF_SRVC_DATA_PATTERN 6 606 #define BTM_BLE_PF_TYPE_ALL 7 /* when passed in payload filter type all, only clear action is applicable */ 607 #define BTM_BLE_PF_TYPE_MAX 8 608 609 /* max number of filter spot for different filter type */ 610 #ifndef BTM_BLE_MAX_UUID_FILTER 611 #define BTM_BLE_MAX_UUID_FILTER 8 612 #endif 613 #ifndef BTM_BLE_MAX_ADDR_FILTER 614 #define BTM_BLE_MAX_ADDR_FILTER 8 615 #endif 616 #ifndef BTM_BLE_PF_STR_COND_MAX 617 #define BTM_BLE_PF_STR_COND_MAX 4 /* apply to manu data , or local name */ 618 #endif 619 #ifndef BTM_BLE_PF_STR_LEN_MAX 620 #define BTM_BLE_PF_STR_LEN_MAX 29 /* match for first 29 bytes */ 621 #endif 622 623 typedef UINT8 tBTM_BLE_PF_COND_TYPE; 624 625 #define BTM_BLE_PF_LOGIC_OR 0 626 #define BTM_BLE_PF_LOGIC_AND 1 627 typedef UINT8 tBTM_BLE_PF_LOGIC_TYPE; 628 629 #define BTM_BLE_PF_ENABLE 1 630 #define BTM_BLE_PF_CONFIG 2 631 typedef UINT8 tBTM_BLE_PF_ACTION; 632 633 typedef UINT8 tBTM_BLE_PF_FILT_INDEX; 634 635 typedef UINT8 tBTM_BLE_PF_AVBL_SPACE; 636 637 #define BTM_BLE_PF_BRDCAST_ADDR_FILT 1 638 #define BTM_BLE_PF_SERV_DATA_CHG_FILT 2 639 #define BTM_BLE_PF_SERV_UUID 4 640 #define BTM_BLE_PF_SERV_SOLC_UUID 8 641 #define BTM_BLE_PF_LOC_NAME_CHECK 16 642 #define BTM_BLE_PF_MANUF_NAME_CHECK 32 643 #define BTM_BLE_PF_SERV_DATA_CHECK 64 644 typedef UINT16 tBTM_BLE_PF_FEAT_SEL; 645 646 #define BTM_BLE_PF_LIST_LOGIC_OR 1 647 #define BTM_BLE_PF_LIST_LOGIC_AND 2 648 typedef UINT16 tBTM_BLE_PF_LIST_LOGIC_TYPE; 649 650 #define BTM_BLE_PF_FILT_LOGIC_OR 0 651 #define BTM_BLE_PF_FILT_LOGIC_AND 1 652 typedef UINT16 tBTM_BLE_PF_FILT_LOGIC_TYPE; 653 654 typedef UINT8 tBTM_BLE_PF_RSSI_THRESHOLD; 655 typedef UINT8 tBTM_BLE_PF_DELIVERY_MODE; 656 typedef UINT16 tBTM_BLE_PF_TIMEOUT; 657 typedef UINT8 tBTM_BLE_PF_TIMEOUT_CNT; 658 typedef UINT16 tBTM_BLE_PF_ADV_TRACK_ENTRIES; 659 660 typedef struct { 661 tBTM_BLE_PF_FEAT_SEL feat_seln; 662 tBTM_BLE_PF_LIST_LOGIC_TYPE logic_type; 663 tBTM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type; 664 tBTM_BLE_PF_RSSI_THRESHOLD rssi_high_thres; 665 tBTM_BLE_PF_RSSI_THRESHOLD rssi_low_thres; 666 tBTM_BLE_PF_DELIVERY_MODE dely_mode; 667 tBTM_BLE_PF_TIMEOUT found_timeout; 668 tBTM_BLE_PF_TIMEOUT lost_timeout; 669 tBTM_BLE_PF_TIMEOUT_CNT found_timeout_cnt; 670 tBTM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries; 671 } tBTM_BLE_PF_FILT_PARAMS; 672 673 enum { 674 BTM_BLE_SCAN_COND_ADD, 675 BTM_BLE_SCAN_COND_DELETE, 676 BTM_BLE_SCAN_COND_CLEAR = 2 677 }; 678 typedef UINT8 tBTM_BLE_SCAN_COND_OP; 679 680 enum { 681 BTM_BLE_FILT_ENABLE_DISABLE = 1, 682 BTM_BLE_FILT_CFG = 2, 683 BTM_BLE_FILT_ADV_PARAM = 3 684 }; 685 686 typedef UINT8 tBTM_BLE_FILT_CB_EVT; 687 688 /* BLE adv payload filtering config complete callback */ 689 typedef void (tBTM_BLE_PF_CFG_CBACK)(tBTM_BLE_PF_ACTION action, tBTM_BLE_SCAN_COND_OP cfg_op, 690 tBTM_BLE_PF_AVBL_SPACE avbl_space, tBTM_STATUS status, 691 tBTM_BLE_REF_VALUE ref_value); 692 693 typedef void (tBTM_BLE_PF_CMPL_CBACK) (tBTM_BLE_PF_CFG_CBACK); 694 695 /* BLE adv payload filtering status setup complete callback */ 696 typedef void (tBTM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTM_STATUS status, 697 tBTM_BLE_REF_VALUE ref_value); 698 699 /* BLE adv payload filtering param setup complete callback */ 700 typedef void (tBTM_BLE_PF_PARAM_CBACK) (tBTM_BLE_PF_ACTION action_type, 701 tBTM_BLE_PF_AVBL_SPACE avbl_space, 702 tBTM_BLE_REF_VALUE ref_value, tBTM_STATUS status); 703 #if (BLE_50_FEATURE_SUPPORT == TRUE) 704 #define MAX_BLE_ADV_INSTANCE 10 705 #define MIN_BLE_PERIODIC_ADV_REPORT_LEN 7 706 typedef struct { 707 UINT8 inst_id; 708 BOOLEAN configured; 709 BOOLEAN legacy_pdu; 710 711 712 BOOLEAN directed; 713 BOOLEAN scannable; 714 BOOLEAN connetable; 715 } tBTM_BLE_EXTENDED_INST; 716 717 typedef struct { 718 tBTM_BLE_EXTENDED_INST inst[MAX_BLE_ADV_INSTANCE]; /* dynamic array to store adv instance */ 719 UINT8 scan_duplicate; 720 } tBTM_BLE_EXTENDED_CB; 721 722 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE (1 << 0) 723 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE (1 << 1) 724 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_DIRECTED (1 << 2) 725 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_HD_DIRECTED (1 << 3) 726 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY (1 << 4) 727 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_ANON_ADV (1 << 5) 728 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_INCLUDE_TX_PWR (1 << 6) 729 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_MASK (0x7F) 730 731 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_IND (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 732 ESP_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE |\ 733 ESP_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE) 734 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_LD_DIR (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 735 ESP_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE |\ 736 ESP_BLE_GAP_SET_EXT_ADV_PROP_DIRECTED) 737 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_HD_DIR (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 738 ESP_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE |\ 739 ESP_BLE_GAP_SET_EXT_ADV_PROP_HD_DIRECTED) 740 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_SCAN (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 741 ESP_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE) 742 #define BTM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_NONCONN (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY) 743 typedef UINT16 tBTM_BLE_EXT_ADV_TYPE_MASK; 744 745 #define BTM_BLE_GAP_PHY_1M 1 746 #define BTM_BLE_GAP_PHY_2M 2 747 #define BTM_BLE_GAP_PHY_CODED 3 748 typedef UINT8 tBTM_BLE_GAP_PHY; 749 750 #define BTM_BLE_GAP_PHY_NO_TX_PREF_MASK (0x01) 751 #define BTM_BLE_GAP_PHY_NO_RX_PREF_MASK (0x02) 752 #define BTM_BLE_GAP_PHY_1M_PREF_MASK (0x03) 753 #define BTM_BLE_GAP_PHY_2M_PREF_MASK (0x04) 754 #define BTM_BLE_GAP_PHY_CODED_PREF_MASK (0x05) 755 typedef UINT8 tBTM_BLE_GAP_PHY_MASK; 756 757 #define BTM_BLE_GAP_EXT_SCAN_UNCODE_MASK 0x01 758 #define BTM_BLE_GAP_EXT_SCAN_CODE_MASK 0x02 759 typedef UINT8 tBTM_BLE_EXT_SCAN_CFG_MASK; 760 761 typedef struct { 762 tBTM_BLE_EXT_ADV_TYPE_MASK type; 763 UINT32 interval_min; 764 UINT32 interval_max; 765 tBTM_BLE_ADV_CHNL_MAP channel_map; 766 tBLE_ADDR_TYPE own_addr_type; 767 tBLE_ADDR_TYPE peer_addr_type; 768 BD_ADDR peer_addr; 769 tBTM_BLE_AFP filter_policy; 770 INT8 tx_power; 771 tBTM_BLE_GAP_PHY primary_phy; 772 UINT8 max_skip; 773 tBTM_BLE_GAP_PHY secondary_phy; 774 UINT8 sid; 775 BOOLEAN scan_req_notif; 776 } tBTM_BLE_GAP_EXT_ADV_PARAMS; 777 778 typedef struct { 779 UINT8 instance; 780 int duration; 781 int max_events; 782 } tBTM_BLE_EXT_ADV; 783 784 785 typedef struct { 786 tBLE_SCAN_MODE scan_type; 787 UINT16 scan_interval; 788 UINT16 scan_window; 789 } tBTM_BLE_EXT_SCAN_CFG; 790 791 typedef struct { 792 tBLE_ADDR_TYPE own_addr_type; 793 UINT8 filter_policy; 794 UINT8 scan_duplicate; 795 tBTM_BLE_EXT_SCAN_CFG_MASK cfg_mask; 796 tBTM_BLE_EXT_SCAN_CFG uncoded_cfg; 797 tBTM_BLE_EXT_SCAN_CFG coded_cfg; 798 } tBTM_BLE_EXT_SCAN_PARAMS; 799 800 typedef struct { 801 UINT16 interval_min; 802 UINT16 interval_max; 803 UINT8 properties; 804 } tBTM_BLE_Periodic_Adv_Params; 805 806 typedef struct { 807 UINT8 filter_policy; 808 UINT8 sid; 809 tBLE_ADDR_TYPE addr_type; 810 BD_ADDR addr; 811 UINT16 skip; 812 UINT16 sync_timeout; 813 } tBTM_BLE_Periodic_Sync_Params; 814 815 typedef struct { 816 uint8_t status; 817 uint16_t conn_idx; 818 uint8_t tx_phy; 819 uint8_t rx_phy; 820 } tBTM_BLE_UPDATE_PHY; 821 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) 822 typedef union { 823 UINT16 uuid16_mask; 824 UINT32 uuid32_mask; 825 UINT8 uuid128_mask[LEN_UUID_128]; 826 } tBTM_BLE_PF_COND_MASK; 827 828 typedef struct { 829 tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */ 830 tBT_UUID uuid; /* UUID condition */ 831 tBTM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */ 832 tBTM_BLE_PF_COND_MASK *p_uuid_mask; /* UUID mask */ 833 } tBTM_BLE_PF_UUID_COND; 834 835 typedef struct { 836 UINT8 data_len; /* <= 20 bytes */ 837 UINT8 *p_data; 838 } tBTM_BLE_PF_LOCAL_NAME_COND; 839 840 typedef struct { 841 UINT16 company_id; /* company ID */ 842 UINT8 data_len; /* <= 20 bytes */ 843 UINT8 *p_pattern; 844 UINT16 company_id_mask; /* UUID value mask */ 845 UINT8 *p_pattern_mask; /* Manufacturer data matching mask, 846 same length as data pattern, 847 set to all 0xff, match exact data */ 848 } tBTM_BLE_PF_MANU_COND; 849 850 typedef struct { 851 UINT16 uuid; /* service ID */ 852 UINT8 data_len; /* <= 20 bytes */ 853 UINT8 *p_pattern; 854 UINT8 *p_pattern_mask; /* Service data matching mask, same length as data pattern, 855 set to all 0xff, match exact data */ 856 } tBTM_BLE_PF_SRVC_PATTERN_COND; 857 858 859 typedef union { 860 tBLE_BD_ADDR target_addr; 861 tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */ 862 tBTM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */ 863 tBTM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */ 864 tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */ 865 tBTM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */ 866 } tBTM_BLE_PF_COND_PARAM; 867 868 typedef struct { 869 UINT8 action_ocf[BTM_BLE_PF_TYPE_MAX]; 870 tBTM_BLE_REF_VALUE ref_value[BTM_BLE_PF_TYPE_MAX]; 871 tBTM_BLE_PF_PARAM_CBACK *p_filt_param_cback[BTM_BLE_PF_TYPE_MAX]; 872 tBTM_BLE_PF_CFG_CBACK *p_scan_cfg_cback[BTM_BLE_PF_TYPE_MAX]; 873 UINT8 cb_evt[BTM_BLE_PF_TYPE_MAX]; 874 UINT8 pending_idx; 875 UINT8 next_idx; 876 } tBTM_BLE_ADV_FILTER_ADV_OPQ; 877 878 #define BTM_BLE_MAX_FILTER_COUNTER (BTM_BLE_MAX_ADDR_FILTER + 1) /* per device filter + one generic filter indexed by 0 */ 879 880 #ifndef BTM_CS_IRK_LIST_MAX 881 #define BTM_CS_IRK_LIST_MAX 0x20 882 #endif 883 884 typedef struct { 885 BOOLEAN in_use; 886 BD_ADDR bd_addr; 887 UINT8 pf_counter[BTM_BLE_PF_TYPE_MAX]; /* number of filter indexed by tBTM_BLE_PF_COND_TYPE */ 888 } tBTM_BLE_PF_COUNT; 889 890 typedef struct { 891 BOOLEAN enable; 892 UINT8 op_type; 893 tBTM_BLE_PF_COUNT *p_addr_filter_count; /* per BDA filter array */ 894 tBLE_BD_ADDR cur_filter_target; 895 tBTM_BLE_PF_STATUS_CBACK *p_filt_stat_cback; 896 tBTM_BLE_ADV_FILTER_ADV_OPQ op_q; 897 } tBTM_BLE_ADV_FILTER_CB; 898 899 /* Sub codes */ 900 #define BTM_BLE_META_PF_ENABLE 0x00 901 #define BTM_BLE_META_PF_FEAT_SEL 0x01 902 #define BTM_BLE_META_PF_ADDR 0x02 903 #define BTM_BLE_META_PF_UUID 0x03 904 #define BTM_BLE_META_PF_SOL_UUID 0x04 905 #define BTM_BLE_META_PF_LOCAL_NAME 0x05 906 #define BTM_BLE_META_PF_MANU_DATA 0x06 907 #define BTM_BLE_META_PF_SRVC_DATA 0x07 908 #define BTM_BLE_META_PF_ALL 0x08 909 910 typedef UINT8 BTM_BLE_ADV_STATE; 911 typedef UINT8 BTM_BLE_ADV_INFO_PRESENT; 912 typedef UINT8 BTM_BLE_RSSI_VALUE; 913 typedef UINT16 BTM_BLE_ADV_INFO_TIMESTAMP; 914 915 /* These are the fields returned in each device adv packet. It 916 ** is returned in the results callback if registered. 917 */ 918 typedef struct { 919 UINT8 conn_mode; 920 tBTM_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */ 921 UINT8 flag; 922 UINT8 tx_power_level; 923 UINT8 remote_name_len; 924 UINT8 *p_remote_name; 925 tBTM_BLE_SERVICE service; 926 } tBTM_BLE_INQ_DATA; 927 928 enum { 929 BTM_BLE_CONN_NONE, 930 BTM_BLE_CONN_AUTO, 931 BTM_BLE_CONN_SELECTIVE 932 }; 933 typedef UINT8 tBTM_BLE_CONN_TYPE; 934 935 #define ADV_INFO_PRESENT 0x00 936 #define NO_ADV_INFO_PRESENT 0x01 937 938 typedef btgatt_track_adv_info_t tBTM_BLE_TRACK_ADV_DATA; 939 940 typedef void (tBTM_BLE_TRACK_ADV_CBACK)(tBTM_BLE_TRACK_ADV_DATA *p_track_adv_data); 941 942 typedef UINT8 tBTM_BLE_TRACK_ADV_EVT; 943 944 typedef struct { 945 tBTM_BLE_REF_VALUE ref_value; 946 tBTM_BLE_TRACK_ADV_CBACK *p_track_cback; 947 } tBTM_BLE_ADV_TRACK_CB; 948 949 enum { 950 BTM_BLE_TRACK_ADV_ADD, 951 BTM_BLE_TRACK_ADV_REMOVE 952 }; 953 954 typedef UINT8 tBTM_BLE_TRACK_ADV_ACTION; 955 956 #define BTM_BLE_MULTI_ADV_INVALID 0 957 958 #define BTM_BLE_BATCH_SCAN_ENABLE_EVT 1 959 #define BTM_BLE_BATCH_SCAN_CFG_STRG_EVT 2 960 #define BTM_BLE_BATCH_SCAN_READ_REPTS_EVT 3 961 #define BTM_BLE_BATCH_SCAN_THR_EVT 4 962 #define BTM_BLE_BATCH_SCAN_PARAM_EVT 5 963 #define BTM_BLE_BATCH_SCAN_DISABLE_EVT 6 964 965 typedef UINT8 tBTM_BLE_BATCH_SCAN_EVT; 966 967 typedef UINT32 tBTM_BLE_TX_TIME_MS; 968 typedef UINT32 tBTM_BLE_RX_TIME_MS; 969 typedef UINT32 tBTM_BLE_IDLE_TIME_MS; 970 typedef UINT32 tBTM_BLE_ENERGY_USED; 971 972 typedef void (tBTM_BLE_ENERGY_INFO_CBACK)(tBTM_BLE_TX_TIME_MS tx_time, tBTM_BLE_RX_TIME_MS rx_time, 973 tBTM_BLE_IDLE_TIME_MS idle_time, 974 tBTM_BLE_ENERGY_USED energy_used, 975 tBTM_STATUS status); 976 977 typedef struct { 978 tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback; 979 } tBTM_BLE_ENERGY_INFO_CB; 980 981 typedef BOOLEAN (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name); 982 typedef void (tBTM_BLE_CTRL_FEATURES_CBACK)(tBTM_STATUS status); 983 984 /* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */ 985 typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, UINT8 *p_signing_data); 986 typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match); 987 /* random address set complete callback */ 988 typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda); 989 990 typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt); 991 typedef void (*tBLE_SCAN_PARAM_SETUP_CBACK)(tGATT_IF client_if, tBTM_STATUS status); 992 993 tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb; 994 995 typedef void (tBTM_START_ADV_CMPL_CBACK) (UINT8 status); 996 typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status); 997 998 typedef void (tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTM_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info); 999 #if (BLE_50_FEATURE_SUPPORT == TRUE) 1000 #define BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1 1001 #define BTM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT 2 1002 #define BTM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT 3 1003 #define BTM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT 4 1004 #define BTM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT 5 1005 #define BTM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT 6 1006 #define BTM_BLE_5_GAP_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT 7 1007 #define BTM_BLE_5_GAP_EXT_ADV_START_COMPLETE_EVT 8 1008 #define BTM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT 9 1009 #define BTM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT 10 1010 #define BTM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT 11 1011 #define BTM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT 12 1012 #define BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT 13 1013 #define BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT 14 1014 #define BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT 15 1015 #define BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT 16 1016 #define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT 17 1017 #define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT 18 1018 #define BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT 19 1019 #define BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT 20 1020 #define BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT 21 1021 #define BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT 22 1022 #define BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT 23 1023 #define BTM_BLE_5_GAP_EXT_SCAN_STOP_COMPLETE_EVT 24 1024 #define BTM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT 25 1025 #define BTM_BLE_5_GAP_PHY_UPDATE_COMPLETE_EVT 26 1026 #define BTM_BLE_5_GAP_EXT_ADV_REPORT_EVT 27 1027 #define BTM_BLE_5_GAP_SCAN_TIMEOUT_EVT 28 1028 #define BTM_BLE_5_GAP_ADV_TERMINATED_EVT 29 1029 #define BTM_BLE_5_GAP_SCAN_REQ_RECEIVED_EVT 30 1030 #define BTM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT 31 1031 #define BTM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT 32 1032 #define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_LOST_EVT 33 1033 #define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_ESTAB_EVT 34 1034 #define BTM_BLE_5_GAP_UNKNOWN_EVT 35 1035 typedef UINT8 tBTM_BLE_5_GAP_EVENT; 1036 1037 #define BTM_BLE_EXT_ADV_DATA_COMPLETE 0x00 1038 #define BTM_BLE_EXT_ADV_DATA_INCOMPLETE 0x01 1039 #define BTM_BLE_EXT_ADV_DATA_TRUNCATED 0x02 1040 typedef UINT8 tBTM_BLE_EXT_ADV_DATA_STATUS; 1041 1042 #define BTM_BLE_ADV_DATA_COMPLETE_MASK (0x0000) 1043 #define BTM_BLE_ADV_DATA_INCOMPLETE_MASK (0x0020) 1044 #define BTM_BLE_ADV_DATA_TRUNCATED_MASK (0x0040) 1045 #define BTM_BLE_ADV_DATA_STATUS_MASK (0x0060) 1046 1047 1048 //#define BTM_BLE_ADV_CONN_MASK (0x0001) 1049 //#define BTM_BLE_ADV_SCAN_MASK (0x0002) 1050 //#define BTM_BLE_ADV_DIRECT_MASK (0x0004) 1051 //#define BTM_BLE_SCAN_RSP_MASK (0x0008) 1052 #define BTM_BLE_ADV_LEGACY_MASK (0x0010) 1053 typedef UINT8 tBTM_BLE_ADV_MASK; 1054 1055 // /* Advertising report */ 1056 // #define BTM_BLE_ADV_REPORT_ADV_IND (0) 1057 // #define BTM_BLE_ADV_REPORT_DIR_IND (1) 1058 // #define BTM_BLE_ADV_REPORT_SCAN_IND (2) 1059 // #define BTM_BLE_ADV_REPORT_NONCONN_IND (3) 1060 // #define BTM_BLE_ADV_REPORT_SCAN_RSP (4) 1061 1062 // /* Bluetooth 5.0, Vol 2, Part E, 7.7.65.13 */ 1063 // #define BTM_BLE_LEGACY_ADV_TYPE_IND (0x13) 1064 // #define BTM_BLE_LEGACY_ADV_TYPE_DIRECT_IND (0x15) 1065 // #define BTM_BLE_LEGACY_ADV_TYPE_SCAN_IND (0x12) 1066 // #define BTM_BLE_LEGACY_ADV_TYPE_NONCON_IND (0x10) 1067 // #define BTM_BLE_LEGACY_ADV_TYPE_SCAN_RSP_ADV_IND (0x1b) 1068 // #define BTM_BLE_LEGACY_ADV_TYPE_SCAN_RSP_ADV_SCAN_IND (0x1a) 1069 1070 typedef struct { 1071 UINT8 status; 1072 BD_ADDR addr; 1073 UINT8 tx_phy; 1074 UINT8 rx_phy; 1075 } tBTM_BLE_READ_PHY_CMPL; 1076 1077 typedef struct { 1078 UINT8 status; 1079 } tBTM_BLE_SET_PREF_DEF_PHY_CMPL; 1080 1081 typedef struct { 1082 UINT8 status; 1083 } tBTM_BLE_SET_PERF_PHY_CMPL; 1084 1085 typedef struct { 1086 UINT8 status; 1087 } tBTM_BLE_EXT_ADV_SET_RAND_ADDR_CMPL; 1088 1089 typedef struct { 1090 UINT8 status; 1091 } tBTM_BLE_EXT_ADV_SET_PARAMS_CMPL; 1092 1093 typedef struct { 1094 UINT8 status; 1095 } tBTM_BLE_EXT_ADV_DATA_SET_CMPL; 1096 1097 typedef struct { 1098 UINT8 status; 1099 } tBTM_BLE_EXT_ADV_SCAN_RSP_DATA_SET_CMPL; 1100 1101 typedef struct { 1102 UINT8 status; 1103 } tBTM_BLE_EXT_ADV_START_CMPL; 1104 1105 typedef struct { 1106 UINT8 status; 1107 } tBTM_BLE_EXT_ADV_STOP_CMPL; 1108 1109 typedef struct { 1110 UINT8 status; 1111 } tBTM_BLE_PERIOD_ADV_SET_PARAMS_CMPL; 1112 1113 typedef struct { 1114 UINT8 status; 1115 } tBTM_BLE_PERIOD_ADV_DATA_SET_CMPL; 1116 1117 typedef struct { 1118 UINT8 status; 1119 } tBTM_BLE_PERIOD_ADV_START_CMPL; 1120 1121 typedef struct { 1122 UINT8 status; 1123 } tBTM_BLE_PERIOD_ADV_STOP_CMPL; 1124 1125 typedef struct { 1126 UINT8 status; 1127 } tBTM_BLE_PERIOD_ADV_SYNC_CREATE_CMPL; 1128 1129 typedef struct { 1130 UINT8 status; 1131 } tBTM_BLE_PERIOD_ADV_SYNC_CANCEL_CMPL; 1132 1133 typedef struct { 1134 UINT8 status; 1135 } tBTM_BLE_PERIOD_ADV_SYNC_TEMINAT_CMPL; 1136 1137 typedef struct { 1138 UINT8 status; 1139 } tBTM_BLE_PERIOD_ADV_ADD_DEV_CMPL; 1140 1141 typedef struct { 1142 UINT8 status; 1143 } tBTM_BLE_PERIOD_ADV_REMOVE_DEV_CMPL; 1144 1145 typedef struct { 1146 UINT8 status; 1147 } tBTM_BLE_PEROID_ADV_CLEAR_DEV_CMPL; 1148 1149 typedef struct { 1150 UINT8 status; 1151 } tBTM_BLE_SET_EXT_SCAN_PARAMS_CMPL; 1152 1153 typedef struct { 1154 UINT8 status; 1155 } tBTM_BLE_EXT_SCAN_START_CMPL; 1156 1157 typedef struct { 1158 UINT8 status; 1159 } tBTM_BLE_EXT_SCAN_STOP_CMPL; 1160 1161 typedef struct { 1162 UINT8 status; 1163 } tBTM_BLE_PREF_EXT_CONN_SET_PARAMS_CMPL; 1164 1165 typedef struct { 1166 uint8_t status; 1167 BD_ADDR addr; 1168 uint8_t tx_phy; 1169 uint8_t rx_phy; 1170 } tBTM_BLE_PHY_UPDATE_CMPL; 1171 1172 typedef struct { 1173 // UINT8 props; 1174 // UINT8 legacy_event_type; 1175 UINT8 event_type; 1176 tBLE_ADDR_TYPE addr_type; 1177 BD_ADDR addr; 1178 UINT8 primary_phy; 1179 UINT8 secondry_phy; 1180 UINT8 sid; 1181 UINT8 tx_power; 1182 UINT8 rssi; 1183 UINT16 per_adv_interval; 1184 tBLE_ADDR_TYPE dir_addr_type; 1185 BD_ADDR dir_addr; 1186 tBTM_BLE_EXT_ADV_DATA_STATUS data_status; 1187 UINT8 adv_data_len; 1188 UINT8 *adv_data; 1189 } tBTM_BLE_EXT_ADV_REPORT; 1190 1191 typedef struct { 1192 UINT8 status; 1193 UINT8 adv_handle; 1194 UINT16 conn_handle; 1195 UINT8 completed_event; 1196 } tBTM_BLE_ADV_TERMINAT; 1197 1198 typedef struct { 1199 UINT8 adv_handle; 1200 tBLE_ADDR_TYPE scan_addr_type; 1201 BD_ADDR scan_addr; 1202 } tBTM_BLE_SCAN_REQ_RECEIVED; 1203 1204 typedef struct { 1205 UINT16 conn_handle; 1206 UINT8 channel_sel_alg; 1207 } tBTM_BLE_CHANNEL_SEL_ALG; 1208 1209 typedef struct { 1210 UINT16 sync_handle; 1211 UINT8 tx_power; 1212 INT8 rssi; 1213 tBTM_BLE_EXT_ADV_DATA_STATUS data_status; 1214 UINT8 data_length; 1215 UINT8 *data; 1216 } tBTM_PERIOD_ADV_REPORT; 1217 1218 typedef struct { 1219 UINT16 sync_handle; 1220 } tBTM_BLE_PERIOD_ADV_SYNC_LOST; 1221 1222 typedef struct { 1223 UINT8 status; 1224 UINT16 sync_handle; 1225 UINT8 sid; 1226 tBLE_ADDR_TYPE adv_addr_type; 1227 BD_ADDR adv_addr; 1228 UINT8 adv_phy; 1229 UINT16 period_adv_interval; 1230 UINT8 adv_clk_accuracy; 1231 } tBTM_BLE_PERIOD_ADV_SYNC_ESTAB; 1232 1233 typedef struct { 1234 UINT16 scan_interval; 1235 UINT16 scan_window; 1236 UINT16 interval_min; 1237 UINT16 interval_max; 1238 UINT16 latency; 1239 UINT16 supervision_timeout; 1240 UINT16 min_ce_len; 1241 UINT16 max_ce_len; 1242 } tBTM_BLE_CONN_PARAMS; 1243 1244 1245 typedef union { 1246 UINT8 status; 1247 tBTM_BLE_READ_PHY_CMPL read_phy; 1248 tBTM_BLE_SET_PREF_DEF_PHY_CMPL set_perf_def_phy; 1249 tBTM_BLE_SET_PERF_PHY_CMPL set_perf_phy; 1250 tBTM_BLE_EXT_ADV_SET_RAND_ADDR_CMPL set_ext_rand_addr; 1251 tBTM_BLE_EXT_ADV_SET_PARAMS_CMPL set_params; 1252 tBTM_BLE_EXT_ADV_DATA_SET_CMPL adv_data_set; 1253 tBTM_BLE_EXT_ADV_SCAN_RSP_DATA_SET_CMPL scan_rsp_data_set; 1254 tBTM_BLE_EXT_ADV_START_CMPL adv_start; 1255 tBTM_BLE_EXT_ADV_STOP_CMPL adv_stop; 1256 tBTM_BLE_PERIOD_ADV_SET_PARAMS_CMPL per_adv_set_params; 1257 tBTM_BLE_PERIOD_ADV_DATA_SET_CMPL per_adv_data_set; 1258 tBTM_BLE_PERIOD_ADV_START_CMPL per_adv_start; 1259 tBTM_BLE_PERIOD_ADV_STOP_CMPL per_adv_stop; 1260 tBTM_BLE_PERIOD_ADV_SYNC_CREATE_CMPL per_adv_sync_create; 1261 tBTM_BLE_PERIOD_ADV_SYNC_CANCEL_CMPL per_adv_sync_cancel; 1262 tBTM_BLE_PERIOD_ADV_SYNC_TEMINAT_CMPL per_adv_sync_term; 1263 tBTM_BLE_PERIOD_ADV_ADD_DEV_CMPL per_adv_add_dev; 1264 tBTM_BLE_PERIOD_ADV_REMOVE_DEV_CMPL per_adv_remove_dev; 1265 tBTM_BLE_PEROID_ADV_CLEAR_DEV_CMPL per_adv_clear_dev; 1266 tBTM_BLE_SET_EXT_SCAN_PARAMS_CMPL ext_scan; 1267 tBTM_BLE_EXT_SCAN_START_CMPL scan_start; 1268 tBTM_BLE_EXT_SCAN_STOP_CMPL scan_stop; 1269 tBTM_BLE_PREF_EXT_CONN_SET_PARAMS_CMPL ext_conn_set_params; 1270 tBTM_BLE_PHY_UPDATE_CMPL phy_update; 1271 tBTM_BLE_EXT_ADV_REPORT ext_adv_report; 1272 tBTM_BLE_ADV_TERMINAT adv_term; 1273 tBTM_BLE_SCAN_REQ_RECEIVED scan_req; 1274 tBTM_BLE_CHANNEL_SEL_ALG channel_sel; 1275 tBTM_PERIOD_ADV_REPORT period_adv_report; 1276 tBTM_BLE_PERIOD_ADV_SYNC_LOST sync_lost; 1277 tBTM_BLE_PERIOD_ADV_SYNC_ESTAB sync_estab; 1278 } tBTM_BLE_5_GAP_CB_PARAMS; 1279 1280 typedef struct { 1281 UINT8 phy_mask; 1282 tBTM_BLE_CONN_PARAMS phy_1m_conn_params; 1283 tBTM_BLE_CONN_PARAMS phy_2m_conn_params; 1284 tBTM_BLE_CONN_PARAMS phy_coded_conn_params; 1285 } tBTM_EXT_CONN_PARAMS; 1286 1287 typedef void (*tBTM_BLE_5_HCI_CBACK)(tBTM_BLE_5_GAP_EVENT event, tBTM_BLE_5_GAP_CB_PARAMS *params); 1288 1289 #endif //#if (BLE_50_FEATURE_SUPPORT == TRUE) 1290 1291 #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE) 1292 typedef struct { 1293 UINT8 status; 1294 UINT16 conn_handle; 1295 UINT16 service_data; 1296 UINT16 sync_handle; 1297 UINT8 adv_sid; 1298 UINT8 adv_addr_type; 1299 BD_ADDR adv_addr; 1300 UINT8 adv_phy; 1301 UINT16 period_adv_interval; 1302 UINT8 adv_clk_accuracy; 1303 } tBTM_BLE_PERIOD_ADV_SYNC_TRANS_RECV; 1304 #endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE) 1305 1306 /***************************************************************************** 1307 ** EXTERNAL FUNCTION DECLARATIONS 1308 *****************************************************************************/ 1309 /* 1310 #ifdef __cplusplus 1311 extern "C" { 1312 #endif 1313 */ 1314 1315 /******************************************************************************* 1316 ** 1317 ** Function BTM_BleRegiseterConnParamCallback 1318 ** 1319 ** Description register connection parameters update callback func 1320 ** 1321 ** Parameters: update_conn_param_cb 1322 ** 1323 ** Returns void 1324 ** 1325 *******************************************************************************/ 1326 void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb); 1327 1328 /******************************************************************************* 1329 ** 1330 ** Function BTM_SecAddBleDevice 1331 ** 1332 ** Description Add/modify device. This function will be normally called 1333 ** during host startup to restore all required information 1334 ** for a LE device stored in the NVRAM. 1335 ** 1336 ** Parameters: bd_addr - BD address of the peer 1337 ** bd_name - Name of the peer device. NULL if unknown. 1338 ** dev_type - Remote device's device type. 1339 ** addr_type - LE device address type. 1340 ** auth_mode - auth mode 1341 ** 1342 ** Returns TRUE if added OK, else FALSE 1343 ** 1344 *******************************************************************************/ 1345 //extern 1346 BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, 1347 tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type, UINT32 auth_mode); 1348 1349 /******************************************************************************* 1350 ** 1351 ** Function BTM_SecAddBleKey 1352 ** 1353 ** Description Add/modify LE device information. This function will be 1354 ** normally called during host startup to restore all required 1355 ** information stored in the NVRAM. 1356 ** 1357 ** Parameters: bd_addr - BD address of the peer 1358 ** p_le_key - LE key values. 1359 ** key_type - LE SMP key type. 1360 * 1361 ** Returns TRUE if added OK, else FALSE 1362 ** 1363 *******************************************************************************/ 1364 //extern 1365 BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, 1366 tBTM_LE_KEY_TYPE key_type); 1367 1368 /******************************************************************************* 1369 ** 1370 ** Function BTM_BleSetAdvParams 1371 ** 1372 ** Description This function is called to set advertising parameters. 1373 ** 1374 ** Parameters: None. 1375 ** 1376 ** Returns void 1377 ** 1378 *******************************************************************************/ 1379 //extern 1380 tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max, 1381 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map); 1382 1383 1384 1385 /******************************************************************************* 1386 ** 1387 ** Function BTM_BleSetAdvParamsAll 1388 ** 1389 ** Description This function is called to set all of the advertising parameters. 1390 ** 1391 ** Parameters: None. 1392 ** 1393 ** Returns void 1394 ** 1395 *******************************************************************************/ 1396 tBTM_STATUS BTM_BleSetAdvParamsAll(UINT16 adv_int_min, UINT16 adv_int_max, UINT8 adv_type, 1397 tBLE_ADDR_TYPE own_bda_type, tBLE_BD_ADDR *p_dir_bda, 1398 tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP afp, tBTM_START_ADV_CMPL_CBACK *adv_cb); 1399 1400 /******************************************************************************* 1401 ** 1402 ** Function BTM_BleStartAdv 1403 ** 1404 ** Description This function is called to start adv. 1405 ** 1406 ** Parameters: None. 1407 ** 1408 ** Returns status 1409 ** 1410 *******************************************************************************/ 1411 tBTM_STATUS BTM_BleStartAdv(void); 1412 1413 1414 /******************************************************************************* 1415 ** 1416 ** Function BTM_BleWriteAdvData 1417 ** 1418 ** Description This function is called to write advertising data. 1419 ** 1420 ** Parameters: None. 1421 ** 1422 ** Returns void 1423 ** 1424 *******************************************************************************/ 1425 //extern 1426 tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, 1427 tBTM_BLE_ADV_DATA *p_data); 1428 1429 /******************************************************************************* 1430 ** 1431 ** Function BTM_BleWriteLongAdvData 1432 ** 1433 ** Description This function is called to write long advertising data. 1434 ** 1435 ** Parameters: adv_data: long advertising data 1436 ** adv_data_len: the length of long advertising data 1437 ** 1438 ** Returns void 1439 ** 1440 *******************************************************************************/ 1441 tBTM_STATUS BTM_BleWriteLongAdvData(uint8_t *adv_data, uint8_t adv_data_len); 1442 1443 /******************************************************************************* 1444 ** 1445 ** Function BTM_BleWriteAdvDataRaw 1446 ** 1447 ** Description This function is called to write raw advertising data. 1448 ** 1449 ** Parameters: p_raw_adv : point to raw advertising data 1450 ** raw_adv_len : raw advertising data 1451 ** 1452 ** Returns BTM_SUCCESS means success. 1453 ** 1454 *******************************************************************************/ 1455 //extern 1456 tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len); 1457 1458 1459 tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr); 1460 1461 void BTM_BleClearRandAddress(void); 1462 1463 1464 /******************************************************************************* 1465 ** 1466 ** Function BTM_BleSetAdvParams 1467 ** 1468 ** Description This function is called to set advertising parameters. 1469 ** 1470 ** Parameters adv_int_min: minimum advertising interval 1471 ** adv_int_max: maximum advertising interval 1472 ** p_dir_bda: connectable direct initiator's LE device address 1473 ** chnl_map: advertising channel map. 1474 ** 1475 ** Returns void 1476 ** 1477 *******************************************************************************/ 1478 //extern 1479 void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, 1480 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map); 1481 1482 /******************************************************************************* 1483 ** 1484 ** Function BTM_BleObtainVendorCapabilities 1485 ** 1486 ** Description This function is called to obtain vendor capabilities 1487 ** 1488 ** Parameters p_cmn_vsc_cb - Returns the vendor capabilities 1489 ** 1490 ** Returns void 1491 ** 1492 *******************************************************************************/ 1493 //extern 1494 void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb); 1495 1496 /******************************************************************************* 1497 ** 1498 ** Function BTM_BleSetScanParams 1499 ** 1500 ** Description This function is called to set Scan parameters. 1501 ** 1502 ** Parameters client_if - Client IF value 1503 ** scan_interval - Scan interval 1504 ** scan_window - Scan window 1505 ** scan_type - Scan type 1506 ** scan_setup_status_cback - Scan setup status callback 1507 ** 1508 ** Returns void 1509 ** 1510 *******************************************************************************/ 1511 //extern 1512 void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval, 1513 UINT32 scan_window, tBLE_SCAN_MODE scan_type, 1514 tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback); 1515 1516 1517 1518 /******************************************************************************* 1519 ** 1520 ** Function BTM_BleSetScanFilterParams 1521 ** 1522 ** Description This function is called to set Scan Filter & parameters. 1523 ** 1524 ** Parameters client_if - Client IF value 1525 ** scan_interval - Scan interval 1526 ** scan_window - Scan window 1527 ** scan_type - Scan type 1528 ** addr_type_own - owner address type 1529 ** scan_duplicate_filter - scan duplicate filter 1530 ** scan_filter_policy - scan filter policy 1531 ** scan_setup_status_cback - Scan setup status callback 1532 ** 1533 ** Returns void 1534 ** 1535 *******************************************************************************/ 1536 tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window, 1537 tBLE_SCAN_MODE scan_mode, UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBTM_BLE_SFP scan_filter_policy, 1538 tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback); 1539 1540 1541 /******************************************************************************* 1542 ** 1543 ** Function BTM_BleGetVendorCapabilities 1544 ** 1545 ** Description This function reads local LE features 1546 ** 1547 ** Parameters p_cmn_vsc_cb : Locala LE capability structure 1548 ** 1549 ** Returns void 1550 ** 1551 *******************************************************************************/ 1552 //extern 1553 void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb); 1554 /******************************************************************************* 1555 ** 1556 ** Function BTM_BleSetStorageConfig 1557 ** 1558 ** Description This function is called to setup storage configuration and setup callbacks. 1559 ** 1560 ** Parameters UINT8 batch_scan_full_max -Batch scan full maximum 1561 UINT8 batch_scan_trunc_max - Batch scan truncated value maximum 1562 UINT8 batch_scan_notify_threshold - Threshold value 1563 tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback - Setup callback 1564 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold callback 1565 void *p_ref - Reference value 1566 ** 1567 ** Returns tBTM_STATUS 1568 ** 1569 *******************************************************************************/ 1570 //extern 1571 tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max, 1572 UINT8 batch_scan_trunc_max, 1573 UINT8 batch_scan_notify_threshold, 1574 tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback, 1575 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, 1576 tBTM_BLE_SCAN_REP_CBACK *p_cback, 1577 tBTM_BLE_REF_VALUE ref_value); 1578 1579 /******************************************************************************* 1580 ** 1581 ** Function BTM_BleEnableBatchScan 1582 ** 1583 ** Description This function is called to enable batch scan 1584 ** 1585 ** Parameters tBTM_BLE_BATCH_SCAN_MODE scan_mode - Batch scan mode 1586 UINT32 scan_interval -Scan interval 1587 UINT32 scan_window - Scan window value 1588 tBLE_ADDR_TYPE addr_type - Address type 1589 tBTM_BLE_DISCARD_RULE discard_rule - Data discard rules 1590 ** 1591 ** Returns tBTM_STATUS 1592 ** 1593 *******************************************************************************/ 1594 //extern 1595 tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode, 1596 UINT32 scan_interval, UINT32 scan_window, 1597 tBTM_BLE_DISCARD_RULE discard_rule, 1598 tBLE_ADDR_TYPE addr_type, 1599 tBTM_BLE_REF_VALUE ref_value); 1600 1601 /******************************************************************************* 1602 ** 1603 ** Function BTM_BleDisableBatchScan 1604 ** 1605 ** Description This function is called to disable batch scanning 1606 ** 1607 ** Parameters void 1608 ** 1609 ** Returns void 1610 ** 1611 *******************************************************************************/ 1612 //extern 1613 tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value); 1614 1615 /******************************************************************************* 1616 ** 1617 ** Function BTM_BleReadScanReports 1618 ** 1619 ** Description This function is called to read batch scan reports 1620 ** 1621 ** Parameters tBLE_SCAN_MODE scan_mode - Scan mode report to be read out 1622 tBTM_BLE_SCAN_REP_CBACK* p_cback - Reports callback 1623 ** 1624 ** Returns tBTM_STATUS 1625 ** 1626 *******************************************************************************/ 1627 //extern 1628 tBTM_STATUS BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, 1629 tBTM_BLE_REF_VALUE ref_value); 1630 1631 /******************************************************************************* 1632 ** 1633 ** Function BTM_BleTrackAdvertiser 1634 ** 1635 ** Description This function is called to read batch scan reports 1636 ** 1637 ** Parameters p_track_cback - Tracking callback 1638 ** ref_value - Reference value 1639 ** 1640 ** Returns tBTM_STATUS 1641 ** 1642 *******************************************************************************/ 1643 //extern 1644 tBTM_STATUS BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK *p_track_cback, 1645 tBTM_BLE_REF_VALUE ref_value); 1646 1647 /******************************************************************************* 1648 ** 1649 ** Function BTM_BleWriteScanRsp 1650 ** 1651 ** Description This function is called to write LE scan response. 1652 ** 1653 ** Parameters: p_scan_rsp: scan response. 1654 ** 1655 ** Returns status 1656 ** 1657 *******************************************************************************/ 1658 //extern 1659 tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, 1660 tBTM_BLE_ADV_DATA *p_data); 1661 1662 /******************************************************************************* 1663 ** 1664 ** Function BTM_BleWriteScanRspRaw 1665 ** 1666 ** Description This function is called to write raw scan response data 1667 ** 1668 ** Parameters: None. 1669 ** 1670 ** Returns void 1671 ** 1672 *******************************************************************************/ 1673 //extern 1674 tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len); 1675 1676 /******************************************************************************* 1677 ** 1678 ** Function BTM_BleObserve 1679 ** 1680 ** Description This procedure keep the device listening for advertising 1681 ** events from a broadcast device. 1682 ** 1683 ** Parameters start: start or stop observe. 1684 ** 1685 ** Returns void 1686 ** 1687 *******************************************************************************/ 1688 //extern 1689 tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration, 1690 tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb); 1691 1692 /******************************************************************************* 1693 ** 1694 ** Function BTM_BleScan 1695 ** 1696 ** Description This procedure keep the device listening for advertising 1697 ** events from a broadcast device. 1698 ** 1699 ** Parameters start: start or stop scan. 1700 ** 1701 ** Returns void 1702 ** 1703 *******************************************************************************/ 1704 //extern 1705 tBTM_STATUS BTM_BleScan(BOOLEAN start, UINT32 duration, 1706 tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb, tBTM_INQ_DIS_CB *p_discard_cb); 1707 1708 1709 /******************************************************************************* 1710 ** 1711 ** Function BTM_GetDeviceIDRoot 1712 ** 1713 ** Description This function is called to read the local device identity 1714 ** root. 1715 ** 1716 ** Returns void 1717 ** the local device ER is copied into er 1718 ** 1719 *******************************************************************************/ 1720 //extern 1721 void BTM_GetDeviceIDRoot (BT_OCTET16 ir); 1722 1723 /******************************************************************************* 1724 ** 1725 ** Function BTM_GetDeviceEncRoot 1726 ** 1727 ** Description This function is called to read the local device encryption 1728 ** root. 1729 ** 1730 ** Returns void 1731 ** the local device ER is copied into er 1732 ** 1733 *******************************************************************************/ 1734 //extern 1735 void BTM_GetDeviceEncRoot (BT_OCTET16 er); 1736 1737 /******************************************************************************* 1738 ** 1739 ** Function BTM_GetDeviceDHK 1740 ** 1741 ** Description This function is called to read the local device DHK. 1742 ** 1743 ** Returns void 1744 ** the local device DHK is copied into dhk 1745 ** 1746 *******************************************************************************/ 1747 //extern 1748 void BTM_GetDeviceDHK (BT_OCTET16 dhk); 1749 1750 /******************************************************************************* 1751 ** 1752 ** Function BTM_SecurityGrant 1753 ** 1754 ** Description This function is called to grant security process. 1755 ** 1756 ** Parameters bd_addr - peer device bd address. 1757 ** res - result of the operation BTM_SUCCESS if success. 1758 ** Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts. 1759 ** 1760 ** Returns None 1761 ** 1762 *******************************************************************************/ 1763 //extern 1764 void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res); 1765 1766 /******************************************************************************* 1767 ** 1768 ** Function BTM_BlePasskeyReply 1769 ** 1770 ** Description This function is called after Security Manager submitted 1771 ** passkey request to the application. 1772 ** 1773 ** Parameters: bd_addr - Address of the device for which passkey was requested 1774 ** res - result of the operation SMP_SUCCESS if success 1775 ** passkey - numeric value in the range of 1776 ** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)). 1777 ** 1778 *******************************************************************************/ 1779 //extern 1780 void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey); 1781 1782 /******************************************************************************* 1783 ** 1784 ** Function BTM_BleSetStaticPasskey 1785 ** 1786 ** Description This function is called to set static passkey 1787 ** 1788 ** 1789 ** Parameters: add - set static passkey when add is TRUE 1790 ** clear static passkey when add is FALSE 1791 ** passkey - static passkey 1792 ** 1793 ** 1794 *******************************************************************************/ 1795 void BTM_BleSetStaticPasskey(BOOLEAN add, UINT32 passkey); 1796 1797 /******************************************************************************* 1798 ** 1799 ** Function BTM_BleConfirmReply 1800 ** 1801 ** Description This function is called after Security Manager submitted 1802 ** numeric comparison request to the application. 1803 ** 1804 ** Parameters: bd_addr - Address of the device with which numeric 1805 ** comparison was requested 1806 ** res - comparison result BTM_SUCCESS if success 1807 ** 1808 *******************************************************************************/ 1809 //extern 1810 void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res); 1811 1812 /******************************************************************************* 1813 ** 1814 ** Function BTM_LeOobDataReply 1815 ** 1816 ** Description This function is called to provide the OOB data for 1817 ** SMP in response to BTM_LE_OOB_REQ_EVT 1818 ** 1819 ** Parameters: bd_addr - Address of the peer device 1820 ** res - result of the operation SMP_SUCCESS if success 1821 ** p_data - simple pairing Randomizer C. 1822 ** 1823 *******************************************************************************/ 1824 //extern 1825 void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data); 1826 1827 /******************************************************************************* 1828 ** 1829 ** Function BTM_BleSecureConnectionOobDataReply 1830 ** 1831 ** Description This function is called to provide the OOB data for 1832 ** SMP in response to BTM_LE_SC_OOB_REQ_EVT when secure connection 1833 ** 1834 ** Parameters: bd_addr - Address of the peer device 1835 ** p_c - pointer to Confirmation 1836 ** p_r - pointer to Randomizer 1837 ** 1838 *******************************************************************************/ 1839 void BTM_BleSecureConnectionOobDataReply(BD_ADDR bd_addr, UINT8 *p_c, UINT8 *p_r); 1840 1841 /******************************************************************************* 1842 ** 1843 ** Function BTM_BleSecureConnectionCreateOobData 1844 ** 1845 ** Description This function is called to create the OOB data for 1846 ** SMP when secure connection 1847 ** 1848 *******************************************************************************/ 1849 void BTM_BleSecureConnectionCreateOobData(void); 1850 1851 /******************************************************************************* 1852 ** 1853 ** Function BTM_BleDataSignature 1854 ** 1855 ** Description This function is called to sign the data using AES128 CMAC 1856 ** algorith. 1857 ** 1858 ** Parameter bd_addr: target device the data to be signed for. 1859 ** p_text: singing data 1860 ** len: length of the signing data 1861 ** signature: output parameter where data signature is going to 1862 ** be stored. 1863 ** 1864 ** Returns TRUE if signing sucessul, otherwise FALSE. 1865 ** 1866 *******************************************************************************/ 1867 //extern 1868 BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len, 1869 BLE_SIGNATURE signature); 1870 1871 /******************************************************************************* 1872 ** 1873 ** Function BTM_BleVerifySignature 1874 ** 1875 ** Description This function is called to verify the data signature 1876 ** 1877 ** Parameter bd_addr: target device the data to be signed for. 1878 ** p_orig: original data before signature. 1879 ** len: length of the signing data 1880 ** counter: counter used when doing data signing 1881 ** p_comp: signature to be compared against. 1882 1883 ** Returns TRUE if signature verified correctly; otherwise FALSE. 1884 ** 1885 *******************************************************************************/ 1886 //extern 1887 BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, 1888 UINT16 len, UINT32 counter, 1889 UINT8 *p_comp); 1890 1891 /******************************************************************************* 1892 ** 1893 ** Function BTM_ReadConnectionAddr 1894 ** 1895 ** Description This function is called to set the local device random address 1896 ** . 1897 ** 1898 ** Returns void 1899 ** 1900 *******************************************************************************/ 1901 //extern 1902 void BTM_ReadConnectionAddr (BD_ADDR remote_bda, BD_ADDR local_conn_addr, 1903 tBLE_ADDR_TYPE *p_addr_type); 1904 1905 1906 1907 /******************************************************************************* 1908 ** 1909 ** Function BTM_ReadRemoteConnectionAddr 1910 ** 1911 ** Description This function is read the remote device address currently used 1912 ** . 1913 ** 1914 ** Returns void 1915 ** 1916 *******************************************************************************/ 1917 //extern 1918 BOOLEAN BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, 1919 BD_ADDR conn_addr, 1920 tBLE_ADDR_TYPE *p_addr_type); 1921 1922 /******************************************************************************* 1923 ** 1924 ** Function BTM_BleLoadLocalKeys 1925 ** 1926 ** Description Local local identity key, encryption root or sign counter. 1927 ** 1928 ** Parameters: key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER 1929 ** or BTM_BLE_KEY_TYPE_COUNTER. 1930 ** p_key: pointer to the key. 1931 * 1932 ** Returns non2. 1933 ** 1934 *******************************************************************************/ 1935 //extern 1936 void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key); 1937 1938 1939 /******************************************************************************* 1940 ** 1941 ** Function BTM_BleSetBgConnType 1942 ** 1943 ** Description This function is called to set BLE background connection 1944 ** procedure type. It can be auto connection, or selective connection. 1945 ** 1946 ** Parameters conn_type: it can be auto connection, or selective connection. 1947 ** p_select_cback: callback function when selective connection procedure 1948 ** is being used. 1949 ** 1950 ** Returns void 1951 ** 1952 *******************************************************************************/ 1953 //extern 1954 BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE conn_type, 1955 tBTM_BLE_SEL_CBACK *p_select_cback); 1956 1957 /******************************************************************************* 1958 ** 1959 ** Function BTM_BleUpdateBgConnDev 1960 ** 1961 ** Description This function is called to add or remove a device into/from 1962 ** background connection procedure. The background connection 1963 * procedure is decided by the background connection type, it can be 1964 * auto connection, or selective connection. 1965 ** 1966 ** Parameters add_remove: TRUE to add; FALSE to remove. 1967 ** remote_bda: device address to add/remove. 1968 ** 1969 ** Returns void 1970 ** 1971 *******************************************************************************/ 1972 //extern 1973 BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda); 1974 1975 /******************************************************************************* 1976 ** 1977 ** Function BTM_BleClearBgConnDev 1978 ** 1979 ** Description This function is called to clear the whitelist, 1980 ** end any pending whitelist connections, 1981 * and reset the local bg device list. 1982 ** 1983 ** Parameters void 1984 ** 1985 ** Returns void 1986 ** 1987 *******************************************************************************/ 1988 //extern 1989 void BTM_BleClearBgConnDev(void); 1990 1991 /******************************************************** 1992 ** 1993 ** Function BTM_BleSetPrefConnParams 1994 ** 1995 ** Description Set a peripheral's preferred connection parameters. When 1996 ** any of the value does not want to be updated while others 1997 ** do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to 1998 ** leave untouched. 1999 ** 2000 ** Parameters: bd_addr - BD address of the peripheral 2001 ** min_conn_int - minimum preferred connection interval 2002 ** max_conn_int - maximum preferred connection interval 2003 ** slave_latency - preferred slave latency 2004 ** supervision_tout - preferred supervision timeout 2005 ** 2006 ** Returns void 2007 ** 2008 *******************************************************************************/ 2009 //extern 2010 void BTM_BleSetPrefConnParams (BD_ADDR bd_addr, 2011 UINT16 min_conn_int, UINT16 max_conn_int, 2012 UINT16 slave_latency, UINT16 supervision_tout); 2013 2014 /****************************************************************************** 2015 ** 2016 ** Function BTM_BleSetConnScanParams 2017 ** 2018 ** Description Set scan parameters used in BLE connection request 2019 ** 2020 ** Parameters: scan_interval - scan interval 2021 ** scan_window - scan window 2022 ** 2023 ** Returns void 2024 ** 2025 *******************************************************************************/ 2026 //extern 2027 void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window); 2028 2029 /****************************************************************************** 2030 ** 2031 ** Function BTM_BleReadControllerFeatures 2032 ** 2033 ** Description Reads BLE specific controller features 2034 ** 2035 ** Parameters: tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when features are read 2036 ** 2037 ** Returns void 2038 ** 2039 *******************************************************************************/ 2040 //extern 2041 void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_cback); 2042 2043 /******************************************************************************* 2044 ** 2045 ** Function BTM_CheckAdvData 2046 ** 2047 ** Description This function is called to get ADV data for a specific type. 2048 ** 2049 ** Parameters p_adv - pointer of ADV data 2050 ** type - finding ADV data type 2051 ** p_length - return the length of ADV data not including type 2052 ** 2053 ** Returns pointer of ADV data 2054 ** 2055 *******************************************************************************/ 2056 //extern 2057 UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length); 2058 2059 /******************************************************************************* 2060 ** 2061 ** Function BTM_BleGetCurrentAddress 2062 ** 2063 ** Description This function is called to get local used BLE address. 2064 ** 2065 ** Parameters: None. 2066 ** 2067 ** Returns success or fail 2068 ** 2069 *******************************************************************************/ 2070 BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type); 2071 2072 /******************************************************************************* 2073 ** 2074 ** Function BTM__BLEReadDiscoverability 2075 ** 2076 ** Description This function is called to read the current LE discoverability 2077 ** mode of the device. 2078 ** 2079 ** Returns BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or 2080 ** BTM_BLE_GENRAL_DISCOVERABLE 2081 ** 2082 *******************************************************************************/ 2083 UINT16 BTM_BleReadDiscoverability(void); 2084 2085 /******************************************************************************* 2086 ** 2087 ** Function BTM__BLEReadConnectability 2088 ** 2089 ** Description This function is called to read the current LE connectibility 2090 ** mode of the device. 2091 ** 2092 ** Returns BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE 2093 ** 2094 *******************************************************************************/ 2095 //extern 2096 UINT16 BTM_BleReadConnectability (void); 2097 2098 void BTM_Recovery_Pre_State(void); 2099 2100 /******************************************************************************* 2101 ** 2102 ** Function BTM_ReadDevInfo 2103 ** 2104 ** Description This function is called to read the device/address type 2105 ** of BD address. 2106 ** 2107 ** Parameter remote_bda: remote device address 2108 ** p_dev_type: output parameter to read the device type. 2109 ** p_addr_type: output parameter to read the address type. 2110 ** 2111 *******************************************************************************/ 2112 //extern 2113 void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, 2114 tBLE_ADDR_TYPE *p_addr_type); 2115 2116 2117 /******************************************************************************* 2118 ** 2119 ** Function BTM_ReadConnectedTransportAddress 2120 ** 2121 ** Description This function is called to read the paired device/address type of other device paired 2122 ** corresponding to the BD_address 2123 ** 2124 ** Parameter remote_bda: remote device address, carry out the transport address 2125 ** transport: active transport 2126 ** 2127 ** Return TRUE if an active link is identified; FALSE otherwise 2128 ** 2129 *******************************************************************************/ 2130 //extern 2131 BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, 2132 tBT_TRANSPORT transport); 2133 2134 /******************************************************************************* 2135 ** 2136 ** Function BTM_BleBroadcast 2137 ** 2138 ** Description This function is to start or stop broadcasting. 2139 ** 2140 ** Parameters start: start or stop broadcasting. 2141 ** 2142 ** Returns status. 2143 ** 2144 *******************************************************************************/ 2145 //extern 2146 tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cback); 2147 2148 /******************************************************************************* 2149 ** 2150 ** Function BTM_BleConfigPrivacy 2151 ** 2152 ** Description This function is called to enable or disable the privacy in 2153 ** the local device. 2154 ** 2155 ** Parameters enable: TRUE to enable it; FALSE to disable it. 2156 ** 2157 ** Returns BOOLEAN privacy mode set success; otherwise failed. 2158 ** 2159 *******************************************************************************/ 2160 //extern 2161 BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable, tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cabck); 2162 2163 /******************************************************************************* 2164 ** 2165 ** Function BTM_BleConfigLocalIcon 2166 ** 2167 ** Description This function is called to set local icon 2168 ** 2169 ** Parameters icon: appearance value. 2170 ** 2171 ** 2172 *******************************************************************************/ 2173 void BTM_BleConfigLocalIcon(uint16_t icon); 2174 2175 /******************************************************************************* 2176 ** 2177 ** Function BTM_BleConfigConnParams 2178 ** 2179 ** Description This function is called to set the connection parameters 2180 ** 2181 ** Parameters int_min: minimum connection interval 2182 ** int_max: maximum connection interval 2183 ** latency: slave latency 2184 ** timeout: supervision timeout 2185 ** 2186 *******************************************************************************/ 2187 void BTM_BleConfigConnParams(uint16_t int_min, uint16_t int_max, uint16_t latency, uint16_t timeout); 2188 2189 /******************************************************************************* 2190 ** 2191 ** Function BTM_BleLocalPrivacyEnabled 2192 ** 2193 ** Description Checks if local device supports private address 2194 ** 2195 ** Returns Return TRUE if local privacy is enabled else FALSE 2196 ** 2197 *******************************************************************************/ 2198 //extern 2199 BOOLEAN BTM_BleLocalPrivacyEnabled(void); 2200 2201 /******************************************************************************* 2202 ** 2203 ** Function BTM_BleEnableMixedPrivacyMode 2204 ** 2205 ** Description This function is called to enabled Mixed mode if privacy 1.2 2206 ** is applicable in controller. 2207 ** 2208 ** Parameters mixed_on: mixed mode to be used or not. 2209 ** 2210 ** Returns void 2211 ** 2212 *******************************************************************************/ 2213 //extern 2214 void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on); 2215 2216 /******************************************************************************* 2217 ** 2218 ** Function BTM_BleMaxMultiAdvInstanceCount 2219 ** 2220 ** Description Returns max number of multi adv instances supported by controller 2221 ** 2222 ** Returns Max multi adv instance count 2223 ** 2224 *******************************************************************************/ 2225 //extern 2226 UINT8 BTM_BleMaxMultiAdvInstanceCount(void); 2227 2228 /******************************************************************************* 2229 ** 2230 ** Function BTM_BleSetConnectableMode 2231 ** 2232 ** Description This function is called to set BLE connectable mode for a 2233 ** peripheral device. 2234 ** 2235 ** Parameters connectable_mode: directed connectable mode, or non-directed.It can 2236 ** be BTM_BLE_CONNECT_EVT, BTM_BLE_CONNECT_DIR_EVT or 2237 ** BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 2238 ** 2239 ** Returns BTM_ILLEGAL_VALUE if controller does not support BLE. 2240 ** BTM_SUCCESS is status set successfully; otherwise failure. 2241 ** 2242 *******************************************************************************/ 2243 //extern 2244 tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode); 2245 2246 /******************************************************************************* 2247 ** 2248 ** Function BTM_BleTurnOnPrivacyOnRemote 2249 ** 2250 ** Description This function is called to enable or disable the privacy on the 2251 ** remote device. 2252 ** 2253 ** Parameters bd_addr: remote device address. 2254 ** privacy_on: TRUE to enable it; FALSE to disable it. 2255 ** 2256 ** Returns void 2257 ** 2258 *******************************************************************************/ 2259 //extern 2260 void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr, 2261 BOOLEAN privacy_on); 2262 2263 /******************************************************************************* 2264 ** 2265 ** Function BTM_BleUpdateAdvWhitelist 2266 ** 2267 ** Description Add or remove device from advertising white list 2268 ** 2269 ** Returns void 2270 ** 2271 *******************************************************************************/ 2272 //extern 2273 BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda, tBLE_ADDR_TYPE addr_type, tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb); 2274 2275 /******************************************************************************* 2276 ** 2277 ** Function BTM_BleClearWhitelist 2278 ** 2279 ** Description Clear all white list 2280 ** 2281 ** Returns void 2282 ** 2283 *******************************************************************************/ 2284 void BTM_BleClearWhitelist(tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb); 2285 2286 /******************************************************************************* 2287 ** 2288 ** Function BTM_BleUpdateAdvFilterPolicy 2289 ** 2290 ** Description This function update the filter policy of advertiser. 2291 ** 2292 ** Parameter adv_policy: advertising filter policy 2293 ** 2294 ** Return void 2295 *******************************************************************************/ 2296 //extern 2297 void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy); 2298 2299 /******************************************************************************* 2300 ** 2301 ** Function BTM_BleReceiverTest 2302 ** 2303 ** Description This function is called to start the LE Receiver test 2304 ** 2305 ** Parameter rx_freq - Frequency Range 2306 ** p_cmd_cmpl_cback - Command Complete callback 2307 ** 2308 *******************************************************************************/ 2309 void BTM_BleReceiverTest(UINT8 rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback); 2310 2311 2312 /******************************************************************************* 2313 ** 2314 ** Function BTM_BleTransmitterTest 2315 ** 2316 ** Description This function is called to start the LE Transmitter test 2317 ** 2318 ** Parameter tx_freq - Frequency Range 2319 ** test_data_len - Length in bytes of payload data in each packet 2320 ** packet_payload - Pattern to use in the payload 2321 ** p_cmd_cmpl_cback - Command Complete callback 2322 ** 2323 *******************************************************************************/ 2324 void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len, 2325 UINT8 packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback); 2326 2327 /******************************************************************************* 2328 ** 2329 ** Function BTM_BleTestEnd 2330 ** 2331 ** Description This function is called to stop the in-progress TX or RX test 2332 ** 2333 ** Parameter p_cmd_cmpl_cback - Command complete callback 2334 ** 2335 *******************************************************************************/ 2336 void BTM_BleTestEnd(tBTM_CMPL_CB *p_cmd_cmpl_cback); 2337 2338 /******************************************************************************* 2339 ** 2340 ** Function BTM_UseLeLink 2341 ** 2342 ** Description This function is to select the underneath physical link to use. 2343 ** 2344 ** Returns TRUE to use LE, FALSE use BR/EDR. 2345 ** 2346 *******************************************************************************/ 2347 //extern 2348 BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr); 2349 2350 /******************************************************************************* 2351 ** 2352 ** Function BTM_BleStackEnable 2353 ** 2354 ** Description Enable/Disable BLE functionality on stack regarless controller 2355 ** capability. 2356 ** 2357 ** Parameters: enable: TRUE to enable, FALSE to disable. 2358 ** 2359 ** Returns TRUE if added OK, else FALSE 2360 ** 2361 *******************************************************************************/ 2362 //extern 2363 tBTM_STATUS BTM_BleStackEnable (BOOLEAN enable); 2364 2365 /******************************************************************************* 2366 ** 2367 ** Function BTM_GetLeSecurityState 2368 ** 2369 ** Description This function is called to get security mode 1 flags and 2370 ** encryption key size for LE peer. 2371 ** 2372 ** Returns BOOLEAN TRUE if LE device is found, FALSE otherwise. 2373 ** 2374 *******************************************************************************/ 2375 //extern 2376 BOOLEAN BTM_GetLeSecurityState (BD_ADDR bd_addr, 2377 UINT8 *p_le_dev_sec_flags, 2378 UINT8 *p_le_key_size); 2379 2380 /******************************************************************************* 2381 ** 2382 ** Function BTM_BleSecurityProcedureIsRunning 2383 ** 2384 ** Description This function indicates if LE security procedure is 2385 ** currently running with the peer. 2386 ** 2387 ** Returns BOOLEAN TRUE if security procedure is running, FALSE otherwise. 2388 ** 2389 *******************************************************************************/ 2390 //extern 2391 BOOLEAN BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr); 2392 2393 /******************************************************************************* 2394 ** 2395 ** Function BTM_BleGetSupportedKeySize 2396 ** 2397 ** Description This function gets the maximum encryption key size in bytes 2398 ** the local device can suport. 2399 ** record. 2400 ** 2401 ** Returns the key size or 0 if the size can't be retrieved. 2402 ** 2403 *******************************************************************************/ 2404 //extern 2405 UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr); 2406 2407 /*******************************************************************************/ 2408 /* Multi ADV API */ 2409 /******************************************************************************* 2410 ** 2411 ** Function BTM_BleEnableAdvInstance 2412 ** 2413 ** Description This function enable a Multi-ADV instance with the specified 2414 ** adv parameters 2415 ** 2416 ** Parameters p_params: pointer to the adv parameter structure, set as default 2417 ** adv parameter when the instance is enabled. 2418 ** p_cback: callback function for the adv instance. 2419 ** p_ref: reference data attach to the adv instance to be enabled. 2420 ** 2421 ** Returns status 2422 ** 2423 *******************************************************************************/ 2424 //extern 2425 tBTM_STATUS BTM_BleEnableAdvInstance (tBTM_BLE_ADV_PARAMS *p_params, 2426 tBTM_BLE_MULTI_ADV_CBACK *p_cback, 2427 void *p_ref); 2428 2429 /******************************************************************************* 2430 ** 2431 ** Function BTM_BleUpdateAdvInstParam 2432 ** 2433 ** Description This function update a Multi-ADV instance with the specififed 2434 ** adv parameters. 2435 ** 2436 ** Parameters inst_id: adv instance ID 2437 ** p_params: pointer to the adv parameter structure. 2438 ** 2439 ** Returns status 2440 ** 2441 *******************************************************************************/ 2442 //extern 2443 tBTM_STATUS BTM_BleUpdateAdvInstParam (UINT8 inst_id, tBTM_BLE_ADV_PARAMS *p_params); 2444 2445 /******************************************************************************* 2446 ** 2447 ** Function BTM_BleCfgAdvInstData 2448 ** 2449 ** Description This function configure a Multi-ADV instance with the specified 2450 ** adv data or scan response data. 2451 ** 2452 ** Parameters inst_id: adv instance ID 2453 ** is_scan_rsp: is this scacn response, if no set as adv data. 2454 ** data_mask: adv data mask. 2455 ** p_data: pointer to the adv data structure. 2456 ** 2457 ** Returns status 2458 ** 2459 *******************************************************************************/ 2460 //extern 2461 tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp, 2462 tBTM_BLE_AD_MASK data_mask, 2463 tBTM_BLE_ADV_DATA *p_data); 2464 2465 /******************************************************************************* 2466 ** 2467 ** Function BTM_BleDisableAdvInstance 2468 ** 2469 ** Description This function disable a Multi-ADV instance. 2470 ** 2471 ** Parameters inst_id: adv instance ID 2472 ** 2473 ** Returns status 2474 ** 2475 *******************************************************************************/ 2476 //extern 2477 tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id); 2478 2479 /******************************************************************************* 2480 ** 2481 ** Function BTM_BleAdvFilterParamSetup 2482 ** 2483 ** Description This function is called to setup the adv data payload filter 2484 ** condition. 2485 ** 2486 ** Parameters p_target: enabble the filter condition on a target device; if NULL 2487 ** enable the generic scan condition. 2488 ** enable: enable or disable the filter condition 2489 ** 2490 ** Returns void 2491 ** 2492 *******************************************************************************/ 2493 //extern 2494 tBTM_STATUS BTM_BleAdvFilterParamSetup(int action, 2495 tBTM_BLE_PF_FILT_INDEX filt_index, 2496 tBTM_BLE_PF_FILT_PARAMS *p_filt_params, 2497 tBLE_BD_ADDR *p_target, tBTM_BLE_PF_PARAM_CBACK *p_cmpl_cback, 2498 tBTM_BLE_REF_VALUE ref_value); 2499 2500 /******************************************************************************* 2501 ** 2502 ** Function BTM_BleCfgFilterCondition 2503 ** 2504 ** Description This function is called to configure the adv data payload filter 2505 ** condition. 2506 ** 2507 ** Parameters action: to read/write/clear 2508 ** cond_type: filter condition type. 2509 ** p_cond: filter condition paramter 2510 ** 2511 ** Returns tBTM_STATUS 2512 ** 2513 *******************************************************************************/ 2514 //extern 2515 tBTM_STATUS BTM_BleCfgFilterCondition(tBTM_BLE_SCAN_COND_OP action, 2516 tBTM_BLE_PF_COND_TYPE cond_type, 2517 tBTM_BLE_PF_FILT_INDEX filt_index, 2518 tBTM_BLE_PF_COND_PARAM *p_cond, 2519 tBTM_BLE_PF_CFG_CBACK *p_cmpl_cback, 2520 tBTM_BLE_REF_VALUE ref_value); 2521 2522 /******************************************************************************* 2523 ** 2524 ** Function BTM_BleEnableDisableFilterFeature 2525 ** 2526 ** Description This function is called to enable or disable the APCF feature 2527 ** 2528 ** Parameters enable - TRUE - enables the APCF, FALSE - disables the APCF 2529 ** ref_value - Ref value 2530 ** 2531 ** Returns tBTM_STATUS 2532 ** 2533 *******************************************************************************/ 2534 //extern 2535 tBTM_STATUS BTM_BleEnableDisableFilterFeature(UINT8 enable, 2536 tBTM_BLE_PF_STATUS_CBACK *p_stat_cback, 2537 tBTM_BLE_REF_VALUE ref_value); 2538 2539 /******************************************************************************* 2540 ** 2541 ** Function BTM_BleGetEnergyInfo 2542 ** 2543 ** Description This function obtains the energy info 2544 ** 2545 ** Parameters p_ener_cback - Callback pointer 2546 ** 2547 ** Returns status 2548 ** 2549 *******************************************************************************/ 2550 //extern 2551 tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback); 2552 2553 /******************************************************************************* 2554 ** 2555 ** Function BTM_SetBleDataLength 2556 ** 2557 ** Description This function is called to set maximum BLE transmission packet size 2558 ** 2559 ** Returns BTM_SUCCESS if success; otherwise failed. 2560 ** 2561 *******************************************************************************/ 2562 //extern 2563 tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length); 2564 2565 /******************************************************************************* 2566 ** 2567 ** Function BTM_UpdateBleDuplicateExceptionalList 2568 ** 2569 ** Description This function is called to update duplicate scan exceptional list. 2570 ** 2571 ** Parameters: subcode: add, remove or clean duplicate scan exceptional list. 2572 ** type: device info type 2573 ** device_info: device information 2574 ** update_exceptional_list_cmp_cb: complete callback 2575 ** 2576 ** Returns status 2577 ** 2578 *******************************************************************************/ 2579 2580 tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info, tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb); 2581 2582 /******************************************************************************* 2583 ** 2584 ** Function BTM_GetCurrentConnParams 2585 ** 2586 ** Description This function is called to read the current connection parameters 2587 ** of the device 2588 ** 2589 ** Returns TRUE or FALSE 2590 ** 2591 *******************************************************************************/ 2592 2593 BOOLEAN BTM_GetCurrentConnParams(BD_ADDR bda, uint16_t *interval, uint16_t *latency, uint16_t *timeout); 2594 2595 /******************************************************************************* 2596 ** 2597 ** Function BTM_Ble_Authorization 2598 ** 2599 ** Description This function is used to authorize a specified device 2600 ** 2601 ** Returns TRUE or FALSE 2602 ** 2603 *******************************************************************************/ 2604 BOOLEAN BTM_Ble_Authorization(BD_ADDR bd_addr, BOOLEAN authorize); 2605 /* 2606 #ifdef __cplusplus 2607 } 2608 #endif 2609 */ 2610 #if (BLE_50_FEATURE_SUPPORT == TRUE) 2611 void BTM_BleGapRegisterCallback(tBTM_BLE_5_HCI_CBACK cb); 2612 2613 tBTM_STATUS BTM_BleReadPhy(BD_ADDR bd_addr, UINT8 *tx_phy, UINT8 *rx_phy); 2614 2615 tBTM_STATUS BTM_BleSetPreferDefaultPhy(UINT8 tx_phy_mask, UINT8 rx_phy_mask); 2616 2617 tBTM_STATUS BTM_BleSetPreferPhy(BD_ADDR bd_addr, UINT8 all_phys, UINT8 tx_phy_mask, 2618 UINT8 rx_phy_mask, UINT16 phy_options); 2619 2620 tBTM_STATUS BTM_BleSetExtendedAdvRandaddr(UINT8 instance, BD_ADDR rand_addr); 2621 2622 tBTM_STATUS BTM_BleSetExtendedAdvParams(UINT8 instance, tBTM_BLE_GAP_EXT_ADV_PARAMS *params); 2623 2624 tBTM_STATUS BTM_BleConfigExtendedAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance, UINT16 len, UINT8 *data); 2625 2626 tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_adv); 2627 2628 tBTM_STATUS BTM_BleExtAdvSetRemove(UINT8 instance); 2629 2630 tBTM_STATUS BTM_BleExtAdvSetClear(void); 2631 2632 tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Params *params); 2633 2634 tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data); 2635 2636 tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, BOOLEAN enable); 2637 2638 tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params); 2639 2640 tBTM_STATUS BTM_BlePeriodicAdvSyncCancel(void); 2641 2642 tBTM_STATUS BTM_BlePeriodicAdvSyncTerm(UINT16 sync_handle); 2643 2644 tBTM_STATUS BTM_BlePeriodicAdvAddDevToList(tBLE_ADDR_TYPE addr_type, BD_ADDR addr, UINT16 sid); 2645 2646 tBTM_STATUS BTM_BlePeriodicAdvRemoveDevFromList(tBLE_ADDR_TYPE addr_type, BD_ADDR addr, UINT16 sid); 2647 2648 tBTM_STATUS BTM_BlePeriodicAdvClearDev(void); 2649 2650 tBTM_STATUS BTM_BleSetExtendedScanParams(tBTM_BLE_EXT_SCAN_PARAMS *params); 2651 2652 tBTM_STATUS BTM_BleExtendedScan(BOOLEAN enable, UINT16 duration, UINT16 period); 2653 2654 void BTM_BleSetPreferExtenedConnParams(BD_ADDR bd_addr, tBTM_EXT_CONN_PARAMS *params); 2655 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) 2656 2657 #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE) 2658 void BTM_BlePeriodicAdvSetInfoTrans(BD_ADDR bd_addr, UINT16 service_data, UINT8 adv_handle); 2659 2660 void BTM_BleSetPeriodicAdvSyncTransParams(BD_ADDR bd_addr, UINT8 mode, UINT16 skip, UINT16 sync_timeout, UINT8 cte_type); 2661 #endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE) 2662 2663 #endif 2664