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 "btm_api.h" 29#include "gki.h" 30#include <hardware/bt_common_types.h> 31 32#define CHNL_MAP_LEN 5 33typedef UINT8 tBTM_BLE_CHNL_MAP[CHNL_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 50typedef UINT8 tBTM_BLE_EVT; 51typedef UINT8 tBTM_BLE_CONN_MODE; 52 53typedef 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 58typedef 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 65typedef 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) 71typedef 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 84typedef 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 */ 101typedef 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 500 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 24 /* recommended min: 30ms = 24 * 1.25 */ 167#endif 168 169/* default connectino interval max */ 170#ifndef BTM_BLE_CONN_INT_MAX_DEF 171#define BTM_BLE_CONN_INT_MAX_DEF 40 /* recommended max: 50 ms = 56 * 1.25 */ 172#endif 173 174/* default slave latency */ 175#ifndef BTM_BLE_CONN_SLAVE_LATENCY_DEF 176#define BTM_BLE_CONN_SLAVE_LATENCY_DEF 0 /* 0 */ 177#endif 178 179/* default supervision timeout */ 180#ifndef BTM_BLE_CONN_TIMEOUT_DEF 181#define BTM_BLE_CONN_TIMEOUT_DEF 2000 182#endif 183 184/* minimum acceptable connection interval */ 185#ifndef BTM_BLE_CONN_INT_MIN_LIMIT 186#define BTM_BLE_CONN_INT_MIN_LIMIT 0x0009 187#endif 188 189#define BTM_BLE_DIR_CONN_FALLBACK_UNDIR 1 190#define BTM_BLE_DIR_CONN_FALLBACK_NO_ADV 2 191 192#ifndef BTM_BLE_DIR_CONN_FALLBACK 193#define BTM_BLE_DIR_CONN_FALLBACK BTM_BLE_DIR_CONN_FALLBACK_UNDIR 194#endif 195 196#define BTM_CMAC_TLEN_SIZE 8 /* 64 bits */ 197#define BTM_BLE_AUTH_SIGN_LEN 12 /* BLE data signature length 8 Bytes + 4 bytes counter*/ 198typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN]; /* Device address */ 199 200#ifndef BTM_BLE_HOST_SUPPORT 201#define BTM_BLE_HOST_SUPPORT 0x01 202#endif 203 204#ifndef BTM_BLE_SIMULTANEOUS_HOST 205#define BTM_BLE_SIMULTANEOUS_HOST 0x01 206#endif 207 208/* Appearance Values Reported with BTM_BLE_AD_TYPE_APPEARANCE */ 209#define BTM_BLE_APPEARANCE_UKNOWN 0x0000 210#define BTM_BLE_APPEARANCE_GENERIC_PHONE 0x0040 211#define BTM_BLE_APPEARANCE_GENERIC_COMPUTER 0x0080 212#define BTM_BLE_APPEARANCE_GENERIC_WATCH 0x00C0 213#define BTM_BLE_APPEARANCE_SPORTS_WATCH 0x00C1 214#define BTM_BLE_APPEARANCE_GENERIC_CLOCK 0x0100 215#define BTM_BLE_APPEARANCE_GENERIC_DISPLAY 0x0140 216#define BTM_BLE_APPEARANCE_GENERIC_REMOTE 0x0180 217#define BTM_BLE_APPEARANCE_GENERIC_EYEGLASSES 0x01C0 218#define BTM_BLE_APPEARANCE_GENERIC_TAG 0x0200 219#define BTM_BLE_APPEARANCE_GENERIC_KEYRING 0x0240 220#define BTM_BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 221#define BTM_BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 222#define BTM_BLE_APPEARANCE_GENERIC_THERMOMETER 0x0300 223#define BTM_BLE_APPEARANCE_THERMOMETER_EAR 0x0301 224#define BTM_BLE_APPEARANCE_GENERIC_HEART_RATE 0x0340 225#define BTM_BLE_APPEARANCE_HEART_RATE_BELT 0x0341 226#define BTM_BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 227#define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381 228#define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382 229#define BTM_BLE_APPEARANCE_GENERIC_HID 0x03C0 230#define BTM_BLE_APPEARANCE_HID_KEYBOARD 0x03C1 231#define BTM_BLE_APPEARANCE_HID_MOUSE 0x03C2 232#define BTM_BLE_APPEARANCE_HID_JOYSTICK 0x03C3 233#define BTM_BLE_APPEARANCE_HID_GAMEPAD 0x03C4 234#define BTM_BLE_APPEARANCE_HID_DIGITIZER_TABLET 0x03C5 235#define BTM_BLE_APPEARANCE_HID_CARD_READER 0x03C6 236#define BTM_BLE_APPEARANCE_HID_DIGITAL_PEN 0x03C7 237#define BTM_BLE_APPEARANCE_HID_BARCODE_SCANNER 0x03C8 238#define BTM_BLE_APPEARANCE_GENERIC_GLUCOSE 0x0400 239#define BTM_BLE_APPEARANCE_GENERIC_WALKING 0x0440 240#define BTM_BLE_APPEARANCE_WALKING_IN_SHOE 0x0441 241#define BTM_BLE_APPEARANCE_WALKING_ON_SHOE 0x0442 242#define BTM_BLE_APPEARANCE_WALKING_ON_HIP 0x0443 243#define BTM_BLE_APPEARANCE_GENERIC_CYCLING 0x0480 244#define BTM_BLE_APPEARANCE_CYCLING_COMPUTER 0x0481 245#define BTM_BLE_APPEARANCE_CYCLING_SPEED 0x0482 246#define BTM_BLE_APPEARANCE_CYCLING_CADENCE 0x0483 247#define BTM_BLE_APPEARANCE_CYCLING_POWER 0x0484 248#define BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 249#define BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 250#define BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 251#define BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 252#define BTM_BLE_APPEARANCE_GENERIC_WEIGHT 0x0C80 253#define BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS 0x1440 254#define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441 255#define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV 0x1442 256#define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD 0x1443 257#define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444 258 259 260/* Structure returned with Rand/Encrypt complete callback */ 261typedef struct 262{ 263 UINT8 status; 264 UINT8 param_len; 265 UINT16 opcode; 266 UINT8 param_buf[BT_OCTET16_LEN]; 267} tBTM_RAND_ENC; 268 269/* General callback function for notifying an application that a synchronous 270** BTM function is complete. The pointer contains the address of any returned data. 271*/ 272typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1); 273 274#define BTM_BLE_FILTER_TARGET_SCANNER 0x01 275#define BTM_BLE_FILTER_TARGET_ADVR 0x00 276 277#define BTM_BLE_POLICY_BLACK_ALL 0x00 /* relevant to both */ 278#define BTM_BLE_POLICY_ALLOW_SCAN 0x01 /* relevant to advertiser */ 279#define BTM_BLE_POLICY_ALLOW_CONN 0x02 /* relevant to advertiser */ 280#define BTM_BLE_POLICY_WHITE_ALL 0x03 /* relevant to both */ 281 282/* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */ 283#define BTM_BLE_LIMIT_DISC_FLAG (0x01 << 0) 284#define BTM_BLE_GEN_DISC_FLAG (0x01 << 1) 285#define BTM_BLE_BREDR_NOT_SPT (0x01 << 2) 286/* 4.1 spec adv flag for simultaneous BR/EDR+LE connection support */ 287#define BTM_BLE_DMT_CONTROLLER_SPT (0x01 << 3) 288#define BTM_BLE_DMT_HOST_SPT (0x01 << 4) 289#define BTM_BLE_NON_LIMIT_DISC_FLAG (0x00 ) /* lowest bit unset */ 290#define BTM_BLE_ADV_FLAG_MASK (BTM_BLE_LIMIT_DISC_FLAG | BTM_BLE_BREDR_NOT_SPT | BTM_BLE_GEN_DISC_FLAG) 291#define BTM_BLE_LIMIT_DISC_MASK (BTM_BLE_LIMIT_DISC_FLAG ) 292 293#define BTM_BLE_AD_BIT_DEV_NAME (0x00000001 << 0) 294#define BTM_BLE_AD_BIT_FLAGS (0x00000001 << 1) 295#define BTM_BLE_AD_BIT_MANU (0x00000001 << 2) 296#define BTM_BLE_AD_BIT_TX_PWR (0x00000001 << 3) 297#define BTM_BLE_AD_BIT_INT_RANGE (0x00000001 << 5) 298#define BTM_BLE_AD_BIT_SERVICE (0x00000001 << 6) 299#define BTM_BLE_AD_BIT_SERVICE_SOL (0x00000001 << 7) 300#define BTM_BLE_AD_BIT_SERVICE_DATA (0x00000001 << 8) 301#define BTM_BLE_AD_BIT_SIGN_DATA (0x00000001 << 9) 302#define BTM_BLE_AD_BIT_SERVICE_128SOL (0x00000001 << 10) 303#define BTM_BLE_AD_BIT_APPEARANCE (0x00000001 << 11) 304#define BTM_BLE_AD_BIT_PUBLIC_ADDR (0x00000001 << 12) 305#define BTM_BLE_AD_BIT_RANDOM_ADDR (0x00000001 << 13) 306#define BTM_BLE_AD_BIT_SERVICE_32 (0x00000001 << 4) 307#define BTM_BLE_AD_BIT_SERVICE_32SOL (0x00000001 << 14) 308#define BTM_BLE_AD_BIT_PROPRIETARY (0x00000001 << 15) 309#define BTM_BLE_AD_BIT_SERVICE_128 (0x00000001 << 16) /*128-bit Service UUIDs*/ 310 311typedef UINT32 tBTM_BLE_AD_MASK; 312 313#define BTM_BLE_AD_TYPE_FLAG HCI_EIR_FLAGS_TYPE /* 0x01 */ 314#define BTM_BLE_AD_TYPE_16SRV_PART HCI_EIR_MORE_16BITS_UUID_TYPE /* 0x02 */ 315#define BTM_BLE_AD_TYPE_16SRV_CMPL HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 */ 316#define BTM_BLE_AD_TYPE_32SRV_PART HCI_EIR_MORE_32BITS_UUID_TYPE /* 0x04 */ 317#define BTM_BLE_AD_TYPE_32SRV_CMPL HCI_EIR_COMPLETE_32BITS_UUID_TYPE /* 0x05 */ 318#define BTM_BLE_AD_TYPE_128SRV_PART HCI_EIR_MORE_128BITS_UUID_TYPE /* 0x06 */ 319#define BTM_BLE_AD_TYPE_128SRV_CMPL HCI_EIR_COMPLETE_128BITS_UUID_TYPE /* 0x07 */ 320#define BTM_BLE_AD_TYPE_NAME_SHORT HCI_EIR_SHORTENED_LOCAL_NAME_TYPE /* 0x08 */ 321#define BTM_BLE_AD_TYPE_NAME_CMPL HCI_EIR_COMPLETE_LOCAL_NAME_TYPE /* 0x09 */ 322#define BTM_BLE_AD_TYPE_TX_PWR HCI_EIR_TX_POWER_LEVEL_TYPE /* 0x0A */ 323#define BTM_BLE_AD_TYPE_DEV_CLASS 0x0D 324#define BTM_BLE_AD_TYPE_SM_TK 0x10 325#define BTM_BLE_AD_TYPE_SM_OOB_FLAG 0x11 326#define BTM_BLE_AD_TYPE_INT_RANGE 0x12 327#define BTM_BLE_AD_TYPE_SOL_SRV_UUID 0x14 328#define BTM_BLE_AD_TYPE_128SOL_SRV_UUID 0x15 329#define BTM_BLE_AD_TYPE_SERVICE_DATA 0x16 330#define BTM_BLE_AD_TYPE_PUBLIC_TARGET 0x17 331#define BTM_BLE_AD_TYPE_RANDOM_TARGET 0x18 332#define BTM_BLE_AD_TYPE_APPEARANCE 0x19 333#define BTM_BLE_AD_TYPE_ADV_INT 0x1a 334#define BTM_BLE_AD_TYPE_32SOL_SRV_UUID 0x1b 335#define BTM_BLE_AD_TYPE_32SERVICE_DATA 0x1c 336#define BTM_BLE_AD_TYPE_128SERVICE_DATA 0x1d 337 338#define BTM_BLE_AD_TYPE_MANU HCI_EIR_MANUFACTURER_SPECIFIC_TYPE /* 0xff */ 339typedef UINT8 tBTM_BLE_AD_TYPE; 340 341/* Security settings used with L2CAP LE COC */ 342#define BTM_SEC_LE_LINK_ENCRYPTED 0x01 343#define BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM 0x02 344#define BTM_SEC_LE_LINK_PAIRED_WITH_MITM 0x04 345 346/* Min/max Preferred number of payload octets that the local Controller 347 should include in a single Link Layer Data Channel PDU. */ 348#define BTM_BLE_DATA_SIZE_MAX 0x00fb 349#define BTM_BLE_DATA_SIZE_MIN 0x001b 350 351/* Preferred maximum number of microseconds that the local Controller 352 should use to transmit a single Link Layer Data Channel PDU. */ 353#define BTM_BLE_DATA_TX_TIME_MIN 0x0148 354#define BTM_BLE_DATA_TX_TIME_MAX 0x0848 355 356/* adv tx power level */ 357#define BTM_BLE_ADV_TX_POWER_MIN 0 /* minimum tx power */ 358#define BTM_BLE_ADV_TX_POWER_LOW 1 /* low tx power */ 359#define BTM_BLE_ADV_TX_POWER_MID 2 /* middle tx power */ 360#define BTM_BLE_ADV_TX_POWER_UPPER 3 /* upper tx power */ 361#define BTM_BLE_ADV_TX_POWER_MAX 4 /* maximum tx power */ 362typedef UINT8 tBTM_BLE_ADV_TX_POWER; 363 364/* adv tx power in dBm */ 365typedef struct 366{ 367 UINT8 adv_inst_max; /* max adv instance supported in controller */ 368 UINT8 rpa_offloading; 369 UINT16 tot_scan_results_strg; 370 UINT8 max_irk_list_sz; 371 UINT8 filter_support; 372 UINT8 max_filter; 373 UINT8 energy_support; 374 BOOLEAN values_read; 375 UINT16 version_supported; 376 UINT16 total_trackable_advertisers; 377 UINT8 extended_scan_support; 378 UINT8 debug_logging_supported; 379}tBTM_BLE_VSC_CB; 380 381/* slave preferred connection interval range */ 382typedef struct 383{ 384 UINT16 low; 385 UINT16 hi; 386 387}tBTM_BLE_INT_RANGE; 388 389/* Service tag supported in the device */ 390typedef struct 391{ 392 UINT8 num_service; 393 BOOLEAN list_cmpl; 394 UINT16 *p_uuid; 395}tBTM_BLE_SERVICE; 396 397/* 32 bits Service supported in the device */ 398typedef struct 399{ 400 UINT8 num_service; 401 BOOLEAN list_cmpl; 402 UINT32 *p_uuid; 403}tBTM_BLE_32SERVICE; 404 405/* 128 bits Service supported in the device */ 406typedef struct 407{ 408 BOOLEAN list_cmpl; 409 UINT8 uuid128[MAX_UUID_SIZE]; 410}tBTM_BLE_128SERVICE; 411 412typedef struct 413{ 414 UINT8 len; 415 UINT8 *p_val; 416}tBTM_BLE_MANU; 417 418 419typedef struct 420{ 421 tBT_UUID service_uuid; 422 UINT8 len; 423 UINT8 *p_val; 424}tBTM_BLE_SERVICE_DATA; 425 426typedef struct 427{ 428 UINT8 adv_type; 429 UINT8 len; 430 UINT8 *p_val; /* number of len byte */ 431}tBTM_BLE_PROP_ELEM; 432 433typedef struct 434{ 435 UINT8 num_elem; 436 tBTM_BLE_PROP_ELEM *p_elem; 437}tBTM_BLE_PROPRIETARY; 438 439typedef struct 440{ 441 tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */ 442 tBTM_BLE_MANU *p_manu; /* manufactuer data */ 443 tBTM_BLE_SERVICE *p_services; /* services */ 444 tBTM_BLE_128SERVICE *p_services_128b; /* 128 bits service */ 445 tBTM_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */ 446 tBTM_BLE_SERVICE *p_sol_services; /* 16 bits services Solicitation UUIDs */ 447 tBTM_BLE_32SERVICE *p_sol_service_32b; /* List of 32 bit Service Solicitation UUIDs */ 448 tBTM_BLE_128SERVICE *p_sol_service_128b; /* List of 128 bit Service Solicitation UUIDs */ 449 tBTM_BLE_PROPRIETARY *p_proprietary; 450 tBTM_BLE_SERVICE_DATA *p_service_data; /* service data */ 451 UINT16 appearance; 452 UINT8 flag; 453 UINT8 tx_power; 454}tBTM_BLE_ADV_DATA; 455 456#ifndef BTM_BLE_MULTI_ADV_MAX 457#define BTM_BLE_MULTI_ADV_MAX 16 /* controller returned adv_inst_max should be less 458 than this number */ 459#endif 460 461#define BTM_BLE_MULTI_ADV_INVALID 0 462 463#define BTM_BLE_MULTI_ADV_ENB_EVT 1 464#define BTM_BLE_MULTI_ADV_DISABLE_EVT 2 465#define BTM_BLE_MULTI_ADV_PARAM_EVT 3 466#define BTM_BLE_MULTI_ADV_DATA_EVT 4 467typedef UINT8 tBTM_BLE_MULTI_ADV_EVT; 468 469#define BTM_BLE_MULTI_ADV_DEFAULT_STD 0 470 471typedef struct 472{ 473 UINT16 adv_int_min; 474 UINT16 adv_int_max; 475 UINT8 adv_type; 476 tBTM_BLE_ADV_CHNL_MAP channel_map; 477 tBTM_BLE_AFP adv_filter_policy; 478 tBTM_BLE_ADV_TX_POWER tx_power; 479}tBTM_BLE_ADV_PARAMS; 480 481typedef struct 482{ 483 UINT8 *p_sub_code; /* dynamic array to store sub code */ 484 UINT8 *p_inst_id; /* dynamic array to store instance id */ 485 UINT8 pending_idx; 486 UINT8 next_idx; 487}tBTM_BLE_MULTI_ADV_OPQ; 488 489typedef void (tBTM_BLE_MULTI_ADV_CBACK)(tBTM_BLE_MULTI_ADV_EVT evt, UINT8 inst_id, 490 void *p_ref, tBTM_STATUS status); 491 492typedef struct 493{ 494 UINT8 inst_id; 495 BOOLEAN in_use; 496 UINT8 adv_evt; 497 BD_ADDR rpa; 498 TIMER_LIST_ENT raddr_timer_ent; 499 tBTM_BLE_MULTI_ADV_CBACK *p_cback; 500 void *p_ref; 501 UINT8 index; 502}tBTM_BLE_MULTI_ADV_INST; 503 504typedef struct 505{ 506 UINT8 inst_index_queue[BTM_BLE_MULTI_ADV_MAX]; 507 int front; 508 int rear; 509}tBTM_BLE_MULTI_ADV_INST_IDX_Q; 510 511typedef struct 512{ 513 tBTM_BLE_MULTI_ADV_INST *p_adv_inst; /* dynamic array to store adv instance */ 514 tBTM_BLE_MULTI_ADV_OPQ op_q; 515}tBTM_BLE_MULTI_ADV_CB; 516 517typedef UINT8 tGATT_IF; 518 519typedef void (tBTM_BLE_SCAN_THRESHOLD_CBACK)(tBTM_BLE_REF_VALUE ref_value); 520typedef void (tBTM_BLE_SCAN_REP_CBACK)(tBTM_BLE_REF_VALUE ref_value, UINT8 report_format, 521 UINT8 num_records, UINT16 total_len, 522 UINT8* p_rep_data, UINT8 status); 523typedef void (tBTM_BLE_SCAN_SETUP_CBACK)(UINT8 evt, tBTM_BLE_REF_VALUE ref_value, UINT8 status); 524 525#ifndef BTM_BLE_BATCH_SCAN_MAX 526#define BTM_BLE_BATCH_SCAN_MAX 5 527#endif 528 529#ifndef BTM_BLE_BATCH_REP_MAIN_Q_SIZE 530#define BTM_BLE_BATCH_REP_MAIN_Q_SIZE 2 531#endif 532 533typedef enum 534{ 535 BTM_BLE_SCAN_INVALID_STATE=0, 536 BTM_BLE_SCAN_ENABLE_CALLED=1, 537 BTM_BLE_SCAN_ENABLED_STATE=2, 538 BTM_BLE_SCAN_DISABLE_CALLED=3, 539 BTM_BLE_SCAN_DISABLED_STATE=4 540}tBTM_BLE_BATCH_SCAN_STATE; 541 542enum 543{ 544 BTM_BLE_DISCARD_OLD_ITEMS, 545 BTM_BLE_DISCARD_LOWER_RSSI_ITEMS 546}; 547typedef UINT8 tBTM_BLE_DISCARD_RULE; 548 549typedef struct 550{ 551 UINT8 sub_code[BTM_BLE_BATCH_SCAN_MAX]; 552 tBTM_BLE_BATCH_SCAN_STATE cur_state[BTM_BLE_BATCH_SCAN_MAX]; 553 tBTM_BLE_REF_VALUE ref_value[BTM_BLE_BATCH_SCAN_MAX]; 554 UINT8 pending_idx; 555 UINT8 next_idx; 556}tBTM_BLE_BATCH_SCAN_OPQ; 557 558typedef struct 559{ 560 UINT8 rep_mode[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 561 tBTM_BLE_REF_VALUE ref_value[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 562 UINT8 num_records[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 563 UINT16 data_len[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 564 UINT8 *p_data[BTM_BLE_BATCH_REP_MAIN_Q_SIZE]; 565 UINT8 pending_idx; 566 UINT8 next_idx; 567}tBTM_BLE_BATCH_SCAN_REP_Q; 568 569typedef struct 570{ 571 tBTM_BLE_BATCH_SCAN_STATE cur_state; 572 tBTM_BLE_BATCH_SCAN_MODE scan_mode; 573 UINT32 scan_interval; 574 UINT32 scan_window; 575 tBLE_ADDR_TYPE addr_type; 576 tBTM_BLE_DISCARD_RULE discard_rule; 577 tBTM_BLE_BATCH_SCAN_OPQ op_q; 578 tBTM_BLE_BATCH_SCAN_REP_Q main_rep_q; 579 tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback; 580 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback; 581 tBTM_BLE_SCAN_REP_CBACK *p_scan_rep_cback; 582 tBTM_BLE_REF_VALUE ref_value; 583}tBTM_BLE_BATCH_SCAN_CB; 584 585/* filter selection bit index */ 586#define BTM_BLE_PF_ADDR_FILTER 0 587#define BTM_BLE_PF_SRVC_DATA 1 588#define BTM_BLE_PF_SRVC_UUID 2 589#define BTM_BLE_PF_SRVC_SOL_UUID 3 590#define BTM_BLE_PF_LOCAL_NAME 4 591#define BTM_BLE_PF_MANU_DATA 5 592#define BTM_BLE_PF_SRVC_DATA_PATTERN 6 593#define BTM_BLE_PF_TYPE_ALL 7 /* when passed in payload filter type all, only clear action is applicable */ 594#define BTM_BLE_PF_TYPE_MAX 8 595 596/* max number of filter spot for different filter type */ 597#ifndef BTM_BLE_MAX_UUID_FILTER 598#define BTM_BLE_MAX_UUID_FILTER 8 599#endif 600#ifndef BTM_BLE_MAX_ADDR_FILTER 601#define BTM_BLE_MAX_ADDR_FILTER 8 602#endif 603#ifndef BTM_BLE_PF_STR_COND_MAX 604#define BTM_BLE_PF_STR_COND_MAX 4 /* apply to manu data , or local name */ 605#endif 606#ifndef BTM_BLE_PF_STR_LEN_MAX 607#define BTM_BLE_PF_STR_LEN_MAX 29 /* match for first 29 bytes */ 608#endif 609 610typedef UINT8 tBTM_BLE_PF_COND_TYPE; 611 612#define BTM_BLE_PF_LOGIC_OR 0 613#define BTM_BLE_PF_LOGIC_AND 1 614typedef UINT8 tBTM_BLE_PF_LOGIC_TYPE; 615 616#define BTM_BLE_PF_ENABLE 1 617#define BTM_BLE_PF_CONFIG 2 618typedef UINT8 tBTM_BLE_PF_ACTION; 619 620typedef UINT8 tBTM_BLE_PF_FILT_INDEX; 621 622typedef UINT8 tBTM_BLE_PF_AVBL_SPACE; 623 624#define BTM_BLE_PF_BRDCAST_ADDR_FILT 1 625#define BTM_BLE_PF_SERV_DATA_CHG_FILT 2 626#define BTM_BLE_PF_SERV_UUID 4 627#define BTM_BLE_PF_SERV_SOLC_UUID 8 628#define BTM_BLE_PF_LOC_NAME_CHECK 16 629#define BTM_BLE_PF_MANUF_NAME_CHECK 32 630#define BTM_BLE_PF_SERV_DATA_CHECK 64 631typedef UINT16 tBTM_BLE_PF_FEAT_SEL; 632 633#define BTM_BLE_PF_LIST_LOGIC_OR 1 634#define BTM_BLE_PF_LIST_LOGIC_AND 2 635typedef UINT16 tBTM_BLE_PF_LIST_LOGIC_TYPE; 636 637#define BTM_BLE_PF_FILT_LOGIC_OR 0 638#define BTM_BLE_PF_FILT_LOGIC_AND 1 639typedef UINT16 tBTM_BLE_PF_FILT_LOGIC_TYPE; 640 641typedef UINT8 tBTM_BLE_PF_RSSI_THRESHOLD; 642typedef UINT8 tBTM_BLE_PF_DELIVERY_MODE; 643typedef UINT16 tBTM_BLE_PF_TIMEOUT; 644typedef UINT8 tBTM_BLE_PF_TIMEOUT_CNT; 645typedef UINT16 tBTM_BLE_PF_ADV_TRACK_ENTRIES; 646 647typedef struct 648{ 649 tBTM_BLE_PF_FEAT_SEL feat_seln; 650 tBTM_BLE_PF_LIST_LOGIC_TYPE logic_type; 651 tBTM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type; 652 tBTM_BLE_PF_RSSI_THRESHOLD rssi_high_thres; 653 tBTM_BLE_PF_RSSI_THRESHOLD rssi_low_thres; 654 tBTM_BLE_PF_DELIVERY_MODE dely_mode; 655 tBTM_BLE_PF_TIMEOUT found_timeout; 656 tBTM_BLE_PF_TIMEOUT lost_timeout; 657 tBTM_BLE_PF_TIMEOUT_CNT found_timeout_cnt; 658 tBTM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries; 659}tBTM_BLE_PF_FILT_PARAMS; 660 661enum 662{ 663 BTM_BLE_SCAN_COND_ADD, 664 BTM_BLE_SCAN_COND_DELETE, 665 BTM_BLE_SCAN_COND_CLEAR = 2 666}; 667typedef UINT8 tBTM_BLE_SCAN_COND_OP; 668 669enum 670{ 671 BTM_BLE_FILT_ENABLE_DISABLE = 1, 672 BTM_BLE_FILT_CFG = 2, 673 BTM_BLE_FILT_ADV_PARAM = 3 674}; 675 676typedef UINT8 tBTM_BLE_FILT_CB_EVT; 677 678/* BLE adv payload filtering config complete callback */ 679typedef void (tBTM_BLE_PF_CFG_CBACK)(tBTM_BLE_PF_ACTION action, tBTM_BLE_SCAN_COND_OP cfg_op, 680 tBTM_BLE_PF_AVBL_SPACE avbl_space, tBTM_STATUS status, 681 tBTM_BLE_REF_VALUE ref_value); 682 683typedef void (tBTM_BLE_PF_CMPL_CBACK) (tBTM_BLE_PF_CFG_CBACK); 684 685/* BLE adv payload filtering status setup complete callback */ 686typedef void (tBTM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTM_STATUS status, 687 tBTM_BLE_REF_VALUE ref_value); 688 689/* BLE adv payload filtering param setup complete callback */ 690typedef void (tBTM_BLE_PF_PARAM_CBACK) (tBTM_BLE_PF_ACTION action_type, 691 tBTM_BLE_PF_AVBL_SPACE avbl_space, 692 tBTM_BLE_REF_VALUE ref_value, tBTM_STATUS status); 693 694typedef union 695{ 696 UINT16 uuid16_mask; 697 UINT32 uuid32_mask; 698 UINT8 uuid128_mask[LEN_UUID_128]; 699}tBTM_BLE_PF_COND_MASK; 700 701typedef struct 702{ 703 tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */ 704 tBT_UUID uuid; /* UUID condition */ 705 tBTM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */ 706 tBTM_BLE_PF_COND_MASK *p_uuid_mask; /* UUID mask */ 707}tBTM_BLE_PF_UUID_COND; 708 709typedef struct 710{ 711 UINT8 data_len; /* <= 20 bytes */ 712 UINT8 *p_data; 713}tBTM_BLE_PF_LOCAL_NAME_COND; 714 715typedef struct 716{ 717 UINT16 company_id; /* company ID */ 718 UINT8 data_len; /* <= 20 bytes */ 719 UINT8 *p_pattern; 720 UINT16 company_id_mask; /* UUID value mask */ 721 UINT8 *p_pattern_mask; /* Manufacturer data matching mask, 722 same length as data pattern, 723 set to all 0xff, match exact data */ 724}tBTM_BLE_PF_MANU_COND; 725 726typedef struct 727{ 728 UINT16 uuid; /* service ID */ 729 UINT8 data_len; /* <= 20 bytes */ 730 UINT8 *p_pattern; 731 UINT8 *p_pattern_mask; /* Service data matching mask, same length as data pattern, 732 set to all 0xff, match exact data */ 733}tBTM_BLE_PF_SRVC_PATTERN_COND; 734 735 736typedef union 737{ 738 tBLE_BD_ADDR target_addr; 739 tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */ 740 tBTM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */ 741 tBTM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */ 742 tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */ 743 tBTM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */ 744}tBTM_BLE_PF_COND_PARAM; 745 746typedef struct 747{ 748 UINT8 action_ocf[BTM_BLE_PF_TYPE_MAX]; 749 tBTM_BLE_REF_VALUE ref_value[BTM_BLE_PF_TYPE_MAX]; 750 tBTM_BLE_PF_PARAM_CBACK *p_filt_param_cback[BTM_BLE_PF_TYPE_MAX]; 751 tBTM_BLE_PF_CFG_CBACK *p_scan_cfg_cback[BTM_BLE_PF_TYPE_MAX]; 752 UINT8 cb_evt[BTM_BLE_PF_TYPE_MAX]; 753 UINT8 pending_idx; 754 UINT8 next_idx; 755}tBTM_BLE_ADV_FILTER_ADV_OPQ; 756 757#define BTM_BLE_MAX_FILTER_COUNTER (BTM_BLE_MAX_ADDR_FILTER + 1) /* per device filter + one generic filter indexed by 0 */ 758 759#ifndef BTM_CS_IRK_LIST_MAX 760#define BTM_CS_IRK_LIST_MAX 0x20 761#endif 762 763typedef struct 764{ 765 BOOLEAN in_use; 766 BD_ADDR bd_addr; 767 UINT8 pf_counter[BTM_BLE_PF_TYPE_MAX]; /* number of filter indexed by tBTM_BLE_PF_COND_TYPE */ 768}tBTM_BLE_PF_COUNT; 769 770typedef struct 771{ 772 BOOLEAN enable; 773 UINT8 op_type; 774 tBTM_BLE_PF_COUNT *p_addr_filter_count; /* per BDA filter array */ 775 tBLE_BD_ADDR cur_filter_target; 776 tBTM_BLE_PF_STATUS_CBACK *p_filt_stat_cback; 777 tBTM_BLE_ADV_FILTER_ADV_OPQ op_q; 778}tBTM_BLE_ADV_FILTER_CB; 779 780/* Sub codes */ 781#define BTM_BLE_META_PF_ENABLE 0x00 782#define BTM_BLE_META_PF_FEAT_SEL 0x01 783#define BTM_BLE_META_PF_ADDR 0x02 784#define BTM_BLE_META_PF_UUID 0x03 785#define BTM_BLE_META_PF_SOL_UUID 0x04 786#define BTM_BLE_META_PF_LOCAL_NAME 0x05 787#define BTM_BLE_META_PF_MANU_DATA 0x06 788#define BTM_BLE_META_PF_SRVC_DATA 0x07 789#define BTM_BLE_META_PF_ALL 0x08 790 791typedef UINT8 BTM_BLE_ADV_STATE; 792typedef UINT8 BTM_BLE_ADV_INFO_PRESENT; 793typedef UINT8 BTM_BLE_RSSI_VALUE; 794typedef UINT16 BTM_BLE_ADV_INFO_TIMESTAMP; 795 796/* These are the fields returned in each device adv packet. It 797** is returned in the results callback if registered. 798*/ 799typedef struct 800{ 801 UINT8 conn_mode; 802 tBTM_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */ 803 UINT8 flag; 804 UINT8 tx_power_level; 805 UINT8 remote_name_len; 806 UINT8 *p_remote_name; 807 tBTM_BLE_SERVICE service; 808} tBTM_BLE_INQ_DATA; 809 810enum 811{ 812 BTM_BLE_CONN_NONE, 813 BTM_BLE_CONN_AUTO, 814 BTM_BLE_CONN_SELECTIVE 815}; 816typedef UINT8 tBTM_BLE_CONN_TYPE; 817 818#define ADV_INFO_PRESENT 0x00 819#define NO_ADV_INFO_PRESENT 0x01 820 821typedef btgatt_track_adv_info_t tBTM_BLE_TRACK_ADV_DATA; 822 823typedef void (tBTM_BLE_TRACK_ADV_CBACK)(tBTM_BLE_TRACK_ADV_DATA *p_track_adv_data); 824 825typedef UINT8 tBTM_BLE_TRACK_ADV_EVT; 826 827typedef struct 828{ 829 tBTM_BLE_REF_VALUE ref_value; 830 tBTM_BLE_TRACK_ADV_CBACK *p_track_cback; 831}tBTM_BLE_ADV_TRACK_CB; 832 833enum 834{ 835 BTM_BLE_TRACK_ADV_ADD, 836 BTM_BLE_TRACK_ADV_REMOVE 837}; 838 839typedef UINT8 tBTM_BLE_TRACK_ADV_ACTION; 840 841#define BTM_BLE_MULTI_ADV_INVALID 0 842 843#define BTM_BLE_BATCH_SCAN_ENABLE_EVT 1 844#define BTM_BLE_BATCH_SCAN_CFG_STRG_EVT 2 845#define BTM_BLE_BATCH_SCAN_READ_REPTS_EVT 3 846#define BTM_BLE_BATCH_SCAN_THR_EVT 4 847#define BTM_BLE_BATCH_SCAN_PARAM_EVT 5 848#define BTM_BLE_BATCH_SCAN_DISABLE_EVT 6 849 850typedef UINT8 tBTM_BLE_BATCH_SCAN_EVT; 851 852typedef UINT32 tBTM_BLE_TX_TIME_MS; 853typedef UINT32 tBTM_BLE_RX_TIME_MS; 854typedef UINT32 tBTM_BLE_IDLE_TIME_MS; 855typedef UINT32 tBTM_BLE_ENERGY_USED; 856 857typedef void (tBTM_BLE_ENERGY_INFO_CBACK)(tBTM_BLE_TX_TIME_MS tx_time, tBTM_BLE_RX_TIME_MS rx_time, 858 tBTM_BLE_IDLE_TIME_MS idle_time, 859 tBTM_BLE_ENERGY_USED energy_used, 860 tBTM_STATUS status); 861 862typedef struct 863{ 864 tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback; 865}tBTM_BLE_ENERGY_INFO_CB; 866 867typedef BOOLEAN (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name); 868typedef void (tBTM_BLE_CTRL_FEATURES_CBACK)(tBTM_STATUS status); 869 870/* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */ 871typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, UINT8 *p_signing_data); 872typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match); 873/* random address set complete callback */ 874typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda); 875 876typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt); 877typedef void (*tBLE_SCAN_PARAM_SETUP_CBACK)(tGATT_IF client_if, tBTM_STATUS status); 878 879tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb; 880 881/***************************************************************************** 882** EXTERNAL FUNCTION DECLARATIONS 883*****************************************************************************/ 884#ifdef __cplusplus 885extern "C" { 886#endif 887/******************************************************************************* 888** 889** Function BTM_SecAddBleDevice 890** 891** Description Add/modify device. This function will be normally called 892** during host startup to restore all required information 893** for a LE device stored in the NVRAM. 894** 895** Parameters: bd_addr - BD address of the peer 896** bd_name - Name of the peer device. NULL if unknown. 897** dev_type - Remote device's device type. 898** addr_type - LE device address type. 899** 900** Returns TRUE if added OK, else FALSE 901** 902*******************************************************************************/ 903extern BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, 904 tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type); 905 906/******************************************************************************* 907** 908** Function BTM_SecAddBleKey 909** 910** Description Add/modify LE device information. This function will be 911** normally called during host startup to restore all required 912** information stored in the NVRAM. 913** 914** Parameters: bd_addr - BD address of the peer 915** p_le_key - LE key values. 916** key_type - LE SMP key type. 917* 918** Returns TRUE if added OK, else FALSE 919** 920*******************************************************************************/ 921extern BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, 922 tBTM_LE_KEY_TYPE key_type); 923 924/******************************************************************************* 925** 926** Function BTM_BleSetAdvParams 927** 928** Description This function is called to set advertising parameters. 929** 930** Parameters: None. 931** 932** Returns void 933** 934*******************************************************************************/ 935extern tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max, 936 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map); 937 938/******************************************************************************* 939** 940** Function BTM_BleWriteAdvData 941** 942** Description This function is called to write advertising data. 943** 944** Parameters: None. 945** 946** Returns void 947** 948*******************************************************************************/ 949extern tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, 950 tBTM_BLE_ADV_DATA *p_data); 951 952/******************************************************************************* 953** 954** Function BTM_BleSetAdvParams 955** 956** Description This function is called to set advertising parameters. 957** 958** Parameters adv_int_min: minimum advertising interval 959** adv_int_max: maximum advertising interval 960** p_dir_bda: connectable direct initiator's LE device address 961** chnl_map: advertising channel map. 962** 963** Returns void 964** 965*******************************************************************************/ 966extern void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, 967 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map); 968 969/******************************************************************************* 970** 971** Function BTM_BleObtainVendorCapabilities 972** 973** Description This function is called to obatin vendor capabilties 974** 975** Parameters p_cmn_vsc_cb - Returns the vednor capabilities 976** 977** Returns void 978** 979*******************************************************************************/ 980extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb); 981 982/******************************************************************************* 983** 984** Function BTM_BleSetScanParams 985** 986** Description This function is called to set Scan parameters. 987** 988** Parameters client_if - Client IF value 989** scan_interval - Scan interval 990** scan_window - Scan window 991** scan_type - Scan type 992** scan_setup_status_cback - Scan setup status callback 993** 994** Returns void 995** 996*******************************************************************************/ 997extern void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval, 998 UINT32 scan_window, tBLE_SCAN_MODE scan_type, 999 tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback); 1000 1001/******************************************************************************* 1002** 1003** Function BTM_BleGetVendorCapabilities 1004** 1005** Description This function reads local LE features 1006** 1007** Parameters p_cmn_vsc_cb : Locala LE capability structure 1008** 1009** Returns void 1010** 1011*******************************************************************************/ 1012extern void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb); 1013/******************************************************************************* 1014** 1015** Function BTM_BleSetStorageConfig 1016** 1017** Description This function is called to setup storage configuration and setup callbacks. 1018** 1019** Parameters UINT8 batch_scan_full_max -Batch scan full maximum 1020 UINT8 batch_scan_trunc_max - Batch scan truncated value maximum 1021 UINT8 batch_scan_notify_threshold - Threshold value 1022 tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback - Setup callback 1023 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold callback 1024 void *p_ref - Reference value 1025** 1026** Returns tBTM_STATUS 1027** 1028*******************************************************************************/ 1029extern tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max, 1030 UINT8 batch_scan_trunc_max, 1031 UINT8 batch_scan_notify_threshold, 1032 tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback, 1033 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, 1034 tBTM_BLE_SCAN_REP_CBACK* p_cback, 1035 tBTM_BLE_REF_VALUE ref_value); 1036 1037/******************************************************************************* 1038** 1039** Function BTM_BleEnableBatchScan 1040** 1041** Description This function is called to enable batch scan 1042** 1043** Parameters tBTM_BLE_BATCH_SCAN_MODE scan_mode - Batch scan mode 1044 UINT32 scan_interval -Scan interval 1045 UINT32 scan_window - Scan window value 1046 tBLE_ADDR_TYPE addr_type - Address type 1047 tBTM_BLE_DISCARD_RULE discard_rule - Data discard rules 1048** 1049** Returns tBTM_STATUS 1050** 1051*******************************************************************************/ 1052extern tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode, 1053 UINT32 scan_interval, UINT32 scan_window, 1054 tBTM_BLE_DISCARD_RULE discard_rule, 1055 tBLE_ADDR_TYPE addr_type, 1056 tBTM_BLE_REF_VALUE ref_value); 1057 1058/******************************************************************************* 1059** 1060** Function BTM_BleDisableBatchScan 1061** 1062** Description This function is called to disable batch scanning 1063** 1064** Parameters void 1065** 1066** Returns void 1067** 1068*******************************************************************************/ 1069extern tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value); 1070 1071/******************************************************************************* 1072** 1073** Function BTM_BleReadScanReports 1074** 1075** Description This function is called to read batch scan reports 1076** 1077** Parameters tBLE_SCAN_MODE scan_mode - Scan mode report to be read out 1078 tBTM_BLE_SCAN_REP_CBACK* p_cback - Reports callback 1079** 1080** Returns tBTM_STATUS 1081** 1082*******************************************************************************/ 1083extern tBTM_STATUS BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, 1084 tBTM_BLE_REF_VALUE ref_value); 1085 1086/******************************************************************************* 1087** 1088** Function BTM_BleTrackAdvertiser 1089** 1090** Description This function is called to read batch scan reports 1091** 1092** Parameters p_track_cback - Tracking callback 1093** ref_value - Reference value 1094** 1095** Returns tBTM_STATUS 1096** 1097*******************************************************************************/ 1098extern tBTM_STATUS BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK *p_track_cback, 1099 tBTM_BLE_REF_VALUE ref_value); 1100 1101/******************************************************************************* 1102** 1103** Function BTM_BleWriteScanRsp 1104** 1105** Description This function is called to write LE scan response. 1106** 1107** Parameters: p_scan_rsp: scan response. 1108** 1109** Returns status 1110** 1111*******************************************************************************/ 1112extern tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, 1113 tBTM_BLE_ADV_DATA *p_data); 1114 1115/******************************************************************************* 1116** 1117** Function BTM_BleObserve 1118** 1119** Description This procedure keep the device listening for advertising 1120** events from a broadcast device. 1121** 1122** Parameters start: start or stop observe. 1123** 1124** Returns void 1125** 1126*******************************************************************************/ 1127extern tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration, 1128 tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb); 1129 1130 1131/******************************************************************************* 1132** 1133** Function BTM_GetDeviceIDRoot 1134** 1135** Description This function is called to read the local device identity 1136** root. 1137** 1138** Returns void 1139** the local device ER is copied into er 1140** 1141*******************************************************************************/ 1142extern void BTM_GetDeviceIDRoot (BT_OCTET16 ir); 1143 1144/******************************************************************************* 1145** 1146** Function BTM_GetDeviceEncRoot 1147** 1148** Description This function is called to read the local device encryption 1149** root. 1150** 1151** Returns void 1152** the local device ER is copied into er 1153** 1154*******************************************************************************/ 1155extern void BTM_GetDeviceEncRoot (BT_OCTET16 er); 1156 1157/******************************************************************************* 1158** 1159** Function BTM_GetDeviceDHK 1160** 1161** Description This function is called to read the local device DHK. 1162** 1163** Returns void 1164** the local device DHK is copied into dhk 1165** 1166*******************************************************************************/ 1167extern void BTM_GetDeviceDHK (BT_OCTET16 dhk); 1168 1169/******************************************************************************* 1170** 1171** Function BTM_SecurityGrant 1172** 1173** Description This function is called to grant security process. 1174** 1175** Parameters bd_addr - peer device bd address. 1176** res - result of the operation BTM_SUCCESS if success. 1177** Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts. 1178** 1179** Returns None 1180** 1181*******************************************************************************/ 1182extern void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res); 1183 1184/******************************************************************************* 1185** 1186** Function BTM_BlePasskeyReply 1187** 1188** Description This function is called after Security Manager submitted 1189** passkey request to the application. 1190** 1191** Parameters: bd_addr - Address of the device for which passkey was requested 1192** res - result of the operation SMP_SUCCESS if success 1193** passkey - numeric value in the range of 1194** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)). 1195** 1196*******************************************************************************/ 1197extern void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey); 1198 1199/******************************************************************************* 1200** 1201** Function BTM_BleConfirmReply 1202** 1203** Description This function is called after Security Manager submitted 1204** numeric comparison request to the application. 1205** 1206** Parameters: bd_addr - Address of the device with which numeric 1207** comparison was requested 1208** res - comparison result BTM_SUCCESS if success 1209** 1210*******************************************************************************/ 1211extern void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res); 1212 1213/******************************************************************************* 1214** 1215** Function BTM_LeOobDataReply 1216** 1217** Description This function is called to provide the OOB data for 1218** SMP in response to BTM_LE_OOB_REQ_EVT 1219** 1220** Parameters: bd_addr - Address of the peer device 1221** res - result of the operation SMP_SUCCESS if success 1222** p_data - simple pairing Randomizer C. 1223** 1224*******************************************************************************/ 1225extern void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data); 1226 1227 1228/******************************************************************************* 1229** 1230** Function BTM_BleDataSignature 1231** 1232** Description This function is called to sign the data using AES128 CMAC 1233** algorith. 1234** 1235** Parameter bd_addr: target device the data to be signed for. 1236** p_text: singing data 1237** len: length of the signing data 1238** signature: output parameter where data signature is going to 1239** be stored. 1240** 1241** Returns TRUE if signing sucessul, otherwise FALSE. 1242** 1243*******************************************************************************/ 1244extern BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len, 1245 BLE_SIGNATURE signature); 1246 1247/******************************************************************************* 1248** 1249** Function BTM_BleVerifySignature 1250** 1251** Description This function is called to verify the data signature 1252** 1253** Parameter bd_addr: target device the data to be signed for. 1254** p_orig: original data before signature. 1255** len: length of the signing data 1256** counter: counter used when doing data signing 1257** p_comp: signature to be compared against. 1258 1259** Returns TRUE if signature verified correctly; otherwise FALSE. 1260** 1261*******************************************************************************/ 1262extern BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, 1263 UINT16 len, UINT32 counter, 1264 UINT8 *p_comp); 1265 1266/******************************************************************************* 1267** 1268** Function BTM_ReadConnectionAddr 1269** 1270** Description This function is called to set the local device random address 1271** . 1272** 1273** Returns void 1274** 1275*******************************************************************************/ 1276extern void BTM_ReadConnectionAddr (BD_ADDR remote_bda, BD_ADDR local_conn_addr, 1277 tBLE_ADDR_TYPE *p_addr_type); 1278 1279 1280 1281/******************************************************************************* 1282** 1283** Function BTM_ReadRemoteConnectionAddr 1284** 1285** Description This function is read the remote device address currently used 1286** . 1287** 1288** Returns void 1289** 1290*******************************************************************************/ 1291extern BOOLEAN BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, 1292 BD_ADDR conn_addr, 1293 tBLE_ADDR_TYPE *p_addr_type); 1294 1295/******************************************************************************* 1296** 1297** Function BTM_BleLoadLocalKeys 1298** 1299** Description Local local identity key, encryption root or sign counter. 1300** 1301** Parameters: key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER 1302** or BTM_BLE_KEY_TYPE_COUNTER. 1303** p_key: pointer to the key. 1304* 1305** Returns non2. 1306** 1307*******************************************************************************/ 1308extern void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key); 1309 1310 1311/******************************************************************************* 1312** 1313** Function BTM_BleSetBgConnType 1314** 1315** Description This function is called to set BLE background connection 1316** procedure type. It can be auto connection, or selective connection. 1317** 1318** Parameters conn_type: it can be auto connection, or selective connection. 1319** p_select_cback: callback function when selective connection procedure 1320** is being used. 1321** 1322** Returns void 1323** 1324*******************************************************************************/ 1325extern BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE conn_type, 1326 tBTM_BLE_SEL_CBACK *p_select_cback); 1327 1328/******************************************************************************* 1329** 1330** Function BTM_BleUpdateBgConnDev 1331** 1332** Description This function is called to add or remove a device into/from 1333** background connection procedure. The background connection 1334* procedure is decided by the background connection type, it can be 1335* auto connection, or selective connection. 1336** 1337** Parameters add_remove: TRUE to add; FALSE to remove. 1338** remote_bda: device address to add/remove. 1339** 1340** Returns void 1341** 1342*******************************************************************************/ 1343extern BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda); 1344 1345/******************************************************************************* 1346** 1347** Function BTM_BleClearBgConnDev 1348** 1349** Description This function is called to clear the whitelist, 1350** end any pending whitelist connections, 1351* and reset the local bg device list. 1352** 1353** Parameters void 1354** 1355** Returns void 1356** 1357*******************************************************************************/ 1358extern void BTM_BleClearBgConnDev(void); 1359 1360/******************************************************** 1361** 1362** Function BTM_BleSetPrefConnParams 1363** 1364** Description Set a peripheral's preferred connection parameters. When 1365** any of the value does not want to be updated while others 1366** do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to 1367** leave untouched. 1368** 1369** Parameters: bd_addr - BD address of the peripheral 1370** min_conn_int - minimum preferred connection interval 1371** max_conn_int - maximum preferred connection interval 1372** slave_latency - preferred slave latency 1373** supervision_tout - preferred supervision timeout 1374** 1375** Returns void 1376** 1377*******************************************************************************/ 1378extern void BTM_BleSetPrefConnParams (BD_ADDR bd_addr, 1379 UINT16 min_conn_int, UINT16 max_conn_int, 1380 UINT16 slave_latency, UINT16 supervision_tout); 1381 1382/****************************************************************************** 1383** 1384** Function BTM_BleSetConnScanParams 1385** 1386** Description Set scan parameters used in BLE connection request 1387** 1388** Parameters: scan_interval - scan interval 1389** scan_window - scan window 1390** 1391** Returns void 1392** 1393*******************************************************************************/ 1394extern void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window); 1395 1396/****************************************************************************** 1397** 1398** Function BTM_BleReadControllerFeatures 1399** 1400** Description Reads BLE specific controller features 1401** 1402** Parameters: tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when features are read 1403** 1404** Returns void 1405** 1406*******************************************************************************/ 1407extern void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_cback); 1408 1409/******************************************************************************* 1410** 1411** Function BTM_CheckAdvData 1412** 1413** Description This function is called to get ADV data for a specific type. 1414** 1415** Parameters p_adv - pointer of ADV data 1416** type - finding ADV data type 1417** p_length - return the length of ADV data not including type 1418** 1419** Returns pointer of ADV data 1420** 1421*******************************************************************************/ 1422extern UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length); 1423 1424/******************************************************************************* 1425** 1426** Function BTM__BLEReadDiscoverability 1427** 1428** Description This function is called to read the current LE discoverability 1429** mode of the device. 1430** 1431** Returns BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or 1432** BTM_BLE_GENRAL_DISCOVERABLE 1433** 1434*******************************************************************************/ 1435UINT16 BTM_BleReadDiscoverability(); 1436 1437/******************************************************************************* 1438** 1439** Function BTM__BLEReadConnectability 1440** 1441** Description This function is called to read the current LE connectibility 1442** mode of the device. 1443** 1444** Returns BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE 1445** 1446*******************************************************************************/ 1447extern UINT16 BTM_BleReadConnectability (); 1448 1449/******************************************************************************* 1450** 1451** Function BTM_ReadDevInfo 1452** 1453** Description This function is called to read the device/address type 1454** of BD address. 1455** 1456** Parameter remote_bda: remote device address 1457** p_dev_type: output parameter to read the device type. 1458** p_addr_type: output parameter to read the address type. 1459** 1460*******************************************************************************/ 1461extern void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, 1462 tBLE_ADDR_TYPE *p_addr_type); 1463 1464 1465/******************************************************************************* 1466** 1467** Function BTM_ReadConnectedTransportAddress 1468** 1469** Description This function is called to read the paired device/address type of other device paired 1470** corresponding to the BD_address 1471** 1472** Parameter remote_bda: remote device address, carry out the transport address 1473** transport: active transport 1474** 1475** Return TRUE if an active link is identified; FALSE otherwise 1476** 1477*******************************************************************************/ 1478extern BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, 1479 tBT_TRANSPORT transport); 1480 1481/******************************************************************************* 1482** 1483** Function BTM_BleBroadcast 1484** 1485** Description This function is to start or stop broadcasting. 1486** 1487** Parameters start: start or stop broadcasting. 1488** 1489** Returns status. 1490** 1491*******************************************************************************/ 1492extern tBTM_STATUS BTM_BleBroadcast(BOOLEAN start); 1493 1494/******************************************************************************* 1495** 1496** Function BTM_BleConfigPrivacy 1497** 1498** Description This function is called to enable or disable the privacy in 1499** the local device. 1500** 1501** Parameters enable: TRUE to enable it; FALSE to disable it. 1502** 1503** Returns BOOLEAN privacy mode set success; otherwise failed. 1504** 1505*******************************************************************************/ 1506extern BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable); 1507 1508/******************************************************************************* 1509** 1510** Function BTM_BleLocalPrivacyEnabled 1511** 1512** Description Checks if local device supports private address 1513** 1514** Returns Return TRUE if local privacy is enabled else FALSE 1515** 1516*******************************************************************************/ 1517extern BOOLEAN BTM_BleLocalPrivacyEnabled(void); 1518 1519/******************************************************************************* 1520** 1521** Function BTM_BleEnableMixedPrivacyMode 1522** 1523** Description This function is called to enabled Mixed mode if privacy 1.2 1524** is applicable in controller. 1525** 1526** Parameters mixed_on: mixed mode to be used or not. 1527** 1528** Returns void 1529** 1530*******************************************************************************/ 1531extern void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on); 1532 1533/******************************************************************************* 1534** 1535** Function BTM_BleMaxMultiAdvInstanceCount 1536** 1537** Description Returns max number of multi adv instances supported by controller 1538** 1539** Returns Max multi adv instance count 1540** 1541*******************************************************************************/ 1542extern UINT8 BTM_BleMaxMultiAdvInstanceCount(); 1543 1544/******************************************************************************* 1545** 1546** Function BTM_BleSetConnectableMode 1547** 1548** Description This function is called to set BLE connectable mode for a 1549** peripheral device. 1550** 1551** Parameters connectable_mode: directed connectable mode, or non-directed.It can 1552** be BTM_BLE_CONNECT_EVT, BTM_BLE_CONNECT_DIR_EVT or 1553** BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 1554** 1555** Returns BTM_ILLEGAL_VALUE if controller does not support BLE. 1556** BTM_SUCCESS is status set successfully; otherwise failure. 1557** 1558*******************************************************************************/ 1559extern tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode); 1560 1561/******************************************************************************* 1562** 1563** Function BTM_BleTurnOnPrivacyOnRemote 1564** 1565** Description This function is called to enable or disable the privacy on the 1566** remote device. 1567** 1568** Parameters bd_addr: remote device address. 1569** privacy_on: TRUE to enable it; FALSE to disable it. 1570** 1571** Returns void 1572** 1573*******************************************************************************/ 1574extern void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr, 1575 BOOLEAN privacy_on); 1576 1577/******************************************************************************* 1578** 1579** Function BTM_BleUpdateAdvWhitelist 1580** 1581** Description Add or remove device from advertising white list 1582** 1583** Returns void 1584** 1585*******************************************************************************/ 1586extern BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda); 1587 1588/******************************************************************************* 1589** 1590** Function BTM_BleUpdateAdvFilterPolicy 1591** 1592** Description This function update the filter policy of advertiser. 1593** 1594** Parameter adv_policy: advertising filter policy 1595** 1596** Return void 1597*******************************************************************************/ 1598extern void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy); 1599 1600/******************************************************************************* 1601** 1602** Function BTM_BleReceiverTest 1603** 1604** Description This function is called to start the LE Receiver test 1605** 1606** Parameter rx_freq - Frequency Range 1607** p_cmd_cmpl_cback - Command Complete callback 1608** 1609*******************************************************************************/ 1610void BTM_BleReceiverTest(UINT8 rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback); 1611 1612 1613/******************************************************************************* 1614** 1615** Function BTM_BleTransmitterTest 1616** 1617** Description This function is called to start the LE Transmitter test 1618** 1619** Parameter tx_freq - Frequency Range 1620** test_data_len - Length in bytes of payload data in each packet 1621** packet_payload - Pattern to use in the payload 1622** p_cmd_cmpl_cback - Command Complete callback 1623** 1624*******************************************************************************/ 1625void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len, 1626 UINT8 packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback); 1627 1628/******************************************************************************* 1629** 1630** Function BTM_BleTestEnd 1631** 1632** Description This function is called to stop the in-progress TX or RX test 1633** 1634** Parameter p_cmd_cmpl_cback - Command complete callback 1635** 1636*******************************************************************************/ 1637void BTM_BleTestEnd(tBTM_CMPL_CB *p_cmd_cmpl_cback); 1638 1639/******************************************************************************* 1640** 1641** Function BTM_UseLeLink 1642** 1643** Description This function is to select the underneath physical link to use. 1644** 1645** Returns TRUE to use LE, FALSE use BR/EDR. 1646** 1647*******************************************************************************/ 1648extern BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr); 1649 1650/******************************************************************************* 1651** 1652** Function BTM_BleStackEnable 1653** 1654** Description Enable/Disable BLE functionality on stack regarless controller 1655** capability. 1656** 1657** Parameters: enable: TRUE to enable, FALSE to disable. 1658** 1659** Returns TRUE if added OK, else FALSE 1660** 1661*******************************************************************************/ 1662extern tBTM_STATUS BTM_BleStackEnable (BOOLEAN enable); 1663 1664/******************************************************************************* 1665** 1666** Function BTM_GetLeSecurityState 1667** 1668** Description This function is called to get security mode 1 flags and 1669** encryption key size for LE peer. 1670** 1671** Returns BOOLEAN TRUE if LE device is found, FALSE otherwise. 1672** 1673*******************************************************************************/ 1674extern BOOLEAN BTM_GetLeSecurityState (BD_ADDR bd_addr, 1675 UINT8 *p_le_dev_sec_flags, 1676 UINT8 *p_le_key_size); 1677 1678/******************************************************************************* 1679** 1680** Function BTM_BleSecurityProcedureIsRunning 1681** 1682** Description This function indicates if LE security procedure is 1683** currently running with the peer. 1684** 1685** Returns BOOLEAN TRUE if security procedure is running, FALSE otherwise. 1686** 1687*******************************************************************************/ 1688extern BOOLEAN BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr); 1689 1690/******************************************************************************* 1691** 1692** Function BTM_BleGetSupportedKeySize 1693** 1694** Description This function gets the maximum encryption key size in bytes 1695** the local device can suport. 1696** record. 1697** 1698** Returns the key size or 0 if the size can't be retrieved. 1699** 1700*******************************************************************************/ 1701extern UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr); 1702 1703/*******************************************************************************/ 1704/* Multi ADV API */ 1705/******************************************************************************* 1706** 1707** Function BTM_BleEnableAdvInstance 1708** 1709** Description This function enable a Multi-ADV instance with the specified 1710** adv parameters 1711** 1712** Parameters p_params: pointer to the adv parameter structure, set as default 1713** adv parameter when the instance is enabled. 1714** p_cback: callback function for the adv instance. 1715** p_ref: reference data attach to the adv instance to be enabled. 1716** 1717** Returns status 1718** 1719*******************************************************************************/ 1720extern tBTM_STATUS BTM_BleEnableAdvInstance (tBTM_BLE_ADV_PARAMS *p_params, 1721 tBTM_BLE_MULTI_ADV_CBACK *p_cback, 1722 void *p_ref); 1723 1724/******************************************************************************* 1725** 1726** Function BTM_BleUpdateAdvInstParam 1727** 1728** Description This function update a Multi-ADV instance with the specififed 1729** adv parameters. 1730** 1731** Parameters inst_id: adv instance ID 1732** p_params: pointer to the adv parameter structure. 1733** 1734** Returns status 1735** 1736*******************************************************************************/ 1737extern tBTM_STATUS BTM_BleUpdateAdvInstParam (UINT8 inst_id, tBTM_BLE_ADV_PARAMS *p_params); 1738 1739/******************************************************************************* 1740** 1741** Function BTM_BleCfgAdvInstData 1742** 1743** Description This function configure a Multi-ADV instance with the specified 1744** adv data or scan response data. 1745** 1746** Parameters inst_id: adv instance ID 1747** is_scan_rsp: is this scacn response, if no set as adv data. 1748** data_mask: adv data mask. 1749** p_data: pointer to the adv data structure. 1750** 1751** Returns status 1752** 1753*******************************************************************************/ 1754extern tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp, 1755 tBTM_BLE_AD_MASK data_mask, 1756 tBTM_BLE_ADV_DATA *p_data); 1757 1758/******************************************************************************* 1759** 1760** Function BTM_BleDisableAdvInstance 1761** 1762** Description This function disable a Multi-ADV instance. 1763** 1764** Parameters inst_id: adv instance ID 1765** 1766** Returns status 1767** 1768*******************************************************************************/ 1769extern tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id); 1770 1771/******************************************************************************* 1772** 1773** Function BTM_BleAdvFilterParamSetup 1774** 1775** Description This function is called to setup the adv data payload filter 1776** condition. 1777** 1778** Parameters p_target: enabble the filter condition on a target device; if NULL 1779** enable the generic scan condition. 1780** enable: enable or disable the filter condition 1781** 1782** Returns void 1783** 1784*******************************************************************************/ 1785extern tBTM_STATUS BTM_BleAdvFilterParamSetup(int action, 1786 tBTM_BLE_PF_FILT_INDEX filt_index, 1787 tBTM_BLE_PF_FILT_PARAMS *p_filt_params, 1788 tBLE_BD_ADDR *p_target, tBTM_BLE_PF_PARAM_CBACK *p_cmpl_cback, 1789 tBTM_BLE_REF_VALUE ref_value); 1790 1791/******************************************************************************* 1792** 1793** Function BTM_BleCfgFilterCondition 1794** 1795** Description This function is called to configure the adv data payload filter 1796** condition. 1797** 1798** Parameters action: to read/write/clear 1799** cond_type: filter condition type. 1800** p_cond: filter condition paramter 1801** 1802** Returns tBTM_STATUS 1803** 1804*******************************************************************************/ 1805extern tBTM_STATUS BTM_BleCfgFilterCondition(tBTM_BLE_SCAN_COND_OP action, 1806 tBTM_BLE_PF_COND_TYPE cond_type, 1807 tBTM_BLE_PF_FILT_INDEX filt_index, 1808 tBTM_BLE_PF_COND_PARAM *p_cond, 1809 tBTM_BLE_PF_CFG_CBACK *p_cmpl_cback, 1810 tBTM_BLE_REF_VALUE ref_value); 1811 1812/******************************************************************************* 1813** 1814** Function BTM_BleEnableDisableFilterFeature 1815** 1816** Description This function is called to enable or disable the APCF feature 1817** 1818** Parameters enable - TRUE - enables the APCF, FALSE - disables the APCF 1819** ref_value - Ref value 1820** 1821** Returns tBTM_STATUS 1822** 1823*******************************************************************************/ 1824extern tBTM_STATUS BTM_BleEnableDisableFilterFeature(UINT8 enable, 1825 tBTM_BLE_PF_STATUS_CBACK *p_stat_cback, 1826 tBTM_BLE_REF_VALUE ref_value); 1827 1828/******************************************************************************* 1829** 1830** Function BTM_BleGetEnergyInfo 1831** 1832** Description This function obtains the energy info 1833** 1834** Parameters p_ener_cback - Callback pointer 1835** 1836** Returns status 1837** 1838*******************************************************************************/ 1839extern tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback); 1840 1841/******************************************************************************* 1842** 1843** Function BTM_SetBleDataLength 1844** 1845** Description This function is called to set maximum BLE transmission packet size 1846** 1847** Returns BTM_SUCCESS if success; otherwise failed. 1848** 1849*******************************************************************************/ 1850extern tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length); 1851 1852#ifdef __cplusplus 1853} 1854#endif 1855 1856#endif 1857