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

Commit 05fa852c authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Register for Service Changed notifications for untrusted devices

As required by Bluetooth Spec 4.2 [Vol 3, Part G] 2.5.2:
Clients without a trusted relationship shall receive an indication
when the service change occurs only during the current connection.

This means that even we're not paired, we should still register
and receive Service Changed.

Change-Id: Ifd6b69f4cdef6d7114a596221d2dd290a3b7044f
parent 17ac1b6a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -4580,6 +4580,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
            else
            else
            {
            {
                sec_event.auth_cmpl.success = TRUE;
                sec_event.auth_cmpl.success = TRUE;
                /* We also register for Service Changed right after connect. */
                if (!p_data->complt.smp_over_br)
                if (!p_data->complt.smp_over_br)
                    GATT_ConfigServiceChangeCCC(bda, TRUE, BT_TRANSPORT_LE);
                    GATT_ConfigServiceChangeCCC(bda, TRUE, BT_TRANSPORT_LE);
            }
            }
+13 −15
Original line number Original line Diff line number Diff line
@@ -235,25 +235,23 @@ static void gatt_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
{
{
    UNUSED(gatt_if);
    UNUSED(gatt_if);


    GATT_TRACE_EVENT ("%s: from %08x%04x connected:%d conn_id=%d reason = 0x%04x", __FUNCTION__,
    GATT_TRACE_EVENT("%s: from %08x%04x connected:%d conn_id=%d reason = 0x%04x", __func__,
                      (bda[0]<<24)+(bda[1]<<16)+(bda[2]<<8)+bda[3],
                      (bda[0]<<24)+(bda[1]<<16)+(bda[2]<<8)+bda[3],
                      (bda[4]<<8)+bda[5], connected, conn_id, reason);
                      (bda[4]<<8)+bda[5], connected, conn_id, reason);


    tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_bd_addr(bda, transport);
    tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_bd_addr(bda, transport);
    if (connected) {
        if (p_clcb == NULL)
            p_clcb = gatt_profile_clcb_alloc(conn_id, bda, transport);

        if (p_clcb == NULL)
        if (p_clcb == NULL)
            return;
            return;


    if (connected)
    {
        p_clcb->conn_id = conn_id;
        p_clcb->connected = TRUE;
        p_clcb->connected = TRUE;

        p_clcb->ccc_stage = GATT_SVC_CHANGED_SERVICE;
        if (p_clcb->ccc_stage == GATT_SVC_CHANGED_CONNECTING)
        {
            p_clcb->ccc_stage ++;
        gatt_cl_start_config_ccc(p_clcb);
        gatt_cl_start_config_ccc(p_clcb);
        }
    } else {
    } else {
        if (p_clcb != NULL)
            gatt_profile_clcb_dealloc(p_clcb);
            gatt_profile_clcb_dealloc(p_clcb);
    }
    }
}
}