Home | History | Annotate | Download | only in dm
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2003-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 is the private interface file for the BTA device manager.
     22  *
     23  ******************************************************************************/
     24 #ifndef BTA_DM_INT_H
     25 #define BTA_DM_INT_H
     26 
     27 #include "bt_target.h"
     28 
     29 #if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
     30     #include "bta_gatt_api.h"
     31 #endif
     32 
     33 
     34 
     35 /*****************************************************************************
     36 **  Constants and data types
     37 *****************************************************************************/
     38 
     39 
     40 #define BTA_COPY_DEVICE_CLASS(coddst, codsrc)   {((UINT8 *)(coddst))[0] = ((UINT8 *)(codsrc))[0]; \
     41                                                  ((UINT8 *)(coddst))[1] = ((UINT8 *)(codsrc))[1];  \
     42                                                  ((UINT8 *)(coddst))[2] = ((UINT8 *)(codsrc))[2];}
     43 
     44 
     45 #define BTA_DM_MSG_LEN 50
     46 
     47 #define BTA_SERVICE_ID_TO_SERVICE_MASK(id)       (1 << (id))
     48 
     49 /* DM events */
     50 enum
     51 {
     52     /* device manager local device API events */
     53     BTA_DM_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_DM),
     54     BTA_DM_API_DISABLE_EVT,
     55     BTA_DM_API_SET_NAME_EVT,
     56     BTA_DM_API_SET_VISIBILITY_EVT,
     57     BTA_DM_API_SET_AFH_CHANNELS_EVT,
     58     BTA_API_DM_SIG_STRENGTH_EVT,
     59     BTA_DM_API_VENDOR_SPECIFIC_COMMAND_EVT,
     60     BTA_DM_API_TX_INQPWR_EVT,
     61     BTA_DM_ACL_CHANGE_EVT,
     62     BTA_DM_API_ADD_DEVICE_EVT,
     63     BTA_DM_API_REMOVE_ACL_EVT,
     64 
     65     /* security API events */
     66     BTA_DM_API_BOND_EVT,
     67     BTA_DM_API_BOND_CANCEL_EVT,
     68     BTA_DM_API_PIN_REPLY_EVT,
     69     BTA_DM_API_LINK_POLICY_EVT,
     70     BTA_DM_API_AUTH_REPLY_EVT,
     71 
     72     /* power manger events */
     73     BTA_DM_PM_BTM_STATUS_EVT,
     74     BTA_DM_PM_TIMER_EVT,
     75 
     76     /* simple pairing events */
     77     BTA_DM_API_CONFIRM_EVT,
     78 
     79     BTA_DM_API_SET_ENCRYPTION_EVT,
     80 
     81 
     82 #if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
     83     BTA_DM_API_PASKY_CANCEL_EVT,
     84 #endif
     85 #if (BTM_OOB_INCLUDED == TRUE)
     86     BTA_DM_API_LOC_OOB_EVT,
     87     BTA_DM_CI_IO_REQ_EVT,
     88     BTA_DM_CI_RMT_OOB_EVT,
     89 #endif /* BTM_OOB_INCLUDED */
     90 
     91     BTA_DM_API_REMOVE_DEVICE_EVT,
     92 
     93 #if BLE_INCLUDED == TRUE
     94     BTA_DM_API_ADD_BLEKEY_EVT,
     95     BTA_DM_API_ADD_BLEDEVICE_EVT,
     96     BTA_DM_API_BLE_PASSKEY_REPLY_EVT,
     97     BTA_DM_API_BLE_SEC_GRANT_EVT,
     98     BTA_DM_API_BLE_SET_BG_CONN_TYPE,
     99     BTA_DM_API_BLE_CONN_PARAM_EVT,
    100     BTA_DM_API_BLE_SCAN_PARAM_EVT,
    101     BTA_DM_API_BLE_OBSERVE_EVT,
    102     BTA_DM_API_UPDATE_CONN_PARAM_EVT,
    103 #if BLE_PRIVACY_SPT == TRUE
    104     BTA_DM_API_LOCAL_PRIVACY_EVT,
    105 #endif
    106     BTA_DM_API_BLE_ADV_PARAM_EVT,
    107     BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
    108     BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
    109     BTA_DM_API_BLE_BROADCAST_EVT,
    110 
    111 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
    112     BTA_DM_API_CFG_FILTER_COND_EVT,
    113     BTA_DM_API_SCAN_FILTER_SETUP_EVT,
    114     BTA_DM_API_SCAN_FILTER_ENABLE_EVT,
    115 #endif
    116     BTA_DM_API_BLE_MULTI_ADV_ENB_EVT,
    117     BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT,
    118     BTA_DM_API_BLE_MULTI_ADV_DATA_EVT,
    119     BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT,
    120     BTA_DM_API_BLE_SETUP_STORAGE_EVT,
    121     BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT,
    122     BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT,
    123     BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT,
    124     BTA_DM_API_BLE_TRACK_ADVERTISER_EVT,
    125     BTA_DM_API_BLE_ENERGY_INFO_EVT,
    126 #endif
    127 
    128 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
    129     BTA_DM_API_UPDATE_EIR_UUID_EVT,
    130 #endif
    131 #if (BTM_EIR_SERVER_INCLUDED == TRUE)
    132     BTA_DM_API_SET_EIR_CONFIG_EVT,
    133 #endif
    134 
    135     BTA_DM_API_ENABLE_TEST_MODE_EVT,
    136     BTA_DM_API_DISABLE_TEST_MODE_EVT,
    137     BTA_DM_API_EXECUTE_CBACK_EVT,
    138     BTA_DM_API_SET_AFH_CHANNEL_ASSESMENT_EVT,
    139     BTA_DM_MAX_EVT
    140 };
    141 
    142 
    143 /* DM search events */
    144 enum
    145 {
    146     /* DM search API events */
    147     BTA_DM_API_SEARCH_EVT = BTA_SYS_EVT_START(BTA_ID_DM_SEARCH),
    148     BTA_DM_API_SEARCH_CANCEL_EVT,
    149     BTA_DM_API_DISCOVER_EVT,
    150     BTA_DM_INQUIRY_CMPL_EVT,
    151     BTA_DM_REMT_NAME_EVT,
    152     BTA_DM_SDP_RESULT_EVT,
    153     BTA_DM_SEARCH_CMPL_EVT,
    154     BTA_DM_DISCOVERY_RESULT_EVT,
    155     BTA_DM_API_DI_DISCOVER_EVT,
    156     BTA_DM_DISC_CLOSE_TOUT_EVT
    157 };
    158 
    159 /* data type for BTA_DM_API_ENABLE_EVT */
    160 typedef struct
    161 {
    162     BT_HDR              hdr;
    163     tBTA_DM_SEC_CBACK *p_sec_cback;
    164 } tBTA_DM_API_ENABLE;
    165 
    166 /* data type for BTA_DM_API_SET_NAME_EVT */
    167 typedef struct
    168 {
    169     BT_HDR              hdr;
    170     BD_NAME             name; /* max 248 bytes name, plus must be Null terminated */
    171 } tBTA_DM_API_SET_NAME;
    172 
    173 /* data type for BTA_DM_API_SET_VISIBILITY_EVT */
    174 typedef struct
    175 {
    176     BT_HDR              hdr;
    177     tBTA_DM_DISC    disc_mode;
    178     tBTA_DM_CONN    conn_mode;
    179     UINT8           pair_mode;
    180     UINT8           conn_paired_only;
    181 } tBTA_DM_API_SET_VISIBILITY;
    182 
    183 /* data type for BTA_DM_API_SET_AFH_CHANNELS_EVT */
    184 typedef struct
    185 {
    186     BT_HDR              hdr;
    187     UINT8           first;
    188     UINT8           last;
    189 } tBTA_DM_API_SET_AFH_CHANNELS_EVT;
    190 
    191 /* data type for BTA_DM_API_VENDOR_SPECIFIC_COMMAND_EVT */
    192 typedef struct
    193 {
    194     BT_HDR              hdr;
    195     UINT16              opcode;
    196     UINT8               param_len;
    197     UINT8               *p_param_buf;
    198     tBTA_VENDOR_CMPL_CBACK *p_cback;
    199 
    200 } tBTA_DM_API_VENDOR_SPECIFIC_COMMAND;
    201 
    202 enum
    203 {
    204     BTA_DM_RS_NONE,     /* straight API call */
    205     BTA_DM_RS_OK,       /* the role switch result - successful */
    206     BTA_DM_RS_FAIL      /* the role switch result - failed */
    207 };
    208 typedef UINT8 tBTA_DM_RS_RES;
    209 
    210 /* data type for BTA_DM_API_SEARCH_EVT */
    211 typedef struct
    212 {
    213     BT_HDR      hdr;
    214     tBTA_DM_INQ inq_params;
    215     tBTA_SERVICE_MASK services;
    216     tBTA_DM_SEARCH_CBACK * p_cback;
    217     tBTA_DM_RS_RES  rs_res;
    218 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
    219     UINT8           num_uuid;
    220     tBT_UUID        *p_uuid;
    221 #endif
    222 } tBTA_DM_API_SEARCH;
    223 
    224 /* data type for BTA_DM_API_DISCOVER_EVT */
    225 typedef struct
    226 {
    227     BT_HDR      hdr;
    228     BD_ADDR bd_addr;
    229     tBTA_SERVICE_MASK services;
    230     tBTA_DM_SEARCH_CBACK * p_cback;
    231     BOOLEAN         sdp_search;
    232     tBTA_TRANSPORT  transport;
    233 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
    234     UINT8           num_uuid;
    235     tBT_UUID        *p_uuid;
    236 #endif
    237     tSDP_UUID    uuid;
    238 } tBTA_DM_API_DISCOVER;
    239 
    240 /* data type for BTA_DM_API_DI_DISC_EVT */
    241 typedef struct
    242 {
    243     BT_HDR              hdr;
    244     BD_ADDR             bd_addr;
    245     tBTA_DISCOVERY_DB   *p_sdp_db;
    246     UINT32              len;
    247     tBTA_DM_SEARCH_CBACK * p_cback;
    248 }tBTA_DM_API_DI_DISC;
    249 
    250 /* data type for BTA_DM_API_BOND_EVT */
    251 typedef struct
    252 {
    253     BT_HDR      hdr;
    254     BD_ADDR bd_addr;
    255     tBTA_TRANSPORT transport;
    256 } tBTA_DM_API_BOND;
    257 
    258 /* data type for BTA_DM_API_BOND_CANCEL_EVT */
    259 typedef struct
    260 {
    261     BT_HDR          hdr;
    262     BD_ADDR         bd_addr;
    263     tBTA_TRANSPORT  transport;
    264 } tBTA_DM_API_BOND_CANCEL;
    265 
    266 /* data type for BTA_DM_API_PIN_REPLY_EVT */
    267 typedef struct
    268 {
    269     BT_HDR      hdr;
    270     BD_ADDR bd_addr;
    271     BOOLEAN accept;
    272     UINT8 pin_len;
    273     UINT8 p_pin[PIN_CODE_LEN];
    274 } tBTA_DM_API_PIN_REPLY;
    275 
    276 /* data type for BTA_DM_API_LINK_POLICY_EVT */
    277 typedef struct
    278 {
    279     BT_HDR      hdr;
    280     BD_ADDR     bd_addr;
    281     UINT16      policy_mask;
    282     BOOLEAN     set;
    283 } tBTA_DM_API_LINK_POLICY;
    284 
    285 /* data type for BTA_DM_API_AUTH_REPLY_EVT */
    286 typedef struct
    287 {
    288     BT_HDR      hdr;
    289     BD_ADDR bd_addr;
    290     tBTA_SERVICE_ID service;
    291     tBTA_AUTH_RESP response;
    292 } tBTA_DM_API_AUTH_REPLY;
    293 
    294 /* data type for BTA_DM_API_LOC_OOB_EVT */
    295 typedef struct
    296 {
    297     BT_HDR      hdr;
    298 } tBTA_DM_API_LOC_OOB;
    299 
    300 /* data type for BTA_DM_API_CONFIRM_EVT */
    301 typedef struct
    302 {
    303     BT_HDR      hdr;
    304     BD_ADDR     bd_addr;
    305     BOOLEAN     accept;
    306 } tBTA_DM_API_CONFIRM;
    307 
    308 /* data type for BTA_DM_API_PASKY_CANCEL_EVT*/
    309 typedef struct
    310 {
    311     BT_HDR      hdr;
    312     BD_ADDR     bd_addr;
    313 } tBTA_DM_API_PASKY_CANCEL;
    314 
    315 /* data type for BTA_DM_CI_IO_REQ_EVT */
    316 typedef struct
    317 {
    318     BT_HDR          hdr;
    319     BD_ADDR         bd_addr;
    320     tBTA_IO_CAP     io_cap;
    321     tBTA_OOB_DATA   oob_data;
    322     tBTA_AUTH_REQ   auth_req;
    323 } tBTA_DM_CI_IO_REQ;
    324 
    325 /* data type for BTA_DM_CI_RMT_OOB_EVT */
    326 typedef struct
    327 {
    328     BT_HDR      hdr;
    329     BD_ADDR     bd_addr;
    330     BT_OCTET16  c;
    331     BT_OCTET16  r;
    332     BOOLEAN     accept;
    333 } tBTA_DM_CI_RMT_OOB;
    334 
    335 /* data type for BTA_DM_REMT_NAME_EVT */
    336 typedef struct
    337 {
    338     BT_HDR      hdr;
    339     tBTA_DM_SEARCH  result;
    340 } tBTA_DM_REM_NAME;
    341 
    342 /* data type for tBTA_DM_DISC_RESULT */
    343 typedef struct
    344 {
    345     BT_HDR      hdr;
    346     tBTA_DM_SEARCH  result;
    347 } tBTA_DM_DISC_RESULT;
    348 
    349 
    350 /* data type for BTA_DM_INQUIRY_CMPL_EVT */
    351 typedef struct
    352 {
    353     BT_HDR      hdr;
    354     UINT8       num;
    355 } tBTA_DM_INQUIRY_CMPL;
    356 
    357 /* data type for BTA_DM_SDP_RESULT_EVT */
    358 typedef struct
    359 {
    360     BT_HDR      hdr;
    361     UINT16 sdp_result;
    362 } tBTA_DM_SDP_RESULT;
    363 
    364 /* data type for BTA_API_DM_SIG_STRENGTH_EVT */
    365 typedef struct
    366 {
    367     BT_HDR      hdr;
    368     tBTA_SIG_STRENGTH_MASK mask;
    369     UINT16 period;
    370     BOOLEAN start;
    371 } tBTA_API_DM_SIG_STRENGTH;
    372 
    373 /* data type for tBTA_API_DM_TX_INQPWR */
    374 typedef struct
    375 {
    376     BT_HDR      hdr;
    377     INT8        tx_power;
    378 }tBTA_API_DM_TX_INQPWR;
    379 
    380 /* data type for BTA_DM_ACL_CHANGE_EVT */
    381 typedef struct
    382 {
    383     BT_HDR          hdr;
    384     tBTM_BL_EVENT   event;
    385     UINT8           busy_level;
    386     UINT8           busy_level_flags;
    387     BOOLEAN         is_new;
    388     UINT8           new_role;
    389     BD_ADDR         bd_addr;
    390     UINT8           hci_status;
    391 #if BLE_INCLUDED == TRUE
    392     UINT16          handle;
    393     tBT_TRANSPORT   transport;
    394 #endif
    395 } tBTA_DM_ACL_CHANGE;
    396 
    397 /* data type for BTA_DM_PM_BTM_STATUS_EVT */
    398 typedef struct
    399 {
    400 
    401     BT_HDR          hdr;
    402     BD_ADDR         bd_addr;
    403     tBTM_PM_STATUS  status;
    404     UINT16          value;
    405     UINT8           hci_status;
    406 
    407 } tBTA_DM_PM_BTM_STATUS;
    408 
    409 /* data type for BTA_DM_PM_TIMER_EVT */
    410 typedef struct
    411 {
    412     BT_HDR          hdr;
    413     BD_ADDR         bd_addr;
    414 
    415 } tBTA_DM_PM_TIMER;
    416 
    417 
    418 /* data type for BTA_DM_API_ADD_DEVICE_EVT */
    419 typedef struct
    420 {
    421     BT_HDR              hdr;
    422     BD_ADDR             bd_addr;
    423     DEV_CLASS           dc;
    424     LINK_KEY            link_key;
    425     tBTA_SERVICE_MASK   tm;
    426     BOOLEAN             is_trusted;
    427     UINT8               key_type;
    428     tBTA_IO_CAP         io_cap;
    429     BOOLEAN             link_key_known;
    430     BOOLEAN             dc_known;
    431     BD_NAME             bd_name;
    432     UINT8               features[BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1)];
    433 } tBTA_DM_API_ADD_DEVICE;
    434 
    435 /* data type for BTA_DM_API_REMOVE_ACL_EVT */
    436 typedef struct
    437 {
    438     BT_HDR              hdr;
    439     BD_ADDR             bd_addr;
    440 } tBTA_DM_API_REMOVE_DEVICE;
    441 
    442 /* data type for BTA_DM_API_EXECUTE_CBACK_EVT */
    443 typedef struct
    444 {
    445     BT_HDR               hdr;
    446     void *               p_param;
    447     tBTA_DM_EXEC_CBACK  *p_exec_cback;
    448 } tBTA_DM_API_EXECUTE_CBACK;
    449 
    450 /* data type for tBTA_DM_API_SET_ENCRYPTION */
    451 typedef struct
    452 {
    453     BT_HDR                    hdr;
    454     tBTA_TRANSPORT            transport;
    455     tBTA_DM_ENCRYPT_CBACK     *p_callback;
    456     tBTA_DM_BLE_SEC_ACT       sec_act;
    457     BD_ADDR                   bd_addr;
    458 } tBTA_DM_API_SET_ENCRYPTION;
    459 
    460 #if BLE_INCLUDED == TRUE
    461 typedef struct
    462 {
    463     BT_HDR                  hdr;
    464     BD_ADDR                 bd_addr;
    465     tBTA_LE_KEY_VALUE       blekey;
    466     tBTA_LE_KEY_TYPE        key_type;
    467 
    468 }tBTA_DM_API_ADD_BLEKEY;
    469 
    470 typedef struct
    471 {
    472     BT_HDR                  hdr;
    473     BD_ADDR                 bd_addr;
    474     tBT_DEVICE_TYPE         dev_type ;
    475     tBLE_ADDR_TYPE          addr_type;
    476 
    477 }tBTA_DM_API_ADD_BLE_DEVICE;
    478 
    479 typedef struct
    480 {
    481     BT_HDR                  hdr;
    482     BD_ADDR                 bd_addr;
    483     BOOLEAN                 accept;
    484     UINT32                  passkey;
    485 }tBTA_DM_API_PASSKEY_REPLY;
    486 
    487 typedef struct
    488 {
    489     BT_HDR                  hdr;
    490     BD_ADDR                 bd_addr;
    491     tBTA_DM_BLE_SEC_GRANT   res;
    492 }tBTA_DM_API_BLE_SEC_GRANT;
    493 
    494 
    495 typedef struct
    496 {
    497     BT_HDR                  hdr;
    498     tBTA_DM_BLE_CONN_TYPE   bg_conn_type;
    499     tBTA_DM_BLE_SEL_CBACK   *p_select_cback;
    500 }tBTA_DM_API_BLE_SET_BG_CONN_TYPE;
    501 
    502 /* set prefered BLE connection parameters for a device */
    503 typedef struct
    504 {
    505     BT_HDR                  hdr;
    506     BD_ADDR                 peer_bda;
    507     UINT16                  conn_int_min;
    508     UINT16                  conn_int_max;
    509     UINT16                  supervision_tout;
    510     UINT16                  slave_latency;
    511 
    512 }tBTA_DM_API_BLE_CONN_PARAMS;
    513 
    514 typedef struct
    515 {
    516     BT_HDR                  hdr;
    517     BD_ADDR                 peer_bda;
    518     BOOLEAN                 privacy_enable;
    519 
    520 }tBTA_DM_API_ENABLE_PRIVACY;
    521 
    522 typedef struct
    523 {
    524     BT_HDR                  hdr;
    525     BOOLEAN                 privacy_enable;
    526 }tBTA_DM_API_LOCAL_PRIVACY;
    527 
    528 /* set scan parameter for BLE connections */
    529 typedef struct
    530 {
    531     BT_HDR                  hdr;
    532     UINT16                  scan_int;
    533     UINT16                  scan_window;
    534 }tBTA_DM_API_BLE_SCAN_PARAMS;
    535 
    536 /* Data type for start/stop observe */
    537 typedef struct
    538 {
    539     BT_HDR                  hdr;
    540     BOOLEAN                 start;
    541     UINT16                  duration;
    542     tBTA_DM_SEARCH_CBACK * p_cback;
    543 }tBTA_DM_API_BLE_OBSERVE;
    544 
    545 /* set adv parameter for BLE advertising */
    546 typedef struct
    547 {
    548     BT_HDR                  hdr;
    549     UINT16                  adv_int_min;
    550     UINT16                  adv_int_max;
    551     tBLE_BD_ADDR            *p_dir_bda;
    552 }tBTA_DM_API_BLE_ADV_PARAMS;
    553 
    554 typedef struct
    555 {
    556     BT_HDR                  hdr;
    557     BOOLEAN                 enable;
    558 
    559 }tBTA_DM_API_BLE_FEATURE;
    560 
    561 /* multi adv data structure */
    562 typedef struct
    563 {
    564     BT_HDR                      hdr;
    565     tBTA_BLE_MULTI_ADV_CBACK    *p_cback;
    566     void                        *p_ref;
    567     tBTA_BLE_ADV_PARAMS         *p_params;
    568 }tBTA_DM_API_BLE_MULTI_ADV_ENB;
    569 
    570 typedef struct
    571 {
    572     BT_HDR                      hdr;
    573     UINT8                        inst_id;
    574     tBTA_BLE_ADV_PARAMS         *p_params;
    575 }tBTA_DM_API_BLE_MULTI_ADV_PARAM;
    576 
    577 typedef struct
    578 {
    579     BT_HDR                  hdr;
    580     UINT8                   inst_id;
    581     BOOLEAN                 is_scan_rsp;
    582     tBTA_BLE_AD_MASK        data_mask;
    583     tBTA_BLE_ADV_DATA      *p_data;
    584 }tBTA_DM_API_BLE_MULTI_ADV_DATA;
    585 
    586 typedef struct
    587 {
    588     BT_HDR                  hdr;
    589     UINT8                   inst_id;
    590 }tBTA_DM_API_BLE_MULTI_ADV_DISABLE;
    591 
    592 typedef struct
    593 {
    594     BT_HDR                  hdr;
    595     UINT16                  data_mask;
    596     tBTA_BLE_ADV_DATA       *p_adv_cfg;
    597     tBTA_SET_ADV_DATA_CMPL_CBACK    *p_adv_data_cback;
    598 }tBTA_DM_API_SET_ADV_CONFIG;
    599 
    600 typedef struct
    601 {
    602     BT_HDR                  hdr;
    603     UINT8                   batch_scan_full_max;
    604     UINT8                   batch_scan_trunc_max;
    605     UINT8                   batch_scan_notify_threshold;
    606     tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback;
    607     tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback;
    608     tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback;
    609     tBTA_DM_BLE_REF_VALUE    ref_value;
    610 } tBTA_DM_API_SET_STORAGE_CONFIG;
    611 
    612 typedef struct
    613 {
    614     BT_HDR                  hdr;
    615     tBTA_BLE_SCAN_MODE      scan_mode;
    616     UINT32                  scan_int;
    617     UINT32                  scan_window;
    618     tBTA_BLE_DISCARD_RULE   discard_rule;
    619     tBLE_ADDR_TYPE          addr_type;
    620     tBTA_DM_BLE_REF_VALUE   ref_value;
    621 } tBTA_DM_API_ENABLE_SCAN;
    622 
    623 typedef struct
    624 {
    625     BT_HDR                  hdr;
    626     tBTA_DM_BLE_REF_VALUE    ref_value;
    627 } tBTA_DM_API_DISABLE_SCAN;
    628 
    629 typedef struct
    630 {
    631     BT_HDR                  hdr;
    632     tBTA_BLE_SCAN_MODE scan_type;
    633     tBTA_DM_BLE_REF_VALUE    ref_value;
    634 } tBTA_DM_API_READ_SCAN_REPORTS;
    635 
    636 typedef struct
    637 {
    638     BT_HDR                  hdr;
    639     tBTA_DM_BLE_REF_VALUE ref_value;
    640     tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback;
    641 } tBTA_DM_API_TRACK_ADVERTISER;
    642 
    643 typedef struct
    644 {
    645     BT_HDR                  hdr;
    646     tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
    647 } tBTA_DM_API_ENERGY_INFO;
    648 
    649 #endif /* BLE_INCLUDED */
    650 
    651 typedef struct
    652 {
    653     BT_HDR                  hdr;
    654     BOOLEAN                 enable_or_disable;
    655 }tBTA_DM_API_SET_AFH_CHANNEL_ASSESSMENT;
    656 
    657 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
    658 /* data type for BTA_DM_API_UPDATE_EIR_UUID_EVT */
    659 typedef struct
    660 {
    661     BT_HDR          hdr;
    662     BOOLEAN         is_add;
    663     tBT_UUID        uuid;
    664 }tBTA_DM_API_UPDATE_EIR_UUID;
    665 #endif
    666 
    667 #if (BTM_EIR_SERVER_INCLUDED == TRUE)
    668 /* data type for BTA_DM_API_SET_EIR_CONFIG_EVT */
    669 typedef struct
    670 {
    671     BT_HDR              hdr;
    672     tBTA_DM_EIR_CONF    *p_eir_cfg;
    673 }tBTA_DM_API_SET_EIR_CONFIG;
    674 #endif
    675 
    676 /* data type for BTA_DM_API_REMOVE_ACL_EVT */
    677 typedef struct
    678 {
    679     BT_HDR      hdr;
    680     BD_ADDR     bd_addr;
    681     BOOLEAN     remove_dev;
    682     tBTA_TRANSPORT transport;
    683 
    684 }tBTA_DM_API_REMOVE_ACL;
    685 typedef struct
    686 {
    687     BT_HDR      hdr;
    688     BD_ADDR     bd_addr;
    689     UINT16      min_int;
    690     UINT16      max_int;
    691     UINT16      latency;
    692     UINT16      timeout;
    693 }tBTA_DM_API_UPDATE_CONN_PARAM;
    694 
    695 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
    696 typedef struct
    697 {
    698     BT_HDR                          hdr;
    699     tBTA_DM_BLE_SCAN_COND_OP        action;
    700     tBTA_DM_BLE_PF_COND_TYPE        cond_type;
    701     tBTA_DM_BLE_PF_FILT_INDEX       filt_index;
    702     tBTA_DM_BLE_PF_COND_PARAM       *p_cond_param;
    703     tBTA_DM_BLE_PF_CFG_CBACK      *p_filt_cfg_cback;
    704     tBTA_DM_BLE_REF_VALUE            ref_value;
    705 }tBTA_DM_API_CFG_FILTER_COND;
    706 
    707 typedef struct
    708 {
    709     BT_HDR                          hdr;
    710     UINT8                           action;
    711     tBTA_DM_BLE_PF_STATUS_CBACK    *p_filt_status_cback;
    712     tBTA_DM_BLE_REF_VALUE            ref_value;
    713 }tBTA_DM_API_ENABLE_SCAN_FILTER;
    714 
    715 typedef struct
    716 {
    717     BT_HDR                          hdr;
    718     UINT8                           action;
    719     tBTA_DM_BLE_PF_FILT_INDEX       filt_index;
    720     tBTA_DM_BLE_PF_FILT_PARAMS      *p_filt_params;
    721     tBLE_BD_ADDR                    *p_target;
    722     tBTA_DM_BLE_PF_PARAM_CBACK      *p_filt_param_cback;
    723     tBTA_DM_BLE_REF_VALUE            ref_value;
    724 }tBTA_DM_API_SCAN_FILTER_PARAM_SETUP;
    725 #endif
    726 
    727 /* union of all data types */
    728 typedef union
    729 {
    730     /* GKI event buffer header */
    731     BT_HDR              hdr;
    732     tBTA_DM_API_ENABLE  enable;
    733 
    734     tBTA_DM_API_SET_NAME set_name;
    735 
    736     tBTA_DM_API_SET_VISIBILITY set_visibility;
    737 
    738     tBTA_DM_API_SET_AFH_CHANNELS_EVT set_afhchannels;
    739 
    740     tBTA_DM_API_VENDOR_SPECIFIC_COMMAND vendor_command;
    741 
    742     tBTA_DM_API_ADD_DEVICE  add_dev;
    743 
    744     tBTA_DM_API_REMOVE_DEVICE remove_dev;
    745 
    746     tBTA_DM_API_SEARCH search;
    747 
    748     tBTA_DM_API_DISCOVER discover;
    749 
    750     tBTA_DM_API_BOND bond;
    751 
    752     tBTA_DM_API_BOND_CANCEL bond_cancel;
    753 
    754     tBTA_DM_API_PIN_REPLY pin_reply;
    755     tBTA_DM_API_LINK_POLICY link_policy;
    756 
    757     tBTA_DM_API_LOC_OOB     loc_oob;
    758     tBTA_DM_API_CONFIRM     confirm;
    759     tBTA_DM_API_PASKY_CANCEL passkey_cancel;
    760     tBTA_DM_CI_IO_REQ       ci_io_req;
    761     tBTA_DM_CI_RMT_OOB      ci_rmt_oob;
    762 
    763     tBTA_DM_API_AUTH_REPLY auth_reply;
    764 
    765     tBTA_DM_REM_NAME rem_name;
    766 
    767     tBTA_DM_DISC_RESULT disc_result;
    768 
    769     tBTA_DM_INQUIRY_CMPL inq_cmpl;
    770 
    771     tBTA_DM_SDP_RESULT sdp_event;
    772 
    773     tBTA_API_DM_SIG_STRENGTH sig_strength;
    774 
    775     tBTA_API_DM_TX_INQPWR   tx_inq_pwr;
    776 
    777     tBTA_DM_ACL_CHANGE  acl_change;
    778 
    779     tBTA_DM_PM_BTM_STATUS pm_status;
    780 
    781     tBTA_DM_PM_TIMER pm_timer;
    782 
    783     tBTA_DM_API_DI_DISC     di_disc;
    784 
    785     tBTA_DM_API_EXECUTE_CBACK exec_cback;
    786 
    787     tBTA_DM_API_SET_ENCRYPTION     set_encryption;
    788 
    789 #if BLE_INCLUDED == TRUE
    790     tBTA_DM_API_ADD_BLEKEY              add_ble_key;
    791     tBTA_DM_API_ADD_BLE_DEVICE          add_ble_device;
    792     tBTA_DM_API_PASSKEY_REPLY           ble_passkey_reply;
    793     tBTA_DM_API_BLE_SEC_GRANT           ble_sec_grant;
    794     tBTA_DM_API_BLE_SET_BG_CONN_TYPE    ble_set_bd_conn_type;
    795     tBTA_DM_API_BLE_CONN_PARAMS         ble_set_conn_params;
    796     tBTA_DM_API_BLE_SCAN_PARAMS         ble_set_scan_params;
    797     tBTA_DM_API_BLE_OBSERVE             ble_observe;
    798     tBTA_DM_API_ENABLE_PRIVACY          ble_remote_privacy;
    799     tBTA_DM_API_LOCAL_PRIVACY           ble_local_privacy;
    800     tBTA_DM_API_BLE_ADV_PARAMS          ble_set_adv_params;
    801     tBTA_DM_API_SET_ADV_CONFIG          ble_set_adv_data;
    802 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
    803     tBTA_DM_API_SCAN_FILTER_PARAM_SETUP ble_scan_filt_param_setup;
    804     tBTA_DM_API_CFG_FILTER_COND         ble_cfg_filter_cond;
    805     tBTA_DM_API_ENABLE_SCAN_FILTER      ble_enable_scan_filt;
    806 #endif
    807     tBTA_DM_API_UPDATE_CONN_PARAM       ble_update_conn_params;
    808     tBTA_DM_API_BLE_MULTI_ADV_ENB       ble_multi_adv_enb;
    809     tBTA_DM_API_BLE_MULTI_ADV_PARAM     ble_multi_adv_param;
    810     tBTA_DM_API_BLE_MULTI_ADV_DATA      ble_multi_adv_data;
    811     tBTA_DM_API_BLE_MULTI_ADV_DISABLE   ble_multi_adv_disable;
    812 
    813     tBTA_DM_API_SET_STORAGE_CONFIG      ble_set_storage;
    814     tBTA_DM_API_ENABLE_SCAN             ble_enable_scan;
    815     tBTA_DM_API_READ_SCAN_REPORTS       ble_read_reports;
    816     tBTA_DM_API_DISABLE_SCAN            ble_disable_scan;
    817     tBTA_DM_API_TRACK_ADVERTISER        ble_track_advert;
    818     tBTA_DM_API_ENERGY_INFO             ble_energy_info;
    819 #endif
    820 
    821     tBTA_DM_API_SET_AFH_CHANNEL_ASSESSMENT set_afh_channel_assessment;
    822 
    823 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
    824     tBTA_DM_API_UPDATE_EIR_UUID     update_eir_uuid;
    825 #endif
    826 #if (BTM_EIR_SERVER_INCLUDED == TRUE)
    827     tBTA_DM_API_SET_EIR_CONFIG          set_eir_cfg;
    828 #endif
    829     tBTA_DM_API_REMOVE_ACL              remove_acl;
    830 
    831 } tBTA_DM_MSG;
    832 
    833 
    834 #define BTA_DM_NUM_PEER_DEVICE 7
    835 
    836 #define BTA_DM_NOT_CONNECTED  0
    837 #define BTA_DM_CONNECTED      1
    838 #define BTA_DM_UNPAIRING      2
    839 typedef UINT8 tBTA_DM_CONN_STATE;
    840 
    841 
    842 #define BTA_DM_DI_NONE          0x00       /* nothing special */
    843 #define BTA_DM_DI_USE_SSR       0x10       /* set this bit if ssr is supported for this link */
    844 #define BTA_DM_DI_AV_ACTIVE     0x20       /* set this bit if AV is active for this link */
    845 #define BTA_DM_DI_SET_SNIFF     0x01       /* set this bit if call BTM_SetPowerMode(sniff) */
    846 #define BTA_DM_DI_INT_SNIFF     0x02       /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */
    847 #define BTA_DM_DI_ACP_SNIFF     0x04       /* set this bit if peer init sniff */
    848 typedef UINT8 tBTA_DM_DEV_INFO;
    849 
    850 typedef struct
    851 {
    852     BD_ADDR                     peer_bdaddr;
    853     UINT16                      link_policy;
    854     tBTA_DM_CONN_STATE          conn_state;
    855     tBTA_PREF_ROLES             pref_role;
    856     BOOLEAN                     in_use;
    857     tBTA_DM_DEV_INFO            info;
    858     tBTA_DM_ENCRYPT_CBACK      *p_encrypt_cback;
    859 #if (BTM_SSR_INCLUDED == TRUE)
    860     tBTM_PM_STATUS              prev_low;   /* previous low power mode used */
    861 #endif
    862     tBTA_DM_PM_ACTTION          pm_mode_attempted;
    863     tBTA_DM_PM_ACTTION          pm_mode_failed;
    864     BOOLEAN                     remove_dev_pending;
    865     UINT16                      conn_handle;
    866     tBT_TRANSPORT               transport;
    867 } tBTA_DM_PEER_DEVICE;
    868 
    869 
    870 
    871 /* structure to store list of
    872   active connections */
    873 typedef struct
    874 {
    875     tBTA_DM_PEER_DEVICE    peer_device[BTA_DM_NUM_PEER_DEVICE];
    876     UINT8                  count;
    877 #if BLE_INCLUDED == TRUE
    878     UINT8                  le_count;
    879 #endif
    880 } tBTA_DM_ACTIVE_LINK;
    881 
    882 
    883 typedef struct
    884 {
    885     BD_ADDR                 peer_bdaddr;
    886     tBTA_SYS_ID             id;
    887     UINT8                   app_id;
    888     tBTA_SYS_CONN_STATUS    state;
    889 
    890 
    891 } tBTA_DM_SRVCS;
    892 
    893 #define BTA_DM_NUM_CONN_SRVS   5
    894 
    895 typedef struct
    896 {
    897 
    898     UINT8 count;
    899     tBTA_DM_SRVCS  conn_srvc[BTA_DM_NUM_CONN_SRVS];
    900 
    901 }  tBTA_DM_CONNECTED_SRVCS;
    902 
    903 typedef struct
    904 {
    905     TIMER_LIST_ENT          timer;
    906     BD_ADDR                 peer_bdaddr;
    907     BOOLEAN                 in_use;
    908 
    909 } tBTA_PM_TIMER;
    910 
    911 extern tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
    912 
    913 #define BTA_DM_NUM_PM_TIMER 3
    914 
    915 /* DM control block */
    916 typedef struct
    917 {
    918     BOOLEAN                     is_bta_dm_active;
    919     tBTA_DM_ACTIVE_LINK         device_list;
    920     tBTA_DM_SEC_CBACK           *p_sec_cback;
    921 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
    922     tBTA_BLE_SCAN_SETUP_CBACK   *p_setup_cback;
    923     tBTA_DM_BLE_PF_CFG_CBACK     *p_scan_filt_cfg_cback;
    924     tBTA_DM_BLE_PF_STATUS_CBACK  *p_scan_filt_status_cback;
    925     tBTA_DM_BLE_PF_PARAM_CBACK   *p_scan_filt_param_cback;
    926     tBTA_BLE_MULTI_ADV_CBACK     *p_multi_adv_cback;
    927     tBTA_BLE_ENERGY_INFO_CBACK   *p_energy_info_cback;
    928 #endif
    929     TIMER_LIST_ENT              signal_strength_timer;
    930     tBTA_SIG_STRENGTH_MASK      signal_strength_mask;
    931     UINT16                      state;
    932     UINT16                      signal_strength_period;
    933     BOOLEAN                     disabling;
    934     TIMER_LIST_ENT              disable_timer;
    935     UINT32                      wbt_sdp_handle;          /* WIDCOMM Extensions SDP record handle */
    936     UINT8                       wbt_scn;                 /* WIDCOMM Extensions SCN */
    937     UINT8                       num_master_only;
    938     UINT8                       pm_id;
    939     tBTA_PM_TIMER               pm_timer[BTA_DM_NUM_PM_TIMER];
    940     UINT32                      role_policy_mask;   /* the bits set indicates the modules that wants to remove role switch from the default link policy */
    941     UINT16                      cur_policy;         /* current default link policy */
    942     UINT16                      rs_event;           /* the event waiting for role switch */
    943     UINT8                       cur_av_count;       /* current AV connecions */
    944     BOOLEAN                     disable_pair_mode;          /* disable pair mode or not */
    945     BOOLEAN                     conn_paired_only;   /* allow connectable to paired device only or not */
    946     tBTA_DM_API_SEARCH          search_msg;
    947     UINT16                      page_scan_interval;
    948     UINT16                      page_scan_window;
    949     UINT16                      inquiry_scan_interval;
    950     UINT16                      inquiry_scan_window;
    951 
    952     /* Storage for pin code request parameters */
    953     BD_ADDR                     pin_bd_addr;
    954     DEV_CLASS                   pin_dev_class;
    955     tBTA_DM_SEC_EVT             pin_evt;
    956     UINT32          num_val;        /* the numeric value for comparison. If just_works, do not show this number to UI */
    957     BOOLEAN         just_works;     /* TRUE, if "Just Works" association model */
    958 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )
    959     /* store UUID list for EIR */
    960     TIMER_LIST_ENT              app_ready_timer;
    961     UINT32                      eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
    962 #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
    963     tBT_UUID                    custom_uuid[BTA_EIR_SERVER_NUM_CUSTOM_UUID];
    964 #endif
    965 
    966 #endif
    967 
    968     TIMER_LIST_ENT              switch_delay_timer;
    969 
    970 } tBTA_DM_CB;
    971 
    972 #ifndef BTA_DM_SDP_DB_SIZE
    973 #define BTA_DM_SDP_DB_SIZE 250
    974 #endif
    975 
    976 /* DM search control block */
    977 typedef struct
    978 {
    979 
    980     tBTA_DM_SEARCH_CBACK * p_search_cback;
    981     tBTM_INQ_INFO        * p_btm_inq_info;
    982     tBTA_SERVICE_MASK      services;
    983     tBTA_SERVICE_MASK      services_to_search;
    984     tBTA_SERVICE_MASK      services_found;
    985     tSDP_DISCOVERY_DB    * p_sdp_db;
    986     UINT16                 state;
    987     BD_ADDR                peer_bdaddr;
    988     BOOLEAN                name_discover_done;
    989     BD_NAME                peer_name;
    990     TIMER_LIST_ENT         search_timer;
    991     UINT8                  service_index;
    992     tBTA_DM_MSG          * p_search_queue;   /* search or discover commands during search cancel stored here */
    993     BOOLEAN                wait_disc;
    994     BOOLEAN                sdp_results;
    995     tSDP_UUID              uuid;
    996     UINT8                  peer_scn;
    997     BOOLEAN                sdp_search;
    998     tBTA_TRANSPORT         transport;
    999 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
   1000     tBTA_DM_SEARCH_CBACK * p_scan_cback;
   1001 #if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
   1002     tBTA_GATTC_IF          client_if;
   1003     UINT8                  num_uuid;
   1004     tBT_UUID               *p_srvc_uuid;
   1005     UINT8                  uuid_to_search;
   1006     BOOLEAN                gatt_disc_active;
   1007     UINT16                 conn_id;
   1008     UINT8 *                 p_ble_rawdata;
   1009     UINT32                 ble_raw_size;
   1010     UINT32                 ble_raw_used;
   1011     TIMER_LIST_ENT         gatt_close_timer;
   1012     BD_ADDR                pending_close_bda;
   1013 #endif
   1014 #endif
   1015 
   1016 
   1017 } tBTA_DM_SEARCH_CB;
   1018 
   1019 /* DI control block */
   1020 typedef struct
   1021 {
   1022     tSDP_DISCOVERY_DB    * p_di_db;     /* pointer to the DI discovery database */
   1023     UINT8               di_num;         /* total local DI record number */
   1024     UINT32              di_handle[BTA_DI_NUM_MAX];  /* local DI record handle, the first one is primary record */
   1025 }tBTA_DM_DI_CB;
   1026 
   1027 /* DM search state */
   1028 enum
   1029 {
   1030 
   1031     BTA_DM_SEARCH_IDLE,
   1032     BTA_DM_SEARCH_ACTIVE,
   1033     BTA_DM_SEARCH_CANCELLING,
   1034     BTA_DM_DISCOVER_ACTIVE
   1035 
   1036 };
   1037 
   1038 
   1039 
   1040 typedef struct
   1041 {
   1042     DEV_CLASS      dev_class;          /* local device class */
   1043     UINT16         policy_settings;    /* link policy setting hold, sniff, park, MS switch */
   1044     UINT16         page_timeout;       /* timeout for page in slots */
   1045     UINT16         link_timeout;       /* link supervision timeout in slots */
   1046     BOOLEAN        avoid_scatter;      /* TRUE to avoid scatternet when av is streaming (be the master) */
   1047 
   1048 } tBTA_DM_CFG;
   1049 
   1050 extern const UINT32 bta_service_id_to_btm_srv_id_lkup_tbl[];
   1051 
   1052 extern const tBTA_DM_CFG bta_dm_cfg;
   1053 
   1054 
   1055 typedef struct
   1056 {
   1057     UINT8   id;
   1058     UINT8   app_id;
   1059     UINT8   cfg;
   1060 
   1061 } tBTA_DM_RM ;
   1062 
   1063 extern tBTA_DM_CFG *p_bta_dm_cfg;
   1064 extern tBTA_DM_RM *p_bta_dm_rm_cfg;
   1065 
   1066 typedef struct
   1067 {
   1068 
   1069   UINT8  id;
   1070   UINT8  app_id;
   1071   UINT8  spec_idx;  /* index of spec table to use */
   1072 
   1073 } tBTA_DM_PM_CFG;
   1074 
   1075 
   1076 typedef struct
   1077 {
   1078 
   1079   tBTA_DM_PM_ACTTION  power_mode;
   1080   UINT16              timeout;
   1081 
   1082 } tBTA_DM_PM_ACTN;
   1083 
   1084 typedef struct
   1085 {
   1086 
   1087   UINT8  allow_mask;         /* mask of sniff/hold/park modes to allow */
   1088 #if (BTM_SSR_INCLUDED == TRUE)
   1089   UINT8  ssr;                /* set SSR on conn open/unpark */
   1090 #endif
   1091   tBTA_DM_PM_ACTN actn_tbl [BTA_DM_PM_NUM_EVTS][2];
   1092 
   1093 } tBTA_DM_PM_SPEC;
   1094 
   1095 typedef struct
   1096 {
   1097     UINT16      max_lat;
   1098     UINT16      min_rmt_to;
   1099     UINT16      min_loc_to;
   1100 } tBTA_DM_SSR_SPEC;
   1101 
   1102 typedef struct
   1103 {
   1104    UINT16 manufacturer;
   1105    UINT16 lmp_sub_version;
   1106    UINT8 lmp_version;
   1107 }tBTA_DM_LMP_VER_INFO;
   1108 
   1109 extern tBTA_DM_PM_CFG *p_bta_dm_pm_cfg;
   1110 extern tBTA_DM_PM_SPEC *p_bta_dm_pm_spec;
   1111 extern tBTM_PM_PWR_MD *p_bta_dm_pm_md;
   1112 #if (BTM_SSR_INCLUDED == TRUE)
   1113 extern tBTA_DM_SSR_SPEC *p_bta_dm_ssr_spec;
   1114 #endif
   1115 
   1116 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )
   1117 /* update dynamic BRCM Aware EIR data */
   1118 extern const tBTA_DM_EIR_CONF bta_dm_eir_cfg;
   1119 extern tBTA_DM_EIR_CONF *p_bta_dm_eir_cfg;
   1120 #endif
   1121 
   1122 /* DM control block */
   1123 #if BTA_DYNAMIC_MEMORY == FALSE
   1124 extern tBTA_DM_CB  bta_dm_cb;
   1125 #else
   1126 extern tBTA_DM_CB *bta_dm_cb_ptr;
   1127 #define bta_dm_cb (*bta_dm_cb_ptr)
   1128 #endif
   1129 
   1130 /* DM search control block */
   1131 #if BTA_DYNAMIC_MEMORY == FALSE
   1132 extern tBTA_DM_SEARCH_CB  bta_dm_search_cb;
   1133 #else
   1134 extern tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr;
   1135 #define bta_dm_search_cb (*bta_dm_search_cb_ptr)
   1136 #endif
   1137 
   1138 /* DI control block */
   1139 #if BTA_DYNAMIC_MEMORY == FALSE
   1140 extern tBTA_DM_DI_CB  bta_dm_di_cb;
   1141 #else
   1142 extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
   1143 #define bta_dm_di_cb (*bta_dm_di_cb_ptr)
   1144 #endif
   1145 
   1146 extern BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg);
   1147 extern void bta_dm_sm_disable( void );
   1148 extern BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg);
   1149 extern void bta_dm_search_sm_disable( void );
   1150 
   1151 
   1152 extern void bta_dm_enable (tBTA_DM_MSG *p_data);
   1153 extern void bta_dm_disable (tBTA_DM_MSG *p_data);
   1154 extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
   1155 extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data);
   1156 extern void bta_dm_set_afhchannels (tBTA_DM_MSG *p_data);
   1157 extern void bta_dm_vendor_spec_command(tBTA_DM_MSG *p_data);
   1158 extern void bta_dm_bond (tBTA_DM_MSG *p_data);
   1159 extern void bta_dm_bond_cancel (tBTA_DM_MSG *p_data);
   1160 extern void bta_dm_pin_reply (tBTA_DM_MSG *p_data);
   1161 extern void bta_dm_link_policy (tBTA_DM_MSG *p_data);
   1162 extern void bta_dm_auth_reply (tBTA_DM_MSG *p_data);
   1163 extern void bta_dm_signal_strength(tBTA_DM_MSG *p_data);
   1164 extern void bta_dm_tx_inqpower(tBTA_DM_MSG *p_data);
   1165 extern void bta_dm_acl_change(tBTA_DM_MSG *p_data);
   1166 extern void bta_dm_add_device (tBTA_DM_MSG *p_data);
   1167 extern void bta_dm_remove_device (tBTA_DM_MSG *p_data);
   1168 extern void bta_dm_close_acl(tBTA_DM_MSG *p_data);
   1169 
   1170 
   1171 extern void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data);
   1172 extern void bta_dm_pm_timer(tBTA_DM_MSG *p_data);
   1173 extern void bta_dm_add_ampkey (tBTA_DM_MSG *p_data);
   1174 
   1175 #if BLE_INCLUDED == TRUE
   1176 extern void bta_dm_add_blekey (tBTA_DM_MSG *p_data);
   1177 extern void bta_dm_add_ble_device (tBTA_DM_MSG *p_data);
   1178 extern void bta_dm_ble_passkey_reply (tBTA_DM_MSG *p_data);
   1179 extern void bta_dm_security_grant (tBTA_DM_MSG *p_data);
   1180 extern void bta_dm_ble_set_bg_conn_type (tBTA_DM_MSG *p_data);
   1181 extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
   1182 extern void bta_dm_ble_set_scan_params (tBTA_DM_MSG *p_data);
   1183 extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
   1184 extern void bta_dm_ble_observe (tBTA_DM_MSG *p_data);
   1185 extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
   1186 extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
   1187 extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data);
   1188 extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
   1189 extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
   1190 extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
   1191 
   1192 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
   1193 extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
   1194 extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
   1195 extern void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data);
   1196 #endif
   1197 extern void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data);
   1198 extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data);
   1199 extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data);
   1200 extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data);
   1201 
   1202 extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data);
   1203 extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG * p_data);
   1204 extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG * p_data);
   1205 extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG * p_data);
   1206 extern void bta_dm_ble_track_advertiser(tBTA_DM_MSG * p_data);
   1207 extern void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data);
   1208 
   1209 #endif
   1210 extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data);
   1211 extern void bta_dm_confirm(tBTA_DM_MSG *p_data);
   1212 extern void bta_dm_passkey_cancel(tBTA_DM_MSG *p_data);
   1213 #if (BTM_OOB_INCLUDED == TRUE)
   1214 extern void bta_dm_loc_oob(tBTA_DM_MSG *p_data);
   1215 extern void bta_dm_ci_io_req_act(tBTA_DM_MSG *p_data);
   1216 extern void bta_dm_ci_rmt_oob_act(tBTA_DM_MSG *p_data);
   1217 #endif /* BTM_OOB_INCLUDED */
   1218 
   1219 extern void bta_dm_init_pm(void);
   1220 extern void bta_dm_disable_pm(void);
   1221 
   1222 extern void bta_dm_search_start (tBTA_DM_MSG *p_data);
   1223 extern void bta_dm_search_cancel (tBTA_DM_MSG *p_data);
   1224 extern void bta_dm_discover (tBTA_DM_MSG *p_data);
   1225 extern void bta_dm_di_disc (tBTA_DM_MSG *p_data);
   1226 extern void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data);
   1227 extern void bta_dm_rmt_name (tBTA_DM_MSG *p_data);
   1228 extern void bta_dm_sdp_result (tBTA_DM_MSG *p_data);
   1229 extern void bta_dm_search_cmpl (tBTA_DM_MSG *p_data);
   1230 extern void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data);
   1231 extern void bta_dm_disc_result (tBTA_DM_MSG *p_data);
   1232 extern void bta_dm_search_result (tBTA_DM_MSG *p_data);
   1233 extern void bta_dm_discovery_cmpl (tBTA_DM_MSG *p_data);
   1234 extern void bta_dm_queue_search (tBTA_DM_MSG *p_data);
   1235 extern void bta_dm_queue_disc (tBTA_DM_MSG *p_data);
   1236 extern void bta_dm_search_clear_queue (tBTA_DM_MSG *p_data);
   1237 extern void bta_dm_search_cancel_cmpl (tBTA_DM_MSG *p_data);
   1238 extern void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data);
   1239 extern void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data);
   1240 extern void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data);
   1241 extern tBTA_DM_PEER_DEVICE * bta_dm_find_peer_device(BD_ADDR peer_addr);
   1242 
   1243 extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
   1244 
   1245 extern void bta_dm_pm_active(BD_ADDR peer_addr);
   1246 
   1247 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )
   1248 void bta_dm_eir_update_uuid(UINT16 uuid16, BOOLEAN adding);
   1249 #else
   1250 #define bta_dm_eir_update_uuid(x, y)
   1251 #endif
   1252 
   1253 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
   1254 extern void bta_dm_update_eir_uuid (tBTA_DM_MSG *p_data);
   1255 #endif
   1256 #if (BTM_EIR_SERVER_INCLUDED == TRUE)
   1257 extern void bta_dm_set_eir_config (tBTA_DM_MSG *p_data);
   1258 #endif
   1259 extern void bta_dm_enable_test_mode(tBTA_DM_MSG *p_data);
   1260 extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data);
   1261 extern void bta_dm_execute_callback(tBTA_DM_MSG *p_data);
   1262 
   1263 extern void bta_dm_set_afh_channel_assesment(tBTA_DM_MSG *p_data);
   1264 
   1265 #endif /* BTA_DM_INT_H */
   1266 
   1267