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

Commit 69ae0c2c authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "legacy: Const-ify hci packet transfer interface" am: 534ca4b9

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1869991

Change-Id: Icfd7f33cdc200cacc06d49a243a72af521ad8e99
parents 0d3ad33c 534ca4b9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -62,11 +62,11 @@ typedef struct hci_t {
      base::Callback<void(const base::Location&, BT_HDR*)> send_data_cb);

  // Send a command through the HCI layer
  void (*transmit_command)(BT_HDR* command,
  void (*transmit_command)(const BT_HDR* command,
                           command_complete_cb complete_callback,
                           command_status_cb status_cb, void* context);

  future_t* (*transmit_command_futured)(BT_HDR* command);
  future_t* (*transmit_command_futured)(const BT_HDR* command);

  // Send some data downward through the HCI layer
  void (*transmit_downward)(uint16_t type, void* data);
+7 −7
Original line number Diff line number Diff line
@@ -361,11 +361,11 @@ void OnTransmitPacketStatus(command_status_cb status_callback, void* context,
  status_callback(status, static_cast<BT_HDR*>(command->Release()), context);
}

static void transmit_command(BT_HDR* command,
static void transmit_command(const BT_HDR* command,
                             command_complete_cb complete_callback,
                             command_status_cb status_callback, void* context) {
  CHECK(command != nullptr);
  uint8_t* data = command->data + command->offset;
  const uint8_t* data = command->data + command->offset;
  size_t len = command->len;
  CHECK(len >= (kCommandOpcodeSize + kCommandLengthSize));

@@ -395,7 +395,7 @@ static void transmit_command(BT_HDR* command,
        std::move(packet),
        bluetooth::shim::GetGdShimHandler()->BindOnce(
            OnTransmitPacketCommandComplete, complete_callback, context));
    osi_free(command);
    osi_free(const_cast<void*>(static_cast<const void*>(command)));
  }
}

@@ -677,7 +677,7 @@ void OnRustTransmitPacketStatus(command_status_cb status_callback,
  status_callback(status, static_cast<BT_HDR*>(command->Release()), context);
}

static void transmit_command(BT_HDR* command,
static void transmit_command(const BT_HDR* command,
                             command_complete_cb complete_callback,
                             command_status_cb status_callback, void* context) {
  CHECK(command != nullptr);
@@ -705,7 +705,7 @@ static void transmit_command(BT_HDR* command,
        ::rust::Slice(data, len),
        std::make_unique<u8SliceOnceCallback>(BindOnce(
            OnRustTransmitPacketCommandComplete, complete_callback, context)));
    osi_free(command);
    osi_free(const_cast<void*>(static_cast<const void*>(command)));
  }
}

@@ -775,7 +775,7 @@ static void set_data_cb(
  send_data_upwards = std::move(send_data_cb);
}

static void transmit_command(BT_HDR* command,
static void transmit_command(const BT_HDR* command,
                             command_complete_cb complete_callback,
                             command_status_cb status_callback, void* context) {
  if (bluetooth::common::init_flags::gd_rust_is_enabled()) {
@@ -797,7 +797,7 @@ static void command_status_callback(uint8_t status, BT_HDR* command,
      "transmit_command_futured should only send command complete opcode");
}

static future_t* transmit_command_futured(BT_HDR* command) {
static future_t* transmit_command_futured(const BT_HDR* command) {
  future_t* future = future_new();
  transmit_command(command, command_complete_callback, command_status_callback,
                   future);