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

Commit c2c1cae1 authored by Chris Manton's avatar Chris Manton
Browse files

Streamline btif/src/btif_hh::btif_hh_disconnect

And remove unused #defs

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I0842b2c97e08e1c29138f6c5cf9eecbd061a296b
parent 9d81cb92
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "btif/include/btif_storage.h"
#include "btif/include/btif_util.h"
#include "include/hardware/bt_hh.h"
#include "main/shim/dumpsys.h"
#include "osi/include/allocator.h"
#include "osi/include/log.h"
#include "stack/include/hidh_api.h"
@@ -622,14 +623,17 @@ bt_status_t btif_hh_connect(const RawAddress* bd_addr) {
 * Returns          void
 *
 ******************************************************************************/

void btif_hh_disconnect(RawAddress* bd_addr) {
  btif_hh_device_t* p_dev;
  p_dev = btif_hh_find_connected_dev_by_bda(*bd_addr);
  if (p_dev != NULL) {
  CHECK(bd_addr != nullptr);
  const btif_hh_device_t* p_dev = btif_hh_find_connected_dev_by_bda(*bd_addr);
  if (p_dev == nullptr) {
    LOG_DEBUG("Unable to disconnect unknown HID device:%s",
              PRIVATE_ADDRESS((*bd_addr)));
    return;
  }
  LOG_DEBUG("Disconnect and close request for HID device:%s",
            PRIVATE_ADDRESS((*bd_addr)));
  BTA_HhClose(p_dev->dev_handle);
  } else
    BTIF_TRACE_DEBUG("%s-- Error: device not connected:", __func__);
}

/*******************************************************************************