diff --git a/pw_bluetooth_sapphire/host/gap/adapter.cc b/pw_bluetooth_sapphire/host/gap/adapter.cc index 79355bc742..82127187a8 100644 --- a/pw_bluetooth_sapphire/host/gap/adapter.cc +++ b/pw_bluetooth_sapphire/host/gap/adapter.cc @@ -988,13 +988,13 @@ void AdapterImpl::InitializeStep1() { init_seq_runner_->QueueCommand( hci::EmbossCommandPacket::New< pw::bluetooth::emboss::ReadBdAddrCommandView>(hci_spec::kReadBDADDR), - [this](const hci::EventPacket& cmd_complete) { + [this](const hci::EmbossEventPacket& cmd_complete) { if (hci_is_error(cmd_complete, WARN, "gap", "read BR_ADDR failed")) { return; } - auto params = - cmd_complete.return_params(); - state_.controller_address = params->bd_addr; + auto packet = cmd_complete.view< + pw::bluetooth::emboss::ReadBdAddrCommandCompleteEventView>(); + state_.controller_address = DeviceAddressBytes(packet.bd_addr()); }); if (state().IsControllerFeatureSupported( diff --git a/pw_bluetooth_sapphire/host/testing/fake_controller.cc b/pw_bluetooth_sapphire/host/testing/fake_controller.cc index 88c4ec6a73..45d7a6db4c 100644 --- a/pw_bluetooth_sapphire/host/testing/fake_controller.cc +++ b/pw_bluetooth_sapphire/host/testing/fake_controller.cc @@ -1949,11 +1949,13 @@ void FakeController::OnReadBufferSize() { } void FakeController::OnReadBRADDR() { - hci_spec::ReadBDADDRReturnParams params; - params.status = pwemb::StatusCode::SUCCESS; - params.bd_addr = settings_.bd_addr.value(); - RespondWithCommandComplete(hci_spec::kReadBDADDR, - BufferView(¶ms, sizeof(params))); + auto packet = + hci::EmbossEventPacket::New( + hci_spec::kCommandCompleteEventCode); + auto view = packet.view_t(); + view.status().Write(pwemb::StatusCode::SUCCESS); + view.bd_addr().CopyFrom(settings_.bd_addr.value().view()); + RespondWithCommandComplete(hci_spec::kReadBDADDR, &packet); } void FakeController::OnLESetAdvertisingEnable( diff --git a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h index eb151a8395..6eda3f2a48 100644 --- a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h +++ b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h @@ -698,13 +698,6 @@ constexpr OpCode kReadBufferSize = InformationalParamsOpCode(0x0005); // Read BD_ADDR Command (v1.1) (BR/EDR, LE) constexpr OpCode kReadBDADDR = InformationalParamsOpCode(0x0009); -struct ReadBDADDRReturnParams { - // See enum StatusCode in hci_constants.h. - StatusCode status; - - DeviceAddressBytes bd_addr; -} __attribute__((packed)); - // ======================================================= // Read Data Block Size Command (v3.0 + HS) (BR/EDR & AMP) constexpr OpCode kReadDataBlockSize = InformationalParamsOpCode(0x000A);