From 2a2c2ad3be8241cc8145e8474fb9dad0df9be91a Mon Sep 17 00:00:00 2001 From: Josh Conner Date: Sat, 31 Aug 2024 04:43:25 +0000 Subject: [PATCH] pw_bluetooth_sapphire: Embossify ReadPageScanTypeReturnParams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use emboss definitions instead of a packed struct for generating a Read Page Scan Type command complete event. Bug: b/42167863 Test: fx test //src/connectivity/bluetooth/core/bt-host Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1108772 GitOrigin-RevId: ef34b0db722292fbf901c68c2631107623d8749e Change-Id: Id1181553ae215952f8f0ab0cd4527586360098e8 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/232774 Lint: Lint 🤖 Pigweed-Auto-Submit: Jason Graffius Commit-Queue: Auto-Submit Reviewed-by: Ben Lawson --- .../host/testing/fake_controller.cc | 12 +++++++----- .../internal/host/hci-spec/protocol.h | 8 -------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pw_bluetooth_sapphire/host/testing/fake_controller.cc b/pw_bluetooth_sapphire/host/testing/fake_controller.cc index 89379593b8..d2001af50d 100644 --- a/pw_bluetooth_sapphire/host/testing/fake_controller.cc +++ b/pw_bluetooth_sapphire/host/testing/fake_controller.cc @@ -1786,11 +1786,13 @@ void FakeController::OnWritePageScanType( } void FakeController::OnReadPageScanType() { - hci_spec::ReadPageScanTypeReturnParams params; - params.status = pwemb::StatusCode::SUCCESS; - params.page_scan_type = page_scan_type_; - RespondWithCommandComplete(hci_spec::kReadPageScanType, - BufferView(¶ms, sizeof(params))); + auto event_packet = hci::EmbossEventPacket::New< + pwemb::ReadPageScanTypeCommandCompleteEventWriter>( + hci_spec::kCommandCompleteEventCode); + auto view = event_packet.view_t(); + view.status().Write(pwemb::StatusCode::SUCCESS); + view.page_scan_type().Write(page_scan_type_); + RespondWithCommandComplete(pwemb::OpCode::READ_PAGE_SCAN_TYPE, &event_packet); } void FakeController::OnWriteInquiryMode( 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 b2908909ae..4cf39fa6ae 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 @@ -389,14 +389,6 @@ constexpr OpCode kWriteInquiryMode = ControllerAndBasebandOpCode(0x0045); // Read Page Scan Type (v1.2) (BR/EDR) constexpr OpCode kReadPageScanType = ControllerAndBasebandOpCode(0x0046); -struct ReadPageScanTypeReturnParams { - // See enum StatusCode in hci_constants.h. - StatusCode status; - - // See enum class PageScanType in hci_constants.h for possible values. - pw::bluetooth::emboss::PageScanType page_scan_type; -} __attribute__((packed)); - // ==================================== // Write Page Scan Type (v1.2) (BR/EDR) constexpr OpCode kWritePageScanType = ControllerAndBasebandOpCode(0x0047);