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

Commit bd9f7462 authored by Martin Brabham's avatar Martin Brabham
Browse files

Floss: LeRand BTA + BTM Shim API

Shuffle the api call and the callback data through.

Bug: 219982690
Bug: 219983139
Test: mma -j $(nproc)
Test: ./build.py
Tag: #floss
Change-Id: I9b26e6463fb9ebf4bbe38778708db1294e022050
parent e8e1d164
Loading
Loading
Loading
Loading
+16 −2
Original line number Original line Diff line number Diff line
@@ -4007,9 +4007,9 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN* p_data) {


/*******************************************************************************
/*******************************************************************************
 *
 *
 * Function         bta_dm_proc_open_evt
 * Function         bta_dm_clear_event_filter
 *
 *
 * Description      process BTA_GATTC_OPEN_EVT in DM.
 * Description      clears out the event filter.
 *
 *
 * Parameters:
 * Parameters:
 *
 *
@@ -4055,6 +4055,20 @@ void bta_dm_disconnect_all_acls(void) {
  bluetooth::shim::BTM_DisconnectAllAcls();
  bluetooth::shim::BTM_DisconnectAllAcls();
}
}


/*******************************************************************************
 *
 * Function         bta_dm_le_rand
 *
 * Description      Generates a random number from the controller.
 *
 * Parameters:      |cb| Callback to receive the random number.
 *
 ******************************************************************************/
void bta_dm_le_rand(LeRandCallback cb) {
  VLOG(1) << "bta_dm_le_rand in bta_dm_act";
  bluetooth::shim::BTM_LeRand(cb);
}

/*******************************************************************************
/*******************************************************************************
 *
 *
 * Function         bta_dm_gattc_callback
 * Function         bta_dm_gattc_callback
+14 −0
Original line number Original line Diff line number Diff line
@@ -684,3 +684,17 @@ void BTA_DmClearEventFilter(void) {
  APPL_TRACE_API("BTA_DmClearEventFilter");
  APPL_TRACE_API("BTA_DmClearEventFilter");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_event_filter));
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_event_filter));
}
}

/*******************************************************************************
 *
 * Function         BTA_DmLeRand
 *
 * Description      This function clears the event filter
 *
 * Returns          cb: callback to receive the resulting random number
 *
 ******************************************************************************/
void BTA_DmLeRand(LeRandCallback cb) {
  APPL_TRACE_API("BTA_DmLeRand");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_le_rand, cb));
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -548,6 +548,7 @@ extern void bta_dm_clear_event_filter(void);
extern void bta_dm_clear_event_mask(void);
extern void bta_dm_clear_event_mask(void);
extern void bta_dm_clear_filter_accept_list(void);
extern void bta_dm_clear_filter_accept_list(void);
extern void bta_dm_disconnect_all_acls(void);
extern void bta_dm_disconnect_all_acls(void);
extern void bta_dm_le_rand(LeRandCallback cb);


uint8_t bta_dm_search_get_state();
uint8_t bta_dm_search_get_state();
void bta_dm_search_set_state(uint8_t state);
void bta_dm_search_set_state(uint8_t state);
+13 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@
#include <cstdint>
#include <cstdint>
#include <vector>
#include <vector>


#include "base/callback.h"
#include "bt_target.h"  // Must be first to define build configuration
#include "bt_target.h"  // Must be first to define build configuration
#include "osi/include/log.h"
#include "osi/include/log.h"
#include "stack/include/bt_octets.h"
#include "stack/include/bt_octets.h"
@@ -1205,4 +1206,16 @@ extern void BTA_VendorInit(void);
 ******************************************************************************/
 ******************************************************************************/
extern void BTA_DmClearEventFilter(void);
extern void BTA_DmClearEventFilter(void);


using LeRandCallback = base::Callback<void(uint64_t)>;
/*******************************************************************************
 *
 * Function         BTA_DmLeRand
 *
 * Description      This function clears the event filter
 *
 * Returns          cb: callback to receive the resulting random number
 *
 ******************************************************************************/
extern void BTA_DmLeRand(LeRandCallback cb);

#endif /* BTA_API_H */
#endif /* BTA_API_H */
+5 −0
Original line number Original line Diff line number Diff line
@@ -1353,3 +1353,8 @@ tBTM_STATUS bluetooth::shim::BTM_DisconnectAllAcls() {
  }
  }
  return BTM_SUCCESS;
  return BTM_SUCCESS;
}
}

tBTM_STATUS bluetooth::shim::BTM_LeRand(LeRandCallback cb) {
  controller_get_interface()->le_rand(cb);
  return BTM_SUCCESS;
}
Loading