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

Commit b1d1f97e authored by Satya Calloji's avatar Satya Calloji Committed by Prerepa Viswanadham
Browse files

LE low power scan feature

LE low power extended scan feature stack changes
based on Google BLE spec v0.95

Bug: 20029342
Change-Id: I1db2d9bb648295340d0e93ca89d27e1b938d33d3
parent 7cd82420
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -4607,12 +4607,30 @@ void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data)
**
** Function         bta_dm_ble_set_scan_params
**
** Description      This function set the preferred connection scan parameters.
** Description      This function sets BLE scan parameters.
**
** Parameters:
**
*******************************************************************************/
void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data)
{
    BTM_BleSetScanParams(p_data->ble_set_scan_params.client_if,
                         p_data->ble_set_scan_params.scan_int,
                         p_data->ble_set_scan_params.scan_window,
                         p_data->ble_set_scan_params.scan_mode,
                         p_data->ble_set_scan_params.scan_param_setup_cback);
}

/*******************************************************************************
**
** Function         bta_dm_ble_set_conn_scan_params
**
** Description      This function set the preferred connection scan parameters.
**
** Parameters:
**
*******************************************************************************/
void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data)
{
    BTM_BleSetConnScanParams(p_data->ble_set_scan_params.scan_int,
                             p_data->ble_set_scan_params.scan_window);
@@ -4689,7 +4707,7 @@ void bta_dm_ble_observe (tBTA_DM_MSG *p_data)
}
/*******************************************************************************
**
** Function         bta_dm_ble_set_scan_params
** Function         bta_dm_ble_set_adv_params
**
** Description      This function set the adv parameters.
**
+40 −11
Original line number Diff line number Diff line
@@ -903,23 +903,52 @@ void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
** Returns          void
**
*******************************************************************************/
void BTA_DmSetBleConnScanParams(UINT16 scan_interval, UINT16 scan_window )
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 *)GKI_getbuf(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS))) != NULL)
    {
        memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_SCAN_PARAMS));
        p_msg->hdr.event = BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT;
        p_msg->scan_int         = scan_interval;
        p_msg->scan_window      = scan_window;
        bta_sys_sendmsg(p_msg);
    }
}

        p_msg->hdr.event = BTA_DM_API_BLE_SCAN_PARAM_EVT;
/*******************************************************************************
**
** Function         BTA_DmSetBleScanParams
**
** Description      This function is called to set scan parameters
**
** Parameters:      client_if - Client IF
**                  scan_interval - scan interval
**                  scan_window - scan window
**                  scan_mode - scan mode
**                  scan_param_setup_status_cback - Set scan param status callback
**
** Returns          void
**
*******************************************************************************/
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)
{
    tBTA_DM_API_BLE_SCAN_PARAMS *p_msg;

    if ((p_msg = (tBTA_DM_API_BLE_SCAN_PARAMS *)GKI_getbuf(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS))) != NULL)
    {
        memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_SCAN_PARAMS));
        p_msg->hdr.event = BTA_DM_API_BLE_SCAN_PARAM_EVT;
        p_msg->client_if = client_if;
        p_msg->scan_int = scan_interval;
        p_msg->scan_window = scan_window;
        p_msg->scan_mode = scan_mode;
        p_msg->scan_param_setup_cback = scan_param_setup_cback;

        bta_sys_sendmsg(p_msg);
    }
#endif
}

/*******************************************************************************
@@ -1084,7 +1113,7 @@ extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max,
** Returns          None
**
*******************************************************************************/
extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode,
extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode,
                                         UINT32 scan_interval, UINT32 scan_window,
                                         tBTA_BLE_DISCARD_RULE discard_rule,
                                         tBLE_ADDR_TYPE        addr_type,
