Skip to content
Snippets Groups Projects
Commit 756811e5 authored by Chris Manton's avatar Chris Manton
Browse files

legacy: Const-ify hci packet transfer interface

Bug: 187830698
Tag: #refactor
Test: gd/cert/run

Change-Id: Ibed86eda3902de932e4d4a2e68d88b964a07fdc7
parent add59888
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment