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

Commit f269cfc3 authored by Bill Yi's avatar Bill Yi
Browse files

Merge commit '60eb9cc7' into HEAD

parents 38e0db57 60eb9cc7
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
@@ -674,6 +674,11 @@ void bta_dm_remove_device (tBTA_DM_MSG *p_data)
    int i;
    tBTA_DM_SEC sec_event;

#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
    /* need to remove all pending background connection before unpair */
    BTA_GATTC_CancelOpen(0, p_dev->bd_addr, FALSE);
#endif

    if (BTM_IsAclConnectionUp(p_dev->bd_addr))
    {
        /* Take the link down first, and mark the device for removal when disconnected */
@@ -693,6 +698,11 @@ void bta_dm_remove_device (tBTA_DM_MSG *p_data)
    else    /* Ok to remove the device in application layer */
    {
        BTM_SecDeleteDevice(p_dev->bd_addr);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
        /* remove all cached GATT information */
        BTA_GATTC_Refresh(p_dev->bd_addr);
#endif

        if( bta_dm_cb.p_sec_cback )
        {
            bdcpy(sec_event.link_down.bd_addr, p_dev->bd_addr);
@@ -3460,6 +3470,10 @@ void bta_dm_acl_change(tBTA_DM_MSG *p_data)
            if( bta_dm_cb.device_list.peer_device[i].conn_state == BTA_DM_UNPAIRING )
            {
                BTM_SecDeleteDevice(bta_dm_cb.device_list.peer_device[i].peer_bdaddr);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
                /* remove all cached GATT information */
                BTA_GATTC_Refresh(p_bda);
#endif
                issue_unpair_cb = TRUE;
            }

@@ -3769,6 +3783,12 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
    else
    {
        BTM_SecDeleteDevice (remote_bd_addr);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
        /* need to remove all pending background connection */
        BTA_GATTC_CancelOpen(0, remote_bd_addr, FALSE);
        /* remove all cached GATT information */
        BTA_GATTC_Refresh(remote_bd_addr);
#endif
    }
}

@@ -4998,6 +5018,7 @@ void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data)
                        p_data->ble_set_adv_params.p_dir_bda,
                        BTA_DM_BLE_ADV_CHNL_MAP);
}

/*******************************************************************************
**
** Function         bta_dm_ble_set_adv_config
@@ -5013,6 +5034,34 @@ void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data)
                        (tBTM_BLE_ADV_DATA *)p_data->ble_set_adv_data.p_adv_cfg);
}

/*******************************************************************************
**
** Function         bta_dm_ble_set_scan_rsp
**
** Description      This function set the customized ADV scan resp. configuration
**
** Parameters:
**
*******************************************************************************/
void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data)
{
    BTM_BleWriteScanRsp(p_data->ble_set_adv_data.data_mask,
                        (tBTM_BLE_ADV_DATA *)p_data->ble_set_adv_data.p_adv_cfg);
}

/*******************************************************************************
**
** Function         bta_dm_ble_broadcast
**
** Description      Starts or stops LE broadcasts
**
** Parameters:
**
*******************************************************************************/
void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data)
{
    BTM_BleBroadcast(p_data->ble_observe.start);
}

#if ((defined BTA_GATT_INCLUDED) &&  (BTA_GATT_INCLUDED == TRUE))
#ifndef BTA_DM_GATT_CLOSE_DELAY_TOUT
+54 −0
Original line number Diff line number Diff line
@@ -1510,6 +1510,60 @@ void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_adv
        bta_sys_sendmsg(p_msg);
    }
}

/*******************************************************************************
**
** Function         BTA_DmBleSetScanRsp
**
** Description      This function is called to override the BTA scan response.
**
** Parameters       Pointer to User defined ADV data structure
**
** Returns          None
**
*******************************************************************************/
BTA_API extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_adv_cfg)
{
    tBTA_DM_API_SET_ADV_CONFIG  *p_msg;

    if ((p_msg = (tBTA_DM_API_SET_ADV_CONFIG *) GKI_getbuf(sizeof(tBTA_DM_API_SET_ADV_CONFIG))) != NULL)
    {
        p_msg->hdr.event = BTA_DM_API_BLE_SET_SCAN_RSP_EVT;
		p_msg->data_mask = data_mask;
        p_msg->p_adv_cfg = p_adv_cfg;

        bta_sys_sendmsg(p_msg);
    }
}

/*******************************************************************************
**
** Function         BTA_DmBleBroadcast
**
** Description      This function starts or stops LE broadcasting.
**
** Parameters       start: start or stop broadcast.
**
** Returns          None
**
*******************************************************************************/
BTA_API extern void BTA_DmBleBroadcast (BOOLEAN start)
{
    tBTA_DM_API_BLE_OBSERVE   *p_msg;

    APPL_TRACE_API1("BTA_DmBleBroadcast: start = %d ", start);

    if ((p_msg = (tBTA_DM_API_BLE_OBSERVE *) GKI_getbuf(sizeof(tBTA_DM_API_BLE_OBSERVE))) != NULL)
    {
        memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_OBSERVE));

        p_msg->hdr.event = BTA_DM_API_BLE_BROADCAST_EVT;
        p_msg->start = start;

        bta_sys_sendmsg(p_msg);
    }
}

