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

Commit 0a9344e1 authored by Chris Manton's avatar Chris Manton
Browse files

Return bool=>void stack/btm/btm_ble::BTM_SecAddBleDevice

Unnecessary level of error checking

Toward readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ia6a8ddcc4f6cc2ee2d7094a61e4818ba94989954
parent 7fc1de04
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -3409,9 +3409,7 @@ void bta_dm_add_blekey(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
 ******************************************************************************/
void bta_dm_add_ble_device(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                           tBT_DEVICE_TYPE dev_type) {
  if (!BTM_SecAddBleDevice(bd_addr, dev_type, addr_type)) {
    LOG(ERROR) << "BTA_DM: Error adding BLE Device for device " << bd_addr;
  }
  BTM_SecAddBleDevice(bd_addr, dev_type, addr_type);
}

/*******************************************************************************
+1 −2
Original line number Diff line number Diff line
@@ -908,11 +908,10 @@ uint8_t bluetooth::shim::BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len,
  return 0;
}

bool bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
void bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
                                          tBT_DEVICE_TYPE dev_type,
                                          tBLE_ADDR_TYPE addr_type) {
  LOG_INFO("UNIMPLEMENTED %s", __func__);
  return false;
}

bool bluetooth::shim::BTM_SecAddBleKey(const RawAddress& bd_addr,
+1 −3
Original line number Diff line number Diff line
@@ -397,10 +397,8 @@ uint8_t BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len, uint8_t uuid_size,
 *                  dev_type         - Remote device's device type.
 *                  addr_type        - LE device address type.
 *
 * Returns          true if added OK, else false
 *
 ******************************************************************************/
bool BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
                         tBLE_ADDR_TYPE addr_type);

/*******************************************************************************
+1 −3
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ extern void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle,
/******************************************************************************/
/* External Function to be called by other modules                            */
/******************************************************************************/
bool BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
                         tBLE_ADDR_TYPE addr_type) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::BTM_SecAddBleDevice(bd_addr, dev_type, addr_type);
@@ -94,8 +94,6 @@ bool BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
    BTM_TRACE_DEBUG("InqDb  device_type =0x%x  addr_type=0x%x",
                    p_info->results.device_type, p_info->results.ble_addr_type);
  }

  return true;
}

/*******************************************************************************
+1 −3
Original line number Diff line number Diff line
@@ -50,10 +50,8 @@
 *                  dev_type         - Remote device's device type.
 *                  addr_type        - LE device address type.
 *
 * Returns          true if added OK, else false
 *
 ******************************************************************************/
extern bool BTM_SecAddBleDevice(const RawAddress& bd_addr,
extern void BTM_SecAddBleDevice(const RawAddress& bd_addr,
                                tBT_DEVICE_TYPE dev_type,
                                tBLE_ADDR_TYPE addr_type);