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

Commit ca105918 authored by Myles Watson's avatar Myles Watson
Browse files

Revert "GD HCI: Pipe VSEs up in shim layer"

This reverts commit fb838d54.

We prefer to keep the shim small and implement VSE
handling in btif, since it's mostly for logging.

Bug: 183057550
Test: Enable BQR events
Tag: #gd-refactor
Change-Id: I8f57c479eb57439f2ede486b645edc9b3975c25a
parent a39e2c61
Loading
Loading
Loading
Loading
+0 −43
Original line number Diff line number Diff line
@@ -161,19 +161,6 @@ bool is_valid_subevent_code(uint8_t subevent_code_raw) {
  }
}

bool is_valid_vendor_specific_event(uint8_t vse_code_raw) {
  auto vse_code = static_cast<bluetooth::hci::VseSubeventCode>(vse_code_raw);
  switch (vse_code) {
    case bluetooth::hci::VseSubeventCode::BQR_EVENT:
    case bluetooth::hci::VseSubeventCode::BLE_THRESHOLD:
    case bluetooth::hci::VseSubeventCode::BLE_TRACKING:
    case bluetooth::hci::VseSubeventCode::DEBUG_INFO:
      return true;
    default:
      return false;
  }
}

static bool event_already_registered_in_hci_layer(
    bluetooth::hci::EventCode event_code) {
  switch (event_code) {
@@ -354,16 +341,6 @@ static void subevent_callback(
                                                     &le_meta_event_view));
}

static void vendor_specific_event_callback(
    bluetooth::hci::VendorSpecificEventView vendor_specific_event_view) {
  if (!send_data_upwards) {
    return;
  }
  send_data_upwards.Run(
      FROM_HERE,
      WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_EVT, &vendor_specific_event_view));
}

void OnTransmitPacketCommandComplete(command_complete_cb complete_callback,
                                     void* context,
                                     bluetooth::hci::CommandCompleteView view) {
@@ -453,13 +430,6 @@ static void register_le_event(bluetooth::hci::SubeventCode subevent_code) {
      subevent_code, handler->Bind(subevent_callback));
}

static void register_vendor_specific_event(
    bluetooth::hci::VseSubeventCode vse_code) {
  auto handler = bluetooth::shim::GetGdShimHandler();
  bluetooth::shim::GetHciLayer()->RegisterVendorSpecificEventHandler(
      vse_code, handler->Bind(vendor_specific_event_callback));
}

static void acl_data_callback() {
  if (hci_queue_end == nullptr) {
    return;
@@ -789,19 +759,6 @@ void bluetooth::shim::hci_on_reset_complete() {
    }
  }

  for (uint8_t vse_code_raw = 0; vse_code_raw < 0xFF; vse_code_raw++) {
    if (!is_valid_vendor_specific_event(vse_code_raw)) {
      continue;
    }
    auto vse_code = static_cast<bluetooth::hci::VseSubeventCode>(vse_code_raw);
    if (bluetooth::common::init_flags::gd_rust_is_enabled()) {
      // TODO(b/183057550): Need Rust HCI implementation for VSE
      // ::rust::register_vendor_specific_event(vse_code_raw);
    } else {
      cpp::register_vendor_specific_event(vse_code);
    }
  }

  if (bluetooth::shim::is_gd_acl_enabled()) {
    return;
  }