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

Commit 98f41cae authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Get rid of last mentions of BD_ADDR from btif.

Test: compilation test
Change-Id: I22f6b01b1a69eca96b05319692a2eb82ecc186a8
parent febdaec2
Loading
Loading
Loading
Loading
+6 −16
Original line number Diff line number Diff line
@@ -73,12 +73,6 @@ struct hash<bt_bdaddr_t> {
  }
};

template <>
struct equal_to<bt_bdaddr_t> {
  size_t operator()(const bt_bdaddr_t& x, const bt_bdaddr_t& y) const {
    return memcmp(x.address, y.address, BD_ADDR_LEN);
  }
};
}

namespace {
@@ -86,16 +80,12 @@ namespace {
// all access to this variable should be done on the jni thread
std::unordered_set<bt_bdaddr_t> p_dev_cb;

void btif_gattc_add_remote_bdaddr(BD_ADDR p_bda, uint8_t addr_type) {
  bt_bdaddr_t bd_addr;
  memcpy(bd_addr.address, p_bda, BD_ADDR_LEN);
  p_dev_cb.insert(bd_addr);
void btif_gattc_add_remote_bdaddr(const bt_bdaddr_t& p_bda, uint8_t addr_type) {
  p_dev_cb.insert(p_bda);
}

bool btif_gattc_find_bdaddr(BD_ADDR p_bda) {
  bt_bdaddr_t bd_addr;
  memcpy(bd_addr.address, p_bda, BD_ADDR_LEN);
  return (p_dev_cb.count(bd_addr) != 0);
bool btif_gattc_find_bdaddr(const bt_bdaddr_t& p_bda) {
  return (p_dev_cb.count(p_bda) != 0);
}

void btif_gattc_init_dev_cb(void) { p_dev_cb.clear(); }
@@ -158,8 +148,8 @@ void bta_scan_results_cb_impl(bt_bdaddr_t bd_addr, tBT_DEVICE_TYPE device_type,
  }

  if ((addr_type != BLE_ADDR_RANDOM) || (p_eir_remote_name)) {
    if (!btif_gattc_find_bdaddr(bd_addr.address)) {
      btif_gattc_add_remote_bdaddr(bd_addr.address, addr_type);
    if (!btif_gattc_find_bdaddr(bd_addr)) {
      btif_gattc_add_remote_bdaddr(bd_addr, addr_type);

      if (p_eir_remote_name) {
        if (remote_name_len > BD_NAME_LEN + 1 ||
+1 −1
Original line number Diff line number Diff line
@@ -601,7 +601,7 @@ static bt_status_t btif_in_get_adapter_properties(void) {
  bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS];
  bt_status_t status;

  /* BD_ADDR */
  /* bt_bdaddr_t */
  BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDADDR,
                             sizeof(addr), &addr);
  status = btif_storage_get_adapter_property(&properties[num_props]);
+2 −2
Original line number Diff line number Diff line
@@ -1264,7 +1264,7 @@ static void btif_dm_search_devices_evt(uint16_t event, char* p_param) {
        int addr_type = 0;

        memset(properties, 0, sizeof(properties));
        /* BD_ADDR */
        /* bt_bdaddr_t */
        BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties],
                                   BT_PROPERTY_BDADDR, sizeof(bdaddr), &bdaddr);
        num_properties++;
@@ -3273,7 +3273,7 @@ void btif_debug_bond_event_dump(int fd) {
  dprintf(fd, "  Total Number of events: %zu\n", btif_num_bond_events);
  if (btif_num_bond_events > 0)
    dprintf(fd,
            "  Time          BD_ADDR            Function             State\n");
            "  Time          address            Function             State\n");

  for (size_t i = btif_events_start_index; i != btif_events_end_index;
       i = (i + 1) % (MAX_BTIF_BOND_EVENT_ENTRIES + 1)) {
+3 −5
Original line number Diff line number Diff line
@@ -212,10 +212,8 @@ uint16_t set_read_value(btgatt_read_params_t* p_dest, tBTA_GATTC_READ* p_src) {
 ******************************************************************************/

#if (BLE_DELAY_REQUEST_ENC == FALSE)
static bool btif_gatt_is_link_encrypted(BD_ADDR bd_addr) {
  if (bd_addr == NULL) return false;

  return BTA_JvIsEncrypted(bd_addr);
static bool btif_gatt_is_link_encrypted(const bt_bdaddr_t& bd_addr) {
  return BTA_JvIsEncrypted(to_BD_ADDR(bd_addr));
}

static void btif_gatt_set_encryption_cb(UNUSED_ATTR const bt_bdaddr_t& bd_addr,
@@ -235,7 +233,7 @@ void btif_gatt_check_encrypted_link(bt_bdaddr_t bd_addr,
  if ((btif_storage_get_ble_bonding_key(&bd_addr, BTIF_DM_LE_KEY_PENC, buf,
                                        sizeof(tBTM_LE_PENC_KEYS)) ==
       BT_STATUS_SUCCESS) &&
      !btif_gatt_is_link_encrypted(bd_addr.address)) {
      !btif_gatt_is_link_encrypted(bd_addr)) {
    BTIF_TRACE_DEBUG("%s: transport = %d", __func__, transport_link);
    BTA_DmSetEncryption(bd_addr, transport_link, &btif_gatt_set_encryption_cb,
                        BTM_BLE_SEC_ENCRYPT);
+1 −1
Original line number Diff line number Diff line
@@ -1101,7 +1101,7 @@ void btif_rc_handler(tBTA_AV_EVT event, tBTA_AV* p_data) {
 **
 ** Function       btif_rc_get_connected_peer
 **
 ** Description    Fetches the connected headset's BD_ADDR if any
 ** Description    Fetches the connected headset's address if any
 **
 ***************************************************************************/
bool btif_rc_get_connected_peer(bt_bdaddr_t* peer_addr) {
Loading