@@ -1141,7 +1170,7 @@ extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value)
** Returns          None
**
*******************************************************************************/
extern void BTA_DmBleReadScanReports(tBTA_BLE_SCAN_MODE scan_type,
extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type,
                                             tBTA_DM_BLE_REF_VALUE ref_value)
{
    tBTA_DM_API_READ_SCAN_REPORTS  *p_msg;
+10 −5
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ enum
    BTA_DM_API_BLE_SET_BG_CONN_TYPE,
    BTA_DM_API_BLE_CONN_PARAM_EVT,
    BTA_DM_API_BLE_SCAN_PARAM_EVT,
    BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
    BTA_DM_API_BLE_OBSERVE_EVT,
    BTA_DM_API_UPDATE_CONN_PARAM_EVT,
#if BLE_PRIVACY_SPT == TRUE
@@ -454,8 +455,11 @@ typedef struct
typedef struct
{
    BT_HDR hdr;
    UINT16                  scan_int;
    UINT16                  scan_window;
    tBTA_GATTC_IF client_if;
    UINT32 scan_int;
    UINT32 scan_window;
    tBLE_SCAN_MODE scan_mode;
    tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback;
}tBTA_DM_API_BLE_SCAN_PARAMS;

/* Data type for start/stop observe */
@@ -544,7 +548,7 @@ typedef struct
typedef struct
{
    BT_HDR                  hdr;
    tBTA_BLE_SCAN_MODE      scan_mode;
    tBTA_BLE_BATCH_SCAN_MODE  scan_mode;
    UINT32                  scan_int;
    UINT32                  scan_window;
    tBTA_BLE_DISCARD_RULE   discard_rule;
@@ -561,7 +565,7 @@ typedef struct
typedef struct
{
    BT_HDR                  hdr;
    tBTA_BLE_SCAN_MODE scan_type;
    tBTA_BLE_BATCH_SCAN_MODE scan_type;
    tBTA_DM_BLE_REF_VALUE    ref_value;
} tBTA_DM_API_READ_SCAN_REPORTS;

@@ -1059,6 +1063,7 @@ extern void bta_dm_security_grant (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_bg_conn_type (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data);
extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_observe (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
+4 −3
Original line number Diff line number Diff line
@@ -87,12 +87,13 @@ const tBTA_DM_ACTION bta_dm_action[] =
    bta_dm_ble_set_bg_conn_type,
    bta_dm_ble_set_conn_params,  /* BTA_DM_API_BLE_CONN_PARAM_EVT */
    bta_dm_ble_set_scan_params,  /* BTA_DM_API_BLE_SCAN_PARAM_EVT */
    bta_dm_ble_set_conn_scan_params,  /* BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT */
    bta_dm_ble_observe,
    bta_dm_ble_update_conn_params,   /* BTA_DM_API_UPDATE_CONN_PARAM_EVT */
#if BLE_PRIVACY_SPT == TRUE
    bta_dm_ble_config_local_privacy,   /* BTA_DM_API_LOCAL_PRIVACY_EVT */
#endif
    bta_dm_ble_set_adv_params,     /* BTA_DM_API_BLE_SCAN_PARAM_EVT */
    bta_dm_ble_set_adv_params,     /* BTA_DM_API_BLE_ADV_PARAM_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_broadcast,          /* BTA_DM_API_BLE_BROADCAST_EVT */
+27 −8
Original line number Diff line number Diff line
@@ -457,11 +457,11 @@ typedef struct

enum
{
    BTA_BLE_SCAN_MODE_PASS=1,
    BTA_BLE_SCAN_MODE_ACTI=2,
    BTA_BLE_SCAN_MODE_PASS_ACTI=3
    BTA_BLE_BATCH_SCAN_MODE_PASS = 1,
    BTA_BLE_BATCH_SCAN_MODE_ACTI = 2,
    BTA_BLE_BATCH_SCAN_MODE_PASS_ACTI = 3
};
typedef UINT8 tBTA_BLE_SCAN_MODE;
typedef UINT8 tBTA_BLE_BATCH_SCAN_MODE;

enum
{
@@ -1864,8 +1864,27 @@ extern void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
** Returns          void
**
*******************************************************************************/
extern void BTA_DmSetBleConnScanParams(UINT16 scan_interval,
                                       UINT16 scan_window );
extern void BTA_DmSetBleConnScanParams(UINT32 scan_interval,
                                       UINT32 scan_window);

/*******************************************************************************
**
** Function         BTA_DmSetBleScanParams
**
** Description      This function is called to set scan parameters
**
** Parameters:      client_if - Client IF
**                  scan_interval - scan interval
**                  scan_window - scan window
**                  scan_mode - scan mode
**                  scan_param_setup_status_cback - Set scan param status callback
**
** Returns          void
**
*******************************************************************************/
extern 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_status_cback);

/*******************************************************************************
**
@@ -2196,7 +2215,7 @@ extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max,
** Returns           None
**
*******************************************************************************/
extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode,
extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode,
                                         UINT32 scan_interval, UINT32 scan_window,
                                         tBTA_BLE_DISCARD_RULE discard_rule,
                                         tBLE_ADDR_TYPE        addr_type,
@@ -2214,7 +2233,7 @@ extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode,
** Returns          None
**
*******************************************************************************/
extern void BTA_DmBleReadScanReports(tBTA_BLE_SCAN_MODE scan_type,
extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type,
                                             tBTA_DM_BLE_REF_VALUE ref_value);

/*******************************************************************************
Loading