Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 317e1647 authored by Scott James Remnant's avatar Scott James Remnant Committed by android-build-merger
Browse files

Allow Bluetooth to build on systems with no LE support

am: e532824b

* commit 'e532824b':
  Allow Bluetooth to build on systems with no LE support
parents 7fd14f8c e532824b
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
@@ -348,7 +348,7 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
        memcpy(dev_class, p_bta_dm_cfg->dev_class, sizeof(dev_class));
        BTM_SetDeviceClass (dev_class);

#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
        /* load BLE local information: ID keys, ER if available */
        bta_dm_co_ble_load_local_keys(&key_mask, er, &id_key);

@@ -360,10 +360,10 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
        {
            BTM_BleLoadLocalKeys(BTA_BLE_LOCAL_KEY_TYPE_ID, (tBTM_BLE_LOCAL_KEYS *)&id_key);
        }
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#if (defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
        bta_dm_search_cb.conn_id = BTA_GATT_INVALID_CONN_ID;
#endif
#endif
#endif  // (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
#endif  // (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))

        BTM_SecRegister((tBTM_APPL_INFO*)&bta_security);
        BTM_SetDefaultLinkSuperTout(p_bta_dm_cfg->link_timeout);
@@ -543,18 +543,21 @@ void bta_dm_set_dev_name (tBTA_DM_MSG *p_data)
void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
{
    UINT16 window, interval;
#if (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
    UINT16 le_disc_mode = BTM_BleReadDiscoverability();
    UINT16 disc_mode = BTM_ReadDiscoverability(&window, &interval);
    UINT16 le_conn_mode = BTM_BleReadConnectability();
#endif  // (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
    UINT16 disc_mode = BTM_ReadDiscoverability(&window, &interval);
    UINT16 conn_mode = BTM_ReadConnectability(&window, &interval);

    /* set modes for Discoverability and connectability if not ignore */
    if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE))
    {
#if (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
        if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
            p_data->set_visibility.disc_mode =
                ((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);

#endif  // (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
        if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
            p_data->set_visibility.disc_mode =
                ((p_data->set_visibility.disc_mode & ~BTA_DM_IGNORE) | disc_mode);
@@ -566,10 +569,11 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)

    if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE))
    {
#if (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
        if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
            p_data->set_visibility.conn_mode =
                ((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);

#endif  // (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
        if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
            p_data->set_visibility.conn_mode =
                ((p_data->set_visibility.conn_mode & ~BTA_DM_IGNORE) | conn_mode);
@@ -648,6 +652,7 @@ void bta_dm_process_remove_device(BD_ADDR bd_addr)
void bta_dm_remove_device(tBTA_DM_MSG *p_data)
{
    tBTA_DM_API_REMOVE_DEVICE *p_dev = &p_data->remove_dev;
    BOOLEAN continue_delete_other_dev = FALSE;
    if (p_dev == NULL)
        return;

@@ -669,8 +674,14 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
        {
            if (!bdcmp(bta_dm_cb.device_list.peer_device[i].peer_bdaddr, p_dev->bd_addr))
            {
                UINT8 transport = BT_TRANSPORT_BR_EDR;

#if (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
                transport = bta_dm_cb.device_list.peer_device[i].transport;
#endif  // (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
                bta_dm_cb.device_list.peer_device[i].conn_state = BTA_DM_UNPAIRING;
                btm_remove_acl( p_dev->bd_addr, bta_dm_cb.device_list.peer_device[i].transport);
                btm_remove_acl(p_dev->bd_addr, transport);
#if (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
                APPL_TRACE_DEBUG("%s:transport = %d", __func__,
                                  bta_dm_cb.device_list.peer_device[i].transport);

@@ -679,6 +690,8 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
                   other_transport = BT_TRANSPORT_BR_EDR;
                else
                   other_transport = BT_TRANSPORT_LE;
#endif  // (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)

                break;
            }
        }
@@ -687,10 +700,9 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
    {
        continue_delete_dev = TRUE;
    }

#if (defined(BTA_GATT_INCLUDED) && BTA_GATT_INCLUDED)
    // If it is DUMO device and device is paired as different address, unpair that device
    // if different address
    BOOLEAN continue_delete_other_dev = FALSE;
    if ((other_transport && (BTM_ReadConnectedTransportAddress(other_address, other_transport))) ||
      (!other_transport && (BTM_ReadConnectedTransportAddress(other_address, BT_TRANSPORT_BR_EDR) ||
       BTM_ReadConnectedTransportAddress(other_address, BT_TRANSPORT_LE))))
@@ -712,7 +724,7 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
        APPL_TRACE_DEBUG("%s: continue to delete the other dev ", __func__);
        continue_delete_other_dev = TRUE;
    }

#endif
    /* Delete the device mentioned in the msg */
    if (continue_delete_dev)
        bta_dm_process_remove_device(p_dev->bd_addr);
@@ -2315,7 +2327,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
        APPL_TRACE_DEBUG("%s appl_knows_rem_name %d", __func__,
                            bta_dm_search_cb.p_btm_inq_info->appl_knows_rem_name);
    }

#if (defined(BLE_INCLUDED) && BLE_INCLUDED == TRUE)
    if((bta_dm_search_cb.p_btm_inq_info)
       && (bta_dm_search_cb.p_btm_inq_info->results.device_type == BT_DEVICE_TYPE_BLE)
       && (bta_dm_search_cb.state == BTA_DM_SEARCH_ACTIVE))
@@ -2323,7 +2335,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
        /* Do not perform RNR for LE devices at inquiry complete*/
        bta_dm_search_cb.name_discover_done = TRUE;
    }

