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

Commit f73e507b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I1a29874e,Ibb00c51c into main

* changes:
  make btm_process_cancel_complete static
  Use PDL for InquiryCancel
parents de27ac66 cb30980b
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include "common/time_util.h"
#include "device/include/controller.h"
#include "hci/controller_interface.h"
#include "hci/event_checkers.h"
#include "hci/hci_layer.h"
#include "include/check.h"
#include "internal_include/bt_target.h"
@@ -251,6 +252,7 @@ void SendRemoteNameRequest(const RawAddress& raw_address) {
  btsnd_hcic_rmt_name_req(raw_address, HCI_PAGE_SCAN_REP_MODE_R1,
                          HCI_MANDATARY_PAGE_SCAN_MODE, 0);
}
static void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode);
/*******************************************************************************
 *
 * Function         BTM_SetDiscoverability
@@ -554,7 +556,14 @@ void BTM_CancelInquiry(void) {
    btm_cb.btm_inq_vars.p_inq_cmpl_cb = NULL; /* Do not notify caller anymore */

    if ((btm_cb.btm_inq_vars.inqparms.mode & BTM_BR_INQUIRY_MASK) != 0) {
      bluetooth::legacy::hci::GetInterface().InquiryCancel();
      bluetooth::shim::GetHciLayer()->EnqueueCommand(
          bluetooth::hci::InquiryCancelBuilder::Create(),
          get_main_thread()->BindOnce(
              [](bluetooth::hci::CommandCompleteView complete_view) {
                bluetooth::hci::check_complete<
                    bluetooth::hci::InquiryCancelCompleteView>(complete_view);
                btm_process_cancel_complete(HCI_SUCCESS, BTM_BR_INQUIRY_MASK);
              }));
    }

    if (!bluetooth::shim::is_classic_discovery_only_enabled()) {
@@ -1040,7 +1049,14 @@ void btm_inq_stop_on_ssp(void) {
      if (btm_cb.btm_inq_vars.inq_active & normal_active) {
        /* can not call BTM_CancelInquiry() here. We need to report inquiry
         * complete evt */
        bluetooth::legacy::hci::GetInterface().InquiryCancel();
        bluetooth::shim::GetHciLayer()->EnqueueCommand(
            bluetooth::hci::InquiryCancelBuilder::Create(),
            get_main_thread()->BindOnce(
                [](bluetooth::hci::CommandCompleteView complete_view) {
                  bluetooth::hci::check_complete<
                      bluetooth::hci::InquiryCancelCompleteView>(complete_view);
                  btm_process_cancel_complete(HCI_SUCCESS, BTM_BR_INQUIRY_MASK);
                }));
      }
    }
    /* do not allow inquiry to start */
@@ -1593,7 +1609,7 @@ void btm_process_inq_complete(tHCI_STATUS status, uint8_t mode) {
 * Returns          void
 *
 ******************************************************************************/
void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode) {
static void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode) {
  BTIF_dm_report_inquiry_status_change(
      tBTM_INQUIRY_STATE::BTM_INQUIRY_CANCELLED);
  btm_process_inq_complete(status, mode);
+0 −4
Original line number Diff line number Diff line
@@ -970,10 +970,6 @@ static void btu_hcif_esco_connection_chg_evt(uint8_t* p) {
static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p,
                                          uint16_t evt_len) {
  switch (opcode) {
    case HCI_INQUIRY_CANCEL:
      /* Tell inquiry processing that we are done */
      btm_process_cancel_complete(HCI_SUCCESS, BTM_BR_INQUIRY_MASK);
      break;
    case HCI_SET_EVENT_FILTER:
      break;

+0 −17
Original line number Diff line number Diff line
@@ -48,10 +48,6 @@
#define HCIC_INQ_INQ_LAP_OFF 0
#define HCIC_INQ_DUR_OFF 3
#define HCIC_INQ_RSP_CNT_OFF 4
/* Inquiry */

/* Inquiry Cancel */
#define HCIC_PARAM_SIZE_INQ_CANCEL 0

/* Periodic Inquiry Mode */
#define HCIC_PARAM_SIZE_PER_INQ_MODE 9
@@ -482,18 +478,6 @@
#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY 14
#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY 3

static void btsnd_hcic_inq_cancel(void) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);

  p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQ_CANCEL;
  p->offset = 0;
  UINT16_TO_STREAM(pp, HCI_INQUIRY_CANCEL);
  UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_INQ_CANCEL);

  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

static void btsnd_hcic_disconnect(uint16_t handle, uint8_t reason) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);
@@ -1672,7 +1656,6 @@ void btsnd_hcic_configure_data_path(hci_data_direction_t data_path_direction,

namespace bluetooth::legacy::hci {
class InterfaceImpl : public Interface {
  void InquiryCancel() const override { btsnd_hcic_inq_cancel(); }
  void Disconnect(uint16_t handle, uint8_t reason) const override {
    btsnd_hcic_disconnect(handle, reason);
  }
+0 −2
Original line number Diff line number Diff line
@@ -302,8 +302,6 @@ bool acl_peer_supports_ble_connection_subrating(const RawAddress& remote_bda);
bool acl_peer_supports_ble_connection_subrating_host(
    const RawAddress& remote_bda);

void btm_process_cancel_complete(uint8_t status, uint8_t mode);

uint8_t btm_handle_to_acl_index(uint16_t hci_handle);

tHCI_REASON btm_get_acl_disc_reason_code(void);
+0 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ enum hci_data_direction_t {
namespace bluetooth::legacy::hci {
class Interface {
 public:
  virtual void InquiryCancel() const = 0;
  virtual void Disconnect(uint16_t handle, uint8_t reason) const = 0;
  virtual void ChangeConnectionPacketType(uint16_t handle,
                                          uint16_t packet_types) const = 0;
Loading