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

Commit c71350e4 authored by Priti Aghera's avatar Priti Aghera Committed by Andre Eisenbach
Browse files

LE Data Packet Extension support

Included support for LE data packet extension feature according
to BT 4.2 spec. This patch checks if the controller supports LE
packet extension and provides functions to set the PDU length.

Bug: 20013956
Change-Id: I6a92970fede2f793ad48c9fa2e0247ad00297533
parent ba1730a1
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -4753,6 +4753,24 @@ void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data)
        (*p_data->ble_set_adv_data.p_adv_data_cback)(status);
        (*p_data->ble_set_adv_data.p_adv_data_cback)(status);
}
}


/*******************************************************************************
**
** Function         bta_dm_ble_set_data_length
**
** Description      This function set the maximum transmission packet size
**
** Parameters
**
*******************************************************************************/
void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
{
    if (BTM_SetBleDataLength(p_data->ble_set_data_length.remote_bda,
                        p_data->ble_set_data_length.tx_data_length) != BTM_SUCCESS)
    {
        APPL_TRACE_ERROR("%s failed", __FUNCTION__);
    }
}

/*******************************************************************************
/*******************************************************************************
**
**
** Function         bta_dm_ble_broadcast
** Function         bta_dm_ble_broadcast
+26 −0
Original line number Original line Diff line number Diff line
@@ -1882,6 +1882,32 @@ void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, UINT16 max
        bta_sys_sendmsg(p_msg);
        bta_sys_sendmsg(p_msg);
    }
    }
}
}

/*******************************************************************************
**
** Function         BTA_DmBleSetDataLength
**
** Description      This function is to set maximum LE data packet size
**
** Returns          void
**
**
*******************************************************************************/
void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length)
{
    tBTA_DM_API_BLE_SET_DATA_LENGTH *p_msg;

    if ((p_msg = (tBTA_DM_API_BLE_SET_DATA_LENGTH *)GKI_getbuf(sizeof(tBTA_DM_API_BLE_SET_DATA_LENGTH)))
                  != NULL)
    {
        bdcpy(p_msg->remote_bda, remote_device);
        p_msg->hdr.event = BTA_DM_API_SET_DATA_LENGTH_EVT;
        p_msg->tx_data_length = tx_data_length;

        bta_sys_sendmsg(p_msg);
    }
}

#endif
#endif


/*******************************************************************************
/*******************************************************************************
+11 −0
Original line number Original line Diff line number Diff line
@@ -99,6 +99,7 @@ enum
    BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
    BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
    BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
    BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
    BTA_DM_API_BLE_BROADCAST_EVT,
    BTA_DM_API_BLE_BROADCAST_EVT,
    BTA_DM_API_SET_DATA_LENGTH_EVT,


#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
    BTA_DM_API_CFG_FILTER_COND_EVT,
    BTA_DM_API_CFG_FILTER_COND_EVT,
@@ -466,6 +467,13 @@ typedef struct
    tBTA_DM_SEARCH_CBACK * p_cback;
    tBTA_DM_SEARCH_CBACK * p_cback;
}tBTA_DM_API_BLE_OBSERVE;
}tBTA_DM_API_BLE_OBSERVE;


typedef struct
{
    BT_HDR      hdr;
    BD_ADDR     remote_bda;
    UINT16      tx_data_length;
}tBTA_DM_API_BLE_SET_DATA_LENGTH;

/* set adv parameter for BLE advertising */
/* set adv parameter for BLE advertising */
typedef struct
typedef struct
{
{
@@ -692,6 +700,8 @@ typedef union
    tBTA_DM_API_ENABLE_SCAN_FILTER      ble_enable_scan_filt;
    tBTA_DM_API_ENABLE_SCAN_FILTER      ble_enable_scan_filt;
#endif
#endif
    tBTA_DM_API_UPDATE_CONN_PARAM       ble_update_conn_params;
    tBTA_DM_API_UPDATE_CONN_PARAM       ble_update_conn_params;
    tBTA_DM_API_BLE_SET_DATA_LENGTH     ble_set_data_length;

    tBTA_DM_API_BLE_MULTI_ADV_ENB       ble_multi_adv_enb;
    tBTA_DM_API_BLE_MULTI_ADV_ENB       ble_multi_adv_enb;
    tBTA_DM_API_BLE_MULTI_ADV_PARAM     ble_multi_adv_param;
    tBTA_DM_API_BLE_MULTI_ADV_PARAM     ble_multi_adv_param;
    tBTA_DM_API_BLE_MULTI_ADV_DATA      ble_multi_adv_data;
    tBTA_DM_API_BLE_MULTI_ADV_DATA      ble_multi_adv_data;
@@ -1057,6 +1067,7 @@ extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);


#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
+1 −0
Original line number Original line Diff line number Diff line
@@ -96,6 +96,7 @@ const tBTA_DM_ACTION bta_dm_action[] =
    bta_dm_ble_set_adv_config,     /* BTA_DM_API_BLE_SET_ADV_CONFIG_EVT */
    bta_dm_ble_set_adv_config,     /* BTA_DM_API_BLE_SET_ADV_CONFIG_EVT */
    bta_dm_ble_set_scan_rsp,       /* BTA_DM_API_BLE_SET_SCAN_RSP_EVT */
    bta_dm_ble_set_scan_rsp,       /* BTA_DM_API_BLE_SET_SCAN_RSP_EVT */
    bta_dm_ble_broadcast,          /* BTA_DM_API_BLE_BROADCAST_EVT */
    bta_dm_ble_broadcast,          /* BTA_DM_API_BLE_BROADCAST_EVT */
    bta_dm_ble_set_data_length,    /* BTA_DM_API_SET_DATA_LENGTH_EVT */
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
    bta_dm_cfg_filter_cond,         /* BTA_DM_API_CFG_FILTER_COND_EVT */
    bta_dm_cfg_filter_cond,         /* BTA_DM_API_CFG_FILTER_COND_EVT */
    bta_dm_scan_filter_param_setup, /* BTA_DM_API_SCAN_FILTER_SETUP_EVT */
    bta_dm_scan_filter_param_setup, /* BTA_DM_API_SCAN_FILTER_SETUP_EVT */
+11 −0
Original line number Original line Diff line number Diff line
@@ -2154,6 +2154,17 @@ extern void BTA_BleDisableAdvInstance(UINT8 inst_id);
extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
                                   UINT16 max_int, UINT16 latency, UINT16 timeout);
                                   UINT16 max_int, UINT16 latency, UINT16 timeout);


/*******************************************************************************
**
** Function         BTA_DmBleSetDataLength
**
** Description      This function is to set maximum LE data packet size
**
** Returns          void
**
*******************************************************************************/
extern void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length);

/*******************************************************************************
/*******************************************************************************
**
**
** Function         BTA_DmBleSetStorageParams
** Function         BTA_DmBleSetStorageParams
Loading