#endif
/*******************************************************************************
**
+4 −0
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ enum
    BTA_DM_API_BLE_OBSERVE_EVT,
    BTA_DM_API_BLE_ADV_PARAM_EVT,
    BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
    BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
    BTA_DM_API_BLE_BROADCAST_EVT,
#endif

#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
@@ -996,6 +998,8 @@ 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_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_scan_rsp (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);

#endif
extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data);
+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ const tBTA_DM_ACTION bta_dm_action[] =
    bta_dm_ble_observe,
    bta_dm_ble_set_adv_params,     /* BTA_DM_API_BLE_SCAN_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 */
#endif

#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
+98 −1
Original line number Diff line number Diff line
@@ -52,13 +52,16 @@ static void bta_gattc_cmpl_cback(UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS

static void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB *p_clreg);

static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, BD_ADDR bda);

static tGATT_CBACK bta_gattc_cl_cback =
{
    bta_gattc_conn_cback,
    bta_gattc_cmpl_cback,
    bta_gattc_disc_res_cback,
    bta_gattc_disc_cmpl_cback,
    NULL
    NULL,
    bta_gattc_enc_cmpl_cback
};

/* opcode(tGATTC_OPTYPE) order has to be comply with internal event order */
@@ -399,6 +402,34 @@ void bta_gattc_process_api_open_cancel (tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p

    }
}

/*******************************************************************************
**
** Function         bta_gattc_process_enc_cmpl
**
** Description      process encryption complete message.
**
** Returns          void
**
*******************************************************************************/
void bta_gattc_process_enc_cmpl(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{
    tBTA_GATTC_RCB *p_clreg;
    tBTA_GATTC cb_data;

    p_clreg = bta_gattc_cl_get_regcb(p_msg->enc_cmpl.client_if);

    if (p_clreg && p_clreg->p_cback)
    {
        memset(&cb_data, 0, sizeof(tBTA_GATTC));

        cb_data.enc_cmpl.client_if = p_msg->enc_cmpl.client_if;
        bdcpy(cb_data.enc_cmpl.remote_bda, p_msg->enc_cmpl.remote_bda);

        (*p_clreg->p_cback)(BTA_GATTC_ENC_CMPL_CB_EVT, &cb_data);
    }
}

/*******************************************************************************
**
** Function         bta_gattc_cancel_open_error
@@ -1633,6 +1664,50 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id,
            }
        }

/*******************************************************************************
**
** Function         bta_gattc_enc_cmpl_cback
**
** Description      encryption complete callback function to GATT client stack.
**
** Returns          void
**
*******************************************************************************/
static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, BD_ADDR bda)
{
    tBTA_GATTC_DATA *p_buf;
    tBTA_GATTC_CLCB *p_clcb = NULL;

    if ((p_clcb = bta_gattc_find_clcb_by_cif(gattc_if, bda)) == NULL)
    {
        return;
    }

#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
    /* filter this event just for BTA HH LE GATT client,
       In the future, if we want to enable encryption complete event
       for all GATT clients, we can remove this code */
    if (!bta_hh_le_is_hh_gatt_if(gattc_if))
    {
        return;
    }
#endif

    APPL_TRACE_DEBUG1("bta_gattc_enc_cmpl_cback: cif = %d", gattc_if);

    if ((p_buf = (tBTA_GATTC_DATA *) GKI_getbuf(sizeof(tBTA_GATTC_DATA))) != NULL)
    {
        memset(p_buf, 0, sizeof(tBTA_GATTC_DATA));

        p_buf->enc_cmpl.hdr.event            = BTA_GATTC_ENC_CMPL_EVT;
        p_buf->enc_cmpl.hdr.layer_specific   = p_clcb->bta_conn_id;
        p_buf->enc_cmpl.client_if            = gattc_if;
        bdcpy(p_buf->enc_cmpl.remote_bda, bda);

        bta_sys_sendmsg(p_buf);
    }
}

/*******************************************************************************
**
** Function         bta_gattc_process_api_refresh
@@ -2053,5 +2128,27 @@ void bta_gattc_listen(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg)
        }
    }
}

/*******************************************************************************
**
** Function         bta_gattc_broadcast
**
** Description      Start or stop broadcasting
**
** Returns          void
**
********************************************************************************/
void bta_gattc_broadcast(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg)
{
    tBTA_GATTC_RCB      *p_clreg = bta_gattc_cl_get_regcb(p_msg->api_listen.client_if);
    tBTA_GATTC          cb_data;
    (void)(p_cb);

    cb_data.reg_oper.client_if = p_msg->api_listen.client_if;
    cb_data.reg_oper.status = BTM_BleBroadcast(p_msg->api_listen.start);

    if (p_clreg && p_clreg->p_cback)
        (*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
}
#endif
#endif
Loading