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

Commit 1cecd151 authored by Balraj Selvaraj's avatar Balraj Selvaraj Committed by Andre Eisenbach
Browse files

Increasing LE Properties to broadcast.

Use case: Remote BD_NAME is not broadcasted when BLE device
pairing is done by using NFC where we broadcasted only UUID.

steps:
Connect with BLE device by using NFC and check the remote name.

Failure: Remote device name is not available.

Root cause: BD_NAME is not broadcasted when BLE device pairing
is done.

Fix: Added property to broadcast remote BD_NAME also as part
BLE device pairing using NFC.

Change-Id: Ie6cda489aabff15a0ebbc692a16f9428729a7dba
parent ec5b7034
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ extern "C" {
********************************************************************************/

#define ASSERTC(cond, msg, val) if (!(cond)) { LOG_ERROR(LOG_TAG, \
    "### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
    "### ASSERT : %s %s line %d %s (%d) ###", __FILE__, __func__, __LINE__, msg, val);}

/* Calculate start of event enumeration; id is top 8 bits of event */
#define BTIF_SIG_START(id)       ((id) << 8)
+20 −6
Original line number Diff line number Diff line
@@ -1563,10 +1563,11 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param)
             bt_uuid_t  uuid;
             int i = 0;
             int j = 15;
             int num_properties = 0;
             if (p_data->disc_ble_res.service.uu.uuid16 == UUID_SERVCLASS_LE_HID)
             {
                BTIF_TRACE_DEBUG("%s: Found HOGP UUID",__FUNCTION__);
                bt_property_t prop;
                bt_property_t prop[2];
                bt_bdaddr_t bd_addr;
                char temp[256];
                bt_status_t ret;
@@ -1586,17 +1587,30 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param)
                LOG_INFO(LOG_TAG, "%s uuid:%s", __func__, temp);

                bdcpy(bd_addr.address, p_data->disc_ble_res.bd_addr);
                prop.type = BT_PROPERTY_UUIDS;
                prop.val = uuid.uu;
                prop.len = MAX_UUID_SIZE;
                prop[0].type = BT_PROPERTY_UUIDS;
                prop[0].val = uuid.uu;
                prop[0].len = MAX_UUID_SIZE;

                /* Also write this to the NVRAM */
                ret = btif_storage_set_remote_device_property(&bd_addr, &prop);
                ret = btif_storage_set_remote_device_property(&bd_addr, &prop[0]);
                ASSERTC(ret == BT_STATUS_SUCCESS, "storing remote services failed", ret);
                num_properties++;

                /* Remote name update */
                if (strnlen((const char *) p_data->disc_ble_res.bd_name, BD_NAME_LEN))
                {
                    prop[1].type = BT_PROPERTY_BDNAME;
                    prop[1].val = p_data->disc_ble_res.bd_name;
                    prop[1].len = strnlen((char *)p_data->disc_ble_res.bd_name, BD_NAME_LEN);

                    ret = btif_storage_set_remote_device_property(&bd_addr, &prop[1]);
                    ASSERTC(ret == BT_STATUS_SUCCESS, "failed to save remote device property", ret);
                    num_properties++;
                }

                /* Send the event to the BTIF */
                HAL_CBACK(bt_hal_cbacks, remote_device_properties_cb,
                                 BT_STATUS_SUCCESS, &bd_addr, 1, &prop);
                                 BT_STATUS_SUCCESS, &bd_addr, num_properties, prop);

            }
        }