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

Commit 65b9cdfa authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Make gatt_attr use opportunistic connection

This patch creates new connection mode - opportunistic connection. When
such connection is made, no call to gatt_update_app_hold_link_status
will be made when it's started.

This means that connecting and disconnecting in this mode won't trigger
disconnect timer. When other, app creates regular connection and then
disconnects, the physical connection might get disconnected.

Opportunistic connection is used only for code setting CCC right now.

Bug: 30186455
Change-Id: Ia5be7682b6c3dcb4993060f818dee603aef3e19e
parent 8b0377ff
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -518,7 +518,7 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)

    /* open/hold a connection */
    if (!GATT_Connect(p_clcb->p_rcb->client_if, p_data->api_conn.remote_bda,
                      TRUE, p_data->api_conn.transport))
                      true, p_data->api_conn.transport, false))
    {
        APPL_TRACE_ERROR("Connection open failure");

@@ -558,7 +558,7 @@ void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg
    if (bta_gattc_mark_bg_conn(p_data->client_if, p_data->remote_bda, TRUE, FALSE))
    {
        /* always call open to hold a connection */
        if (!GATT_Connect(p_data->client_if, p_data->remote_bda, FALSE, p_data->transport))
        if (!GATT_Connect(p_data->client_if, p_data->remote_bda, false, p_data->transport, false))
        {
            uint8_t *bda = (uint8_t *)p_data->remote_bda;
            status = BTA_GATT_ERROR;
+1 −1
Original line number Diff line number Diff line
@@ -689,7 +689,7 @@ void bta_gatts_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg)
    {
        /* should always get the connection ID */
        if (GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda,
                        p_msg->api_open.is_direct, p_msg->api_open.transport))
                        p_msg->api_open.is_direct, p_msg->api_open.transport, false))
        {
            status = BTA_GATT_OK;

+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ bt_status_t btif_gattc_test_command_impl(uint16_t command, btgatt_test_params_t*
            if (params->u1 == BT_DEVICE_TYPE_BLE)
                BTM_SecAddBleDevice(params->bda1->address, NULL, BT_DEVICE_TYPE_BLE, params->u2);

            if ( !GATT_Connect(test_cb.gatt_if, params->bda1->address, TRUE, BT_TRANSPORT_LE) )
            if ( !GATT_Connect(test_cb.gatt_if, params->bda1->address, true, BT_TRANSPORT_LE, false) )
            {
                LOG_ERROR(LOG_TAG, "%s: GATT_Connect failed!", __FUNCTION__);
            }
+1 −1
Original line number Diff line number Diff line
@@ -708,7 +708,7 @@ BOOLEAN gap_ble_accept_cl_operation(BD_ADDR peer_bda, UINT16 uuid, tGAP_BLE_CMPL
        p_clcb->connected = TRUE;

    /* hold the link here */
    if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, TRUE, BT_TRANSPORT_LE))
    if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, TRUE, BT_TRANSPORT_LE, false))
        return started;

    /* enqueue the request */
+3 −2
Original line number Diff line number Diff line
@@ -1357,7 +1357,8 @@ void GATT_StartIf (tGATT_IF gatt_if)
** Returns          TRUE if connection started; FALSE if connection start failure.
**
*******************************************************************************/
BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct, tBT_TRANSPORT transport)
BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct,
                      tBT_TRANSPORT transport, BOOLEAN opportunistic)
{
    tGATT_REG    *p_reg;
    BOOLEAN status = FALSE;
@@ -1372,7 +1373,7 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct, tBT_
    }

    if (is_direct)
        status = gatt_act_connect (p_reg, bd_addr, transport);
        status = gatt_act_connect (p_reg, bd_addr, transport, opportunistic);
    else
    {
        if (transport == BT_TRANSPORT_LE)
Loading