OSDN Git Service

Add bta/hh/bta_hh_utils::bta_hh_get_cb
authorChris Manton <cmanton@google.com>
Thu, 6 May 2021 01:36:44 +0000 (18:36 -0700)
committerChris Manton <cmanton@google.com>
Sat, 8 May 2021 23:39:51 +0000 (23:39 +0000)
I don't care about your indicies

Bug: 182370398
Test: gd/cert/run
Tag: #refactor
Change-Id: Ib41e4e5d4caca8f2b628d46064290c391fb48fc5

bta/hh/bta_hh_int.h
bta/hh/bta_hh_utils.cc

index 87e2908..d9e5062 100644 (file)
@@ -310,6 +310,7 @@ extern void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb,
 
 /* utility functions */
 extern uint8_t bta_hh_find_cb(const RawAddress& bda);
+extern tBTA_HH_DEV_CB* bta_hh_get_cb(const RawAddress& bda);
 extern void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT* p_kb_data,
                                    uint8_t* p_report, uint16_t report_len);
 extern void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT* p_kb_data,
index b48a806..689f2e7 100644 (file)
@@ -99,6 +99,14 @@ uint8_t bta_hh_find_cb(const RawAddress& bda) {
   return xx;
 }
 
+tBTA_HH_DEV_CB* bta_hh_get_cb(const RawAddress& bda) {
+  uint8_t idx = bta_hh_find_cb(bda);
+  if (idx == BTA_HH_IDX_INVALID) {
+    return nullptr;
+  }
+  return &bta_hh_cb.kdev[idx];
+}
+
 /*******************************************************************************
  *
  * Function         bta_hh_clean_up_kdev