#endif
    /* if name discovery is not done and application needs remote name */
    if ((!bta_dm_search_cb.name_discover_done)
       && (( bta_dm_search_cb.p_btm_inq_info == NULL )
+5 −0
Original line number Diff line number Diff line
@@ -919,6 +919,7 @@ void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
*******************************************************************************/
void BTA_DmSetBleConnScanParams(UINT32 scan_interval, UINT32 scan_window)
{
#if BLE_INCLUDED == TRUE
    tBTA_DM_API_BLE_SCAN_PARAMS  *p_msg;
    if ((p_msg = (tBTA_DM_API_BLE_SCAN_PARAMS *)osi_getbuf(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS))) != NULL)
    {
@@ -928,6 +929,7 @@ void BTA_DmSetBleConnScanParams(UINT32 scan_interval, UINT32 scan_window)
        p_msg->scan_window      = scan_window;
        bta_sys_sendmsg(p_msg);
    }
#endif  // BLE_INCLUDED == TRUE
}

/*******************************************************************************
@@ -945,6 +947,8 @@ void BTA_DmSetBleConnScanParams(UINT32 scan_interval, UINT32 scan_window)
** Returns          void
**
*******************************************************************************/

#if BLE_INCLUDED == TRUE
void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
                            UINT32 scan_window, tBLE_SCAN_MODE scan_mode,
                            tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback)
@@ -964,6 +968,7 @@ void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
        bta_sys_sendmsg(p_msg);
    }
}
#endif  // BLE_INCLUDED == TRUE

/*******************************************************************************
**
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@

#include "bta_hl_api.h"
#include "bt_common.h"
#include "osi/include/non_repeating_timer.h"

/*******************************************************************************
**  Constants & Macros
+2 −0
Original line number Diff line number Diff line
@@ -927,8 +927,10 @@ void btm_read_remote_version_complete (UINT8 *p)
                STREAM_TO_UINT16 (p_acl_cb->lmp_subversion, p);
            }

#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
            if (p_acl_cb->transport == BT_TRANSPORT_LE)
                l2cble_notify_le_connection (p_acl_cb->remote_addr);
#endif  // (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
            break;
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@

#include "rfcdefs.h"
#include "osi/include/fixed_queue.h"
#include "osi/include/non_repeating_timer.h"

#include "btm_api.h"