diff --git a/pw_bluetooth_sapphire/host/gap/adapter.cc b/pw_bluetooth_sapphire/host/gap/adapter.cc index 8b6ffa24c3..4b9b2f0f01 100644 --- a/pw_bluetooth_sapphire/host/gap/adapter.cc +++ b/pw_bluetooth_sapphire/host/gap/adapter.cc @@ -1123,18 +1123,19 @@ void AdapterImpl::InitializeStep2() { hci::EmbossCommandPacket::New< pw::bluetooth::emboss::LEReadSupportedStatesCommandView>( hci_spec::kLEReadSupportedStates), - [this](const hci::EventPacket& cmd_complete) { + [this](const hci::EmbossEventPacket& cmd_complete) { if (hci_is_error(cmd_complete, WARN, "gap", "LE read local supported states failed")) { return; } - auto params = + auto packet = cmd_complete - .return_params(); - state_.low_energy_state.supported_states_ = pw::bytes::ConvertOrderFrom( - cpp20::endian::little, params->le_states); + .view(); + state_.low_energy_state.supported_states_ = + packet.le_states().BackingStorage().ReadLittleEndianUInt<64>(); }); if (state_.SupportedCommands() diff --git a/pw_bluetooth_sapphire/host/testing/fake_controller.cc b/pw_bluetooth_sapphire/host/testing/fake_controller.cc index 67026a83b6..2def21badc 100644 --- a/pw_bluetooth_sapphire/host/testing/fake_controller.cc +++ b/pw_bluetooth_sapphire/host/testing/fake_controller.cc @@ -1662,12 +1662,14 @@ void FakeController::OnLEReadBufferSizeV2() { } void FakeController::OnLEReadSupportedStates() { - hci_spec::LEReadSupportedStatesReturnParams params; - params.status = pwemb::StatusCode::SUCCESS; - params.le_states = pw::bytes::ConvertOrderTo(cpp20::endian::little, - settings_.le_supported_states); - RespondWithCommandComplete(hci_spec::kLEReadSupportedStates, - BufferView(¶ms, sizeof(params))); + auto packet = hci::EmbossEventPacket::New< + pwemb::LEReadSupportedStatesCommandCompleteEventWriter>( + hci_spec::kCommandCompleteEventCode); + auto view = packet.view_t(); + view.status().Write(pwemb::StatusCode::SUCCESS); + view.le_states().BackingStorage().WriteLittleEndianUInt<64>( + settings_.le_supported_states); + RespondWithCommandComplete(pwemb::OpCode::LE_READ_SUPPORTED_STATES, &packet); } void FakeController::OnLEReadLocalSupportedFeatures() { 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 0c8664dbf7..4bbf725389 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 @@ -947,15 +947,6 @@ constexpr OpCode kLELongTermKeyRequestNegativeReply = // LE Read Supported States Command (v4.0) (LE) constexpr OpCode kLEReadSupportedStates = LEControllerCommandOpCode(0x001C); -struct LEReadSupportedStatesReturnParams { - // See enum StatusCode in hci_constants.h. - StatusCode status; - - // Bit-mask of supported state or state combinations. See Core Spec v4.2, - // Volume 2, Part E, Section 7.8.27 "LE Read Supported States Command". - uint64_t le_states; -} __attribute__((packed)); - // ==================================== // LE Receiver Test Command (v4.0) (LE) constexpr OpCode kLEReceiverTest = LEControllerCommandOpCode(0x